Class InitializationReport
java.lang.Object
com.aquima.interactions.foundation.report.InitializationReport
- All Implemented Interfaces:
IInitializationReport
,Serializable
This class is used to gather all the error and warning messages that are detected during the initialization of an
application.
- Since:
- 5.0
- Author:
- O. Kerpershoek
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInitializationReport
(ErrorCode code, String[] parameters) Constructs an initialisation report. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addReport
(IInitializationReport other) int
beginScope
(Category category, ErrorCode code, String[] parameters) This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code.void
endScope
(int scopeId) This method ends the scope of the initialisation report.int
This method returns the number of messages with the Severity DEPRECATION that are present in the report.int
This method returns the number of messages with the Severity ERROR that are present in the report.int
This method returns the number of messages with the Severity EXPERIMENTAL that are present in the reportint
This method returns the number of messages with the Severity FATAL that are present in the report.int
This method returns the total number of messages that is present in the report.int
getMessageCount
(Severity severity) This method returns the number of messages with the requested severity.getMessages
(Severity severity) This method returns an array containing all the messages of the requested severity.protected IXmlElement
getMessageXml
(InitializationMessage message) This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.Severity[]
This method returns an array containing the severities of the messages in the report.protected IXmlElement
getSeverityXml
(Severity severity) int
This method returns the number of messages with the Severity WARNING that are present in the report.boolean
This method returns a boolean indicating if any messages have been added to the report.toString()
toXml()
This method returns an XML representation of the report.
-
Constructor Details
-
InitializationReport
public InitializationReport() -
InitializationReport
Constructs an initialisation report.- Parameters:
code
- The error code of the initialisation report.parameters
- The parameters of the code.
-
-
Method Details
-
hasMessages
public boolean hasMessages()Description copied from interface:IInitializationReport
This method returns a boolean indicating if any messages have been added to the report.- Specified by:
hasMessages
in interfaceIInitializationReport
- Returns:
- a boolean indicating if any messages have been added to the report.
-
addMessage
Description copied from interface:IInitializationReport
This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.- Specified by:
addMessage
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.
-
addMessage
public void addMessage(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) Description copied from interface:IInitializationReport
This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context. In addition a cause can be added in case of spurious errors.- Specified by:
addMessage
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.cause
- The exception which causes the error which is added to the report.
-
getMessages
Description copied from interface:IInitializationReport
This method returns an array containing all the messages of the requested severity. If no messages with the requested severity are found, an empty array is returned.- Specified by:
getMessages
in interfaceIInitializationReport
- Parameters:
severity
- The severity of the requested messages.- Returns:
- an array containing all the messages of the requested severity.
-
getMessageCount
Description copied from interface:IInitializationReport
This method returns the number of messages with the requested severity.- Specified by:
getMessageCount
in interfaceIInitializationReport
- Parameters:
severity
- The severity of the requested message count.- Returns:
- the number of messages with the requested severity.
-
getMessageCount
public int getMessageCount()Description copied from interface:IInitializationReport
This method returns the total number of messages that is present in the report.- Specified by:
getMessageCount
in interfaceIInitializationReport
- Returns:
- the total number of messages that is present in the report.
-
getFatalCount
public int getFatalCount()This method returns the number of messages with the Severity FATAL that are present in the report.- Returns:
- the number of messages with the Severity FATAL that are present in the report.
-
getErrorCount
public int getErrorCount()This method returns the number of messages with the Severity ERROR that are present in the report.- Returns:
- the number of messages with the Severity ERROR that are present in the report.
-
getDeprecationCount
public int getDeprecationCount()This method returns the number of messages with the Severity DEPRECATION that are present in the report.- Returns:
- the number of messages with the Severity DEPRECATION that are present in the report.
-
getExperimentalCount
public int getExperimentalCount()This method returns the number of messages with the Severity EXPERIMENTAL that are present in the report- Returns:
- the number of messages with the Severity EXPERIMENTAL that are present in the report
-
getWarningCount
public int getWarningCount()This method returns the number of messages with the Severity WARNING that are present in the report.- Returns:
- the number of messages with the Severity WARNING that are present in the report.
-
getSeverities
This method returns an array containing the severities of the messages in the report.- Returns:
- an array containing the severities of the messages in the report.
-
toXml
Description copied from interface:IInitializationReport
This method returns an XML representation of the report.- Specified by:
toXml
in interfaceIInitializationReport
- Returns:
- an XML representation of the report.
-
getSeverityXml
-
getMessageXml
-
getRootMessage
Description copied from interface:IInitializationReport
This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.- Specified by:
getRootMessage
in interfaceIInitializationReport
- Returns:
- The root message of the initialisation report.
-
endScope
public void endScope(int scopeId) Description copied from interface:IInitializationReport
This method ends the scope of the initialisation report.- Specified by:
endScope
in interfaceIInitializationReport
- Parameters:
scopeId
- The unique id which was retrieved by the beginscope call.
-
beginScope
Description copied from interface:IInitializationReport
This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code. Using this structure gives the initialisation messages a tree like structure.- Specified by:
beginScope
in interfaceIInitializationReport
- Parameters:
category
- The category (component) where the message/scope originated from.code
- The code of the initialisation message which is used only if an initialisation message is added.parameters
- array of parameters for the message.- Returns:
- A unique identifier which can be used to end the current scope.
-
toString
-
addReport
- Specified by:
addReport
in interfaceIInitializationReport
-