Class CheckReport

java.lang.Object
de.aristaflow.adept2.util.CheckReport
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ChangeReport, LocalisedCheckReport

public class CheckReport extends Object implements Serializable
The check report is used for collection of check results. It consists of a collection of report entries, which are added by the checks. This check report is serialisable and may be written to a stream.
Author:
Markus Lauer, Kevin Goeser
See Also:
  • Field Details

    • reportEntries

      protected final List<CheckReport.ReportEntry> reportEntries
      List that keeps the report entries.
    • nextEntryNumber

      protected int nextEntryNumber
      Keeps the number that is assigned to the next report entry. The number minus one is always equivalent to the number of report entries. It is increased by one when a report entry is added.
    • locale

      protected Locale locale
      The preferred locale to be used for messages of this check report.
  • Constructor Details

    • CheckReport

      public CheckReport(URI base)
      Sets up the check report and assigns it to the given template or instance.

      Uses a URI for identifying the checked object. For the process model cf. ProcessElementIdentifierTools, e.g. use the method getTemplateIdentifier for process templates and getInstanceIdentifier for process instances.

      Parameters:
      base - The process element identifier URI of the template or instance this check report is assigned to.
    • CheckReport

      public CheckReport(URI base, Locale locale)
      Sets up the check report and assigns it to the given template or instance.

      Uses a URI for identifying the checked object. For the process model cf. ProcessElementIdentifierTools, e.g. use the method getTemplateIdentifier for process templates and getInstanceIdentifier for process instances.

      Parameters:
      base - The process element identifier URI of the template or instance this check report is assigned to.
      locale - The preferred locale to be used for messages of this check report.
  • Method Details

    • getBase

      public URI getBase()
      Returns the process element identifier URI of the template or instance this check report is assigned to.
      Returns:
      The process element identifier URI of the template or instance.
    • getPreferredLocale

      public Locale getPreferredLocale()
      Gets the locale this check report should provide (or at least a fallback of it).
      Returns:
      The locale this check report should provide (or at least a fallback of it).
    • addReportEntry

      public void addReportEntry(String checkID, CheckReport.ResultType reportEntryType, String message, URI... affectedElements)
      Adds a new entry to the report. Besides, the overall result of the report is adjusted accordingly to the given reportEntryType.
      Parameters:
      checkID - The identifier of the check that generates this report entry.
      reportEntryType - The severity of this report item.
      message - The message to report.
      affectedElements - The process element identifier URIs of the process elements affected by this report entry.
    • addReportEntry

      protected void addReportEntry(CheckReport.ReportEntry entry)
      Adds the designated new entry to the report. Besides, the overall result of the report is adjusted accordingly to the given reportEntryType.
      Parameters:
      entry - The report entry which to add.
    • getReportEntries

      public List<? extends CheckReport.ReportEntry> getReportEntries()
      Returns all report entries that keep the output of the different checks and are assigned to the check report.
      Returns:
      list of all report entries
    • getReportSummary

      public String getReportSummary()
      Returns a textual summary of all check report entries. Intended for use, e.g. at the console.
      Returns:
      A textual summary of all entries.
    • getSimpleReportSummary

      public String getSimpleReportSummary()
      Returns a textual summary of all warning and failure check report entries. Intended for use, e.g. at the console.
      Returns:
      A textual summary of all warning and failure entries.
    • printReportSummary

      public void printReportSummary()
      Prints the report summary to STDOUT.
    • getEntriesForCheckID

      public List<? extends CheckReport.ReportEntry> getEntriesForCheckID(String checkID)
      Returns all check report entries which do have the given checkID
      Parameters:
      checkID -
      Returns:
      check report entries or null if the check report does not contain any entries for the given id
    • getLastAddedReportEntry

      public CheckReport.ReportEntry getLastAddedReportEntry()
      Returns the last added report entry
      Returns:
      last added reportEntry or null if no entry exists till now.
    • getCheckResult

      public CheckReport.ResultType getCheckResult()
      Returns the overall result of all checks which have been run with this check report.
      Returns:
      The current overall result of all checks.
    • isFailure

      public boolean isFailure()
      Returns whether this report's overall result is CheckReport.ResultType.FAILURE.
      Returns:
      whether this report's overall result is CheckReport.ResultType.FAILURE