Package de.aristaflow.adept2.util
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:
ProcessTemplateCheck
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CheckReport.ReportEntry
Represents an entry in the check report.static class
CheckReport.ResultType
Constants 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
Fields Modifier and Type Field Description protected Locale
locale
The preferred locale to be used for messages of this check report.protected int
nextEntryNumber
Keeps the number that is assigned to the next report entry.protected List<CheckReport.ReportEntry>
reportEntries
List that keeps the report entries.
-
Constructor Summary
Constructors Constructor Description CheckReport(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addReportEntry(CheckReport.ReportEntry entry)
Adds the designated new entry to the report.void
addReportEntry(String checkID, CheckReport.ResultType reportEntryType, String message, URI... affectedElements)
Adds a new entry to the report.URI
getBase()
Returns the process element identifier URI of the template or instance this check report is assigned to.CheckReport.ResultType
getCheckResult()
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 checkIDCheckReport.ReportEntry
getLastAddedReportEntry()
Returns the last added report entryLocale
getPreferredLocale()
Gets the locale this check report should provide (or at least a fallback of it).List<? extends CheckReport.ReportEntry>
getReportEntries()
Returns all report entries that keep the output of the different checks and are assigned to the check report.String
getReportSummary()
Returns a textual summary of all check report entries.String
getSimpleReportSummary()
Returns a textual summary of all warning and failure check report entries.boolean
isFailure()
Returns whether this report'soverall result
isCheckReport.ResultType.FAILURE
.void
printReportSummary()
Prints the report summary to STDOUT.
-
-
-
Field Detail
-
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 Detail
-
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 methodgetTemplateIdentifier
for process templates andgetInstanceIdentifier
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 methodgetTemplateIdentifier
for process templates andgetInstanceIdentifier
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 Detail
-
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 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
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 givenreportEntryType
.- 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'soverall result
isCheckReport.ResultType.FAILURE
.- Returns:
- whether this report's
overall result
isCheckReport.ResultType.FAILURE
-
-