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 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

      public String getElementType()
      This method returns the type of the element the message belongs to.
      Returns:
      The type of the element the message belongs to.
    • getElementName

      public String getElementName()
      This method returns the name of the element the message belongs to.
      Returns:
      The name of the element the message belongs to.
    • getProperty

      public String getProperty(String name)
      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

      public Category getCategory()
      Returns the category in the which the message is placed.
      Returns:
      returned category is never null
    • getSeverity

      public Severity getSeverity()
      Retrieves the severity of the message ranging from fatal to warning.
      Returns:
      returned severity is never null
    • getErrorMessage

      public ErrorMessage getErrorMessage()
      Retrieves the (multi-lingual) errormessage.
      Returns:
      returned error message is never null
    • getCause

      public Throwable getCause()
      Optionally retrieves the cause of this message in case there was a trace involved.
      Returns:
      returned cause can be null
    • blame

      protected void blame(String key, String elementName)
      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

      public String getEnglishMessage()
      This method returns the message text.
      Returns:
      The message text of the message.
    • addChildMessage

      public void 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.
      Parameters:
      childMessage - The child initialization message object which is mandatory.
    • updateSeverity

      protected void updateSeverity(Severity severity)
    • setParentMessage

      protected void setParentMessage(InitializationMessage parent)
    • getChildMessages

      public InitializationMessage[] 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

      public int compareTo(InitializationMessage other)
      Specified by:
      compareTo in interface Comparable<InitializationMessage>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSeverities

      protected void getSeverities(Set<Severity> result)
      This method collects the severities of this message and any child message.
      Parameters:
      result - The set where the severities should be added to.
    • getMessages

      protected void getMessages(Set<InitializationMessage> resultSet, Severity severity)
    • getMessageCount

      public int getMessageCount(Severity severity)
      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.