Package de.aristaflow.adept2.util
Class CheckReport
java.lang.Object
de.aristaflow.adept2.util.CheckReport
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ChangeReport,LocalisedCheckReport
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents an entry in the check report.static enumConstants that define whether the corresponding report or report entry contains an error message (FAILURE), a warning message (WARNING), an info message (INFO) or simply a success message (OK). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LocaleThe preferred locale to be used for messages of this check report.protected intKeeps the number that is assigned to the next report entry.protected final List<CheckReport.ReportEntry>List that keeps the report entries. -
Constructor Summary
ConstructorsConstructorDescriptionCheckReport(URI base) Sets up the check report and assigns it to the given template or instance.CheckReport(URI base, Locale locale) Sets up the check report and assigns it to the given template or instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds the designated new entry to the report.voidaddReportEntry(String checkID, CheckReport.ResultType reportEntryType, String message, URI... affectedElements) Adds a new entry to the report.getBase()Returns the process element identifier URI of the template or instance this check report is assigned to.Returns the overall result of all checks which have been run with this check report.List<? extends CheckReport.ReportEntry>getEntriesForCheckID(String checkID) Returns all check report entries which do have the given checkIDReturns the last added report entryGets the locale this check report should provide (or at least a fallback of it).List<? extends CheckReport.ReportEntry>Returns all report entries that keep the output of the different checks and are assigned to the check report.Returns a textual summary of all check report entries.Returns a textual summary of all warning and failure check report entries.booleanReturns whether this report'soverall resultisCheckReport.ResultType.FAILURE.voidPrints the report summary to STDOUT.
-
Field Details
-
reportEntries
List that keeps the report entries. -
nextEntryNumber
protected int nextEntryNumberKeeps 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
The preferred locale to be used for messages of this check report.
-
-
Constructor Details
-
CheckReport
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 methodgetTemplateIdentifierfor process templates andgetInstanceIdentifierfor process instances.- Parameters:
base- The process element identifier URI of the template or instance this check report is assigned to.
-
CheckReport
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 methodgetTemplateIdentifierfor process templates andgetInstanceIdentifierfor 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
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
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 givenreportEntryType.- 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
Adds the designated new entry to the report. Besides, the overall result of the report is adjusted accordingly to the givenreportEntryType.- Parameters:
entry- The report entry which to add.
-
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
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
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
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
Returns the last added report entry- Returns:
- last added reportEntry or null if no entry exists till now.
-
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'soverall resultisCheckReport.ResultType.FAILURE.- Returns:
- whether this report's
overall resultisCheckReport.ResultType.FAILURE
-