Class ResultAccess


  • public final class ResultAccess
    extends java.lang.Object
    Access object for storing script results. This object can be accessed via the global script variable "result".
    • Constructor Summary

      Constructors 
      Constructor Description
      ResultAccess​(com.hello2morrow.sonargraph.core.model.script.ScriptResultSet scriptResultSet)
      Internal constructor - do not use
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      NodeAccess addDependencyNode​(DependencyAccess dependencyAccess)
      Add a root dependency node to the result tree.
      NodeAccess addDependencyNode​(NodeAccess nodeAccess, DependencyAccess dependencyAccess)
      Add a dependency intermediate or leaf node to the result tree
      void addElement​(ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
      Add an element to the list of results.
      boolean addErrorIssue​(ElementAccess<?> elementAccess, java.lang.String issueId, java.lang.String description)
      Add a new error issue to the issues detected by this script.
      void addErrorIssue​(SourceFileAccess sourceFileAccess, java.lang.String issueId, java.lang.String description, SourceLineAccess lineAccess)
      Add a new error issue to the issues detected by this script.
      boolean addInfoIssue​(ElementAccess<?> elementAccess, java.lang.String issueId, java.lang.String description)
      Add a new informational issue to the issues detected by this script.
      void addInfoIssue​(SourceFileAccess sourceFileAccess, java.lang.String issueId, java.lang.String description, int line)
      Add a new informational issue to the issues detected by this script.
      void addInfoIssue​(SourceFileAccess sourceFileAccess, java.lang.String issueId, java.lang.String description, SourceLineAccess sourceLineAccess)
      Add a new informational issue to the issues detected by this script.
      void addMetricValue​(MetricIdAccess id, ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.NamedElement> elementAccess, java.lang.Number value)
      Add a custom metric value to the script result.
      NodeAccess addNode​(ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
      Add a root node to the result tree.
      NodeAccess addNode​(NodeAccess nodeAccess, ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
      Add a leaf or intermediate node to the result tree
      NodeAccess addNode​(NodeAccess nodeAccess, java.lang.String name)
      Add a named intermediate node to the result tree
      NodeAccess addNode​(java.lang.String name)
      Add a root node to the result tree.
      boolean addWarningIssue​(ElementAccess<?> elementAccess, java.lang.String issueId, java.lang.String description)
      Add a new warning issue to the issues detected by this script.
      void addWarningIssue​(SourceFileAccess sourceFileAccess, java.lang.String issueId, java.lang.String description, int line)
      Add a new warning issue to the issues detected by this script.
      void addWarningIssue​(SourceFileAccess sourceFileAccess, java.lang.String issueId, java.lang.String description, SourceLineAccess sourceLineAccess)
      Add a new warning issue to the issues detected by this script.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultAccess

        public ResultAccess​(com.hello2morrow.sonargraph.core.model.script.ScriptResultSet scriptResultSet)
        Internal constructor - do not use
    • Method Detail

      • addElement

        public void addElement​(ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
        Add an element to the list of results.
        Parameters:
        elementAccess - The element to be added
      • addNode

        public NodeAccess addNode​(java.lang.String name)
        Add a root node to the result tree.
        Parameters:
        name - Node name.
        Returns:
        A new node access object.
      • addNode

        public NodeAccess addNode​(ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
        Add a root node to the result tree.
        Parameters:
        elementAccess - The element associated with this node
        Returns:
        A new node access object.
      • addNode

        public NodeAccess addNode​(NodeAccess nodeAccess,
                                  ElementAccess<? extends com.hello2morrow.sonargraph.core.model.element.Element> elementAccess)
        Add a leaf or intermediate node to the result tree
        Parameters:
        nodeAccess - The parent node
        elementAccess - The element associated with this node
        Returns:
        A new node access object
      • addNode

        public NodeAccess addNode​(NodeAccess nodeAccess,
                                  java.lang.String name)
        Add a named intermediate node to the result tree
        Parameters:
        nodeAccess - The parent node
        name - Node name
        Returns:
        A new node access object
      • addDependencyNode

        public NodeAccess addDependencyNode​(NodeAccess nodeAccess,
                                            DependencyAccess dependencyAccess)
        Add a dependency intermediate or leaf node to the result tree
        Parameters:
        nodeAccess - The parent node
        dependencyAccess - The dependency associated with this node.
        Returns:
        A new node access object
      • addDependencyNode

        public NodeAccess addDependencyNode​(DependencyAccess dependencyAccess)
        Add a root dependency node to the result tree.
        Parameters:
        dependencyAccess - The dependency associated with this node
        Returns:
        A new node access object
      • addErrorIssue

        public boolean addErrorIssue​(ElementAccess<?> elementAccess,
                                     java.lang.String issueId,
                                     java.lang.String description)
        Add a new error issue to the issues detected by this script.
        Parameters:
        elementAccess - The element associated with the error
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the error
        Returns:
        'true' if the issue could be added - excluded elements and elements ignoring issues do not carry issues
      • addInfoIssue

        public boolean addInfoIssue​(ElementAccess<?> elementAccess,
                                    java.lang.String issueId,
                                    java.lang.String description)
        Add a new informational issue to the issues detected by this script.
        Parameters:
        elementAccess - The element associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        Returns:
        'true' if the issue could be added - excluded elements and elements ignoring issues do not carry issues
      • addWarningIssue

        public boolean addWarningIssue​(ElementAccess<?> elementAccess,
                                       java.lang.String issueId,
                                       java.lang.String description)
        Add a new warning issue to the issues detected by this script.
        Parameters:
        elementAccess - The element associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        Returns:
        'true' if the issue could be added - excluded elements and elements ignoring issues do not carry issues
      • addWarningIssue

        public void addWarningIssue​(SourceFileAccess sourceFileAccess,
                                    java.lang.String issueId,
                                    java.lang.String description,
                                    int line)
        Add a new warning issue to the issues detected by this script.
        Parameters:
        sourceFileAccess - The source file associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        line - The line number
      • addErrorIssue

        public void addErrorIssue​(SourceFileAccess sourceFileAccess,
                                  java.lang.String issueId,
                                  java.lang.String description,
                                  SourceLineAccess lineAccess)
        Add a new error issue to the issues detected by this script.
        Parameters:
        sourceFileAccess - The source file associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        line - The line number
      • addWarningIssue

        public void addWarningIssue​(SourceFileAccess sourceFileAccess,
                                    java.lang.String issueId,
                                    java.lang.String description,
                                    SourceLineAccess sourceLineAccess)
        Add a new warning issue to the issues detected by this script.
        Parameters:
        sourceFileAccess - The source file associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        line - The
      • addInfoIssue

        public void addInfoIssue​(SourceFileAccess sourceFileAccess,
                                 java.lang.String issueId,
                                 java.lang.String description,
                                 int line)
        Add a new informational issue to the issues detected by this script.
        Parameters:
        sourceFileAccess - The source file associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        line - The line number
      • addInfoIssue

        public void addInfoIssue​(SourceFileAccess sourceFileAccess,
                                 java.lang.String issueId,
                                 java.lang.String description,
                                 SourceLineAccess sourceLineAccess)
        Add a new informational issue to the issues detected by this script.
        Parameters:
        sourceFileAccess - The source file associated with the issue
        issueId - A unique issue id describing the issue class
        description - A more detailed description of the issue
        line - The line number