java.lang.Object
edu.hm.hafner.analysis.Report
Alle implementierten Schnittstellen:
Serializable, Iterable<Issue>

public class Report extends Object implements Iterable<Issue>, Serializable
A report contains a set of unique issues: it contains no duplicate elements, i.e. it models the mathematical set abstraction. This report provides a total ordering on its elements. I.e., the issues in this report are ordered by their index: the first added issue is at position 0, the second added issues is at position 1, and so on.

Additionally, this report provides methods to find and filter issues based on different properties. In order to create issues use the provided builder class.

Autor:
Ullrich Hafner
Siehe auch:
  • Konstruktordetails

    • Report

      public Report()
      Creates an empty Report.
    • Report

      public Report(String id, String name)
      Creates an empty Report with the specified ID and name.
      Parameter:
      id - the ID of the report
      name - a human-readable name for the report
    • Report

      public Report(String id, String name, String originReportFile)
      Creates an empty Report with the specified ID and name. Link the report with the specified source file that is the origin of the issues.
      Parameter:
      id - the ID of the report
      name - a human-readable name for the report
      originReportFile - the specified source file * that is the origin of the issues.
    • Report

      public Report(Report... reports)
      Creates a new Report that is an aggregation of the specified reports. The created report will contain the issues of all specified reports, in the same order. The properties of the specified reports will also be copied.
      Parameter:
      reports - the reports to append
      Siehe auch:
      • copyIssuesAndProperties(Report, Report)
    • Report

      public Report(Collection<? extends Report> reports)
      Creates a new Report that is an aggregation of the specified reports. The created report will contain the issues of all specified reports, in the same order. The properties of the specified reports will also be copied.
      Parameter:
      reports - the initial set of issues
      Siehe auch:
      • copyIssuesAndProperties(Report, Report)
  • Methodendetails

    • getId

      public String getId()
    • getEffectiveId

      public String getEffectiveId()
      Returns the effective ID of this report. This ID is the unique ID of all containing sub-reports. If this ID is not unique, then the DEFAULT_ID will be returned.
      Gibt zurück:
      the effective ID of all sub-reports
    • getName

      public String getName()
    • setOrigin

      public void setOrigin(String originId, String originName)
      Sets the origin of all issues in this report. Calling this method will associate all containing issues and issues in sub-reports using the specified ID and name.
      Parameter:
      originId - the ID of the report
      originName - a human-readable name for the report
    • getEffectiveName

      public String getEffectiveName()
      Returns the effective ID of this report. This ID is the unique ID of all containing sub-reports. If this ID is not unique, then the DEFAULT_ID will be returned.
      Gibt zurück:
      the effective ID of all sub-reports
    • getOriginReportFile

      public String getOriginReportFile()
    • setOriginReportFile

      public void setOriginReportFile(String originReportFile)
    • getOriginReportFiles

      public Set<String> getOriginReportFiles()
      Returns the names of all report files that are the origin for the issues of this Report (and all contained sub-reports).
      Gibt zurück:
      the names of all report files
    • add

      public Report add(Issue issue)
      Appends the specified issue to the end of this report. Duplicates will be skipped (the number of skipped elements is available using the method getDuplicatesSize().
      Parameter:
      issue - the issue to append
      Gibt zurück:
      this
    • addAll

      public Report addAll(Issue issue, Issue... additionalIssues)
      Appends all the specified issues to the end of this report, preserving the order of the array elements. Duplicates will be skipped (the number of skipped elements is available using the method getDuplicatesSize()).
      Parameter:
      issue - the first issue to append
      additionalIssues - the additional issue to append
      Gibt zurück:
      this
      Siehe auch:
    • addAll

      public Report addAll(Collection<? extends Issue> issues)
      Appends all of the specified issues to the end of this report, preserving the order of the array elements. Duplicates will be skipped (the number of skipped elements is available using the method getDuplicatesSize().
      Parameter:
      issues - the issues to append
      Gibt zurück:
      this
      Siehe auch:
    • addAll

      public Report addAll(Report... reports)
      Appends the specified reports to this report. This report will then contain the issues of all specified reports, in the same order. The properties of the specified reports will also be copied.
      Parameter:
      reports - the reports to append
      Gibt zurück:
      this
      Siehe auch:
      • copyIssuesAndProperties(Report, Report)
    • readResolve

      protected Object readResolve()
      Called after de-serialization to improve the memory usage and to initialize fields that have been introduced after the first release.
      Gibt zurück:
      this
    • findById

      public Issue findById(UUID issueId)
      Returns the issue with the specified ID.
      Parameter:
      issueId - the ID of the issue
      Gibt zurück:
      the found issue
      Löst aus:
      NoSuchElementException - if there is no such issue found
    • findByProperty

      public Set<Issue> findByProperty(Predicate<? super Issue> criterion)
      Finds all issues that match the specified criterion.
      Parameter:
      criterion - the filter criterion
      Gibt zurück:
      the found issues
    • filter

      public Report filter(Predicate<? super Issue> criterion)
      Finds all issues that match the specified criterion.
      Parameter:
      criterion - the filter criterion
      Gibt zurück:
      the found issues
    • iterator

      @NonNull public Iterator<Issue> iterator()
      Angegeben von:
      iterator in Schnittstelle Iterable<Issue>
    • stream

      public Stream<Issue> stream()
      Creates a new sequential Stream of Issue instances.
      Gibt zurück:
      a new Stream
    • get

      public Collection<Issue> get()
      Returns the issues in this report. This will include the issues of any sub-reports.
      Gibt zurück:
      all issues in this report
    • get

      public Issue get(int index)
      Returns the issue with the specified index.
      Parameter:
      index - the index
      Gibt zurück:
      the issue at the specified index
      Löst aus:
      IndexOutOfBoundsException - if there is no element for the given index
    • size

      public int size()
      Returns the number of issues in this container.
      Gibt zurück:
      total number of issues
    • isEmpty

      public boolean isEmpty()
      Returns whether this report is empty.
      Gibt zurück:
      true if this report is empty, false otherwise
      Siehe auch:
    • isNotEmpty

      public boolean isNotEmpty()
      Returns whether this report is not empty.
      Gibt zurück:
      true if this report is not empty, false otherwise
      Siehe auch:
    • getSize

      public int getSize()
      Returns the number of issues in this report.
      Gibt zurück:
      total number of issues
    • getDuplicatesSize

      public int getDuplicatesSize()
      Returns the number of duplicates. Every issue that has been added to this report, but already is part of this report (based on equals(Object)) is counted as a duplicate. Duplicates are not stored in this report.
      Gibt zurück:
      total number of duplicates
    • getSizeOf

      public int getSizeOf(String severity)
      Returns the number of issues with the specified severity.
      Parameter:
      severity - the severity of the issues
      Gibt zurück:
      total number of issues
    • getSizeOf

      public int getSizeOf(Severity severity)
      Returns the number of issues with the specified Severity.
      Parameter:
      severity - the severity of the issues
      Gibt zurück:
      total number of issues
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • print

      public void print(Report.IssuePrinter issuePrinter)
      Prints all issues of the report.
      Parameter:
      issuePrinter - prints a summary of an Issue
    • getModules

      public Set<String> getModules()
      Returns the affected modules for all issues.
      Gibt zurück:
      the affected modules
    • hasModules

      public boolean hasModules()
      Returns whether this report contains affected files from more than one module.
      Gibt zurück:
      true if the number of modules is greater than 1, false otherwise
    • getPackages

      public Set<String> getPackages()
      Returns the affected packages for all issues.
      Gibt zurück:
      the affected packages
    • hasPackages

      public boolean hasPackages()
      Returns whether this report contains affected files from more than one package.
      Gibt zurück:
      true if the number of packages is greater than 1, false otherwise
    • getFolders

      public Set<String> getFolders()
      Returns the folders for all affected files of the issues.
      Gibt zurück:
      the affected packages
    • hasFolders

      public boolean hasFolders()
      Returns whether this report contains more than one folder with affected files.
      Gibt zurück:
      true if the number of folders is greater than 1, false otherwise
    • getAbsolutePaths

      public Set<String> getAbsolutePaths()
      Returns the absolute paths of the affected files for all issues.
      Gibt zurück:
      the affected files
    • getFiles

      public Set<String> getFiles()
      Returns the affected files for all issues.
      Gibt zurück:
      the affected files
    • hasFiles

      public boolean hasFiles()
      Returns whether this report contains more than one affected file.
      Gibt zurück:
      true if the number of affected files is greater than 1, false otherwise
    • getCategories

      public Set<String> getCategories()
      Returns the used categories for all issues.
      Gibt zurück:
      the used categories
    • hasCategories

      public boolean hasCategories()
      Returns whether this report contains issues with different categories.
      Gibt zurück:
      true if the number of categories is greater than 1, false otherwise
    • getTypes

      public Set<String> getTypes()
      Returns the used types for all issues.
      Gibt zurück:
      the used types
    • hasTypes

      public boolean hasTypes()
      Returns whether this report contains issues with different types.
      Gibt zurück:
      true if the number of types is greater than 1, false otherwise
    • getTools

      public Set<String> getTools()
      Returns the names of the tools that did report the issues.
      Gibt zurück:
      the tools
    • hasTools

      public boolean hasTools()
      Returns whether this report contains issues created by different tools.
      Gibt zurück:
      true if the number of tools is greater than 1, false otherwise
    • getSeverities

      public Set<Severity> getSeverities()
      Returns the severities of all issues.
      Gibt zurück:
      the severities
    • hasSeverities

      public boolean hasSeverities()
      Returns whether this report contains issues of different severities.
      Gibt zurück:
      true if the number of severities is greater than 1, false otherwise
    • getProperties

      public <T> Set<T> getProperties(Function<? super Issue,T> propertiesMapper)
      Returns the different values for a given property for all issues.
      Typparameter:
      T - type of the property
      Parameter:
      propertiesMapper - the properties mapper that selects the property
      Gibt zurück:
      the set of different values
      Siehe auch:
    • getPropertyCount

      public <T> Map<T,Integer> getPropertyCount(Function<? super Issue,T> propertiesMapper)
      Returns the number of occurrences for every existing value of a given property for all issues.
      Typparameter:
      T - type of the property
      Parameter:
      propertiesMapper - the properties mapper that selects the property to evaluate
      Gibt zurück:
      a mapping of: property value to the number of issues for that value
      Siehe auch:
    • groupByProperty

      public Map<String,Report> groupByProperty(String propertyName)
      Groups issues by a specified property. Returns the results as a mapping of property values to a new set of Report for this value.
      Parameter:
      propertyName - the property to that selects the property to evaluate
      Gibt zurück:
      a mapping of: property value to the number of issues for that value
      Siehe auch:
    • copy

      public Report copy()
      Returns a shallow copy of this issue container.
      Gibt zurück:
      a new issue container that contains the same elements in the same order
    • copyEmptyInstance

      public Report copyEmptyInstance()
      Returns a new empty issue container with the same properties as this container. The new issue container is empty and does not contain issues.
      Gibt zurück:
      a new issue container that contains the same properties but no issues
    • mergeLogMessages

      public void mergeLogMessages(edu.hm.hafner.util.FilteredLog log)
      Merge all log messages from the specified log into the log of this report.
      Parameter:
      log - the log messages to merge
    • logInfo

      @FormatMethod public void logInfo(String format, Object... args)
      Logs the specified information message. Use this method to log any useful information when composing this report.
      Parameter:
      format - A format string
      args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      Siehe auch:
    • logError

      @FormatMethod public void logError(String format, Object... args)
      Logs the specified error message. Use this method to log any error when composing this report.
      Parameter:
      format - A format string
      args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      Siehe auch:
    • logException

      @FormatMethod public void logException(Exception exception, String format, Object... args)
      Logs the specified exception. Use this method to log any exception when composing this report.
      Parameter:
      exception - the exception to log
      format - A format string
      args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero.
      Siehe auch:
    • getInfoMessages

      public List<String> getInfoMessages()
      Returns the info messages that have been reported since the creation of this set of issues.
      Gibt zurück:
      the info messages
    • getErrorMessages

      public List<String> getErrorMessages()
      Returns the error messages that have been reported since the creation of this set of issues.
      Gibt zurück:
      the error messages
    • hasErrors

      public boolean hasErrors()
      Returns whether error messages have been reported.
      Gibt zurück:
      true if there are error messages, false otherwise
    • equals

      public boolean equals(@CheckForNull Object o)
      Setzt außer Kraft:
      equals in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • getNameOfOrigin

      public String getNameOfOrigin(String origin)
      Returns a human-readable name for the specified origin of this report.
      Parameter:
      origin - the origin to get the human-readable name for
      Gibt zurück:
      the name, or an empty string if no such name has been set
    • setCounter

      public void setCounter(String key, int value)
      Sets the specified custom counter for this report.
      Parameter:
      key - the unique key for this counter
      value - the value to set
    • getCounter

      public int getCounter(String key)
      Returns the specified custom counter of this report.
      Parameter:
      key - the unique key for this counter
      Gibt zurück:
      the value of the specified counter, or 0 if the counter has not been set or is undefined
    • hasCounter

      public boolean hasCounter(String key)
      Returns whether the specified custom counter of this report is defined.
      Parameter:
      key - the unique key for this counter
      Gibt zurück:
      true if the counter has been set, false otherwise