Class InitializationMessage
java.lang.Object
com.aquima.interactions.foundation.report.InitializationMessage
- All Implemented Interfaces:
Serializable
,Comparable<InitializationMessage>
public class InitializationMessage
extends Object
implements Serializable, Comparable<InitializationMessage>
Simple object containing an error which was detected during initialization. The error messages are sorted on
severity.
- Since:
- 5.0
- Author:
- Jon van Leuven, O. Kerpershoek, F. van der Meer
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInitializationMessage
(Category category, Severity severity, ErrorMessage errorMessage, Throwable cause) Constructs an initialisation message object with a category, severity, error message and a cause. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildMessage
(InitializationMessage childMessage) This method adds a child message to this message, when the child message severity is higher then the severity of this message this message's severity is changes to the severity of the child message.protected void
This adds information to this message as to who is causing the problem.int
compareTo
(InitializationMessage other) Returns the category in the which the message is placed.getCause()
Optionally retrieves the cause of this message in case there was a trace involved.This method returns the child messages this message has, if there are no child messages an empty array is returned.This method returns the name of the element the message belongs to.This method returns the type of the element the message belongs to.This method returns the message text.Retrieves the (multi-lingual) errormessage.int
getMessageCount
(Severity severity) This method counts the number of messages, including child messages, that match the given severity.protected void
getMessages
(Set<InitializationMessage> resultSet, Severity severity) getProperty
(String name) This method returns the value of the specified property.protected void
getSeverities
(Set<Severity> result) This method collects the severities of this message and any child message.Retrieves the severity of the message ranging from fatal to warning.boolean
This method returns a boolean indicating if any child messages are present in this message.protected void
toString()
protected void
updateSeverity
(Severity severity)
-
Constructor Details
-
InitializationMessage
public InitializationMessage(Category category, Severity severity, ErrorMessage errorMessage, Throwable cause) Constructs an initialisation message object with a category, severity, error message and a cause. This exception is generally used by the data layer to report various problems during the initialisation phase of the portal engine.- Parameters:
category
- The category of this exception, which is essentially a grouping identifier of the message.severity
- The severity of this exception, this is essentially a second grouping identifier of the message which allows the client to display heavy severities in other colours.errorMessage
- The error message object of the exception, this is a message which is translatable.cause
- The cause of the exception which can be used for acquiring more information.
-
-
Method Details
-
getElementType
This method returns the type of the element the message belongs to.- Returns:
- The type of the element the message belongs to.
-
getElementName
This method returns the name of the element the message belongs to.- Returns:
- The name of the element the message belongs to.
-
getProperty
This method returns the value of the specified property. If no value has been specified for the property, a null value will be returned.- Parameters:
name
- The name of the property whose value is requested.- Returns:
- The value for the property, or null if no value is present.
-
getCategory
Returns the category in the which the message is placed.- Returns:
- returned category is never null
-
getSeverity
Retrieves the severity of the message ranging from fatal to warning.- Returns:
- returned severity is never null
-
getErrorMessage
Retrieves the (multi-lingual) errormessage.- Returns:
- returned error message is never null
-
getCause
Optionally retrieves the cause of this message in case there was a trace involved.- Returns:
- returned cause can be null
-
blame
This adds information to this message as to who is causing the problem. The key represents a certain type and the element name is quite often unique for the key specified which allows the end-user to identify the source of the problem.- Parameters:
key
- A key string which is a certain entity within the model ( entity, attribute, decision table, asset etc )elementName
- The name of the element causing the problem.
-
getEnglishMessage
This method returns the message text.- Returns:
- The message text of the message.
-
addChildMessage
This method adds a child message to this message, when the child message severity is higher then the severity of this message this message's severity is changes to the severity of the child message.- Parameters:
childMessage
- The child initialization message object which is mandatory.
-
updateSeverity
-
setParentMessage
-
getChildMessages
This method returns the child messages this message has, if there are no child messages an empty array is returned.- Returns:
- An array of initialisation messages, the array can be zero length, however the array will never be null.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<InitializationMessage>
-
toString
-
getSeverities
This method collects the severities of this message and any child message.- Parameters:
result
- The set where the severities should be added to.
-
getMessages
-
getMessageCount
This method counts the number of messages, including child messages, that match the given severity. A message is only counted when it does not have any child messages, as a group node is not actually an error, but merely a container for messages.- Parameters:
severity
- The severity of which the count is requested.- Returns:
- The number of messages matching the given severity.
-
hasChildMessages
public boolean hasChildMessages()This method returns a boolean indicating if any child messages are present in this message.- Returns:
- a boolean indicating if any child messages are present in this message.
-