java.lang.Object
org.odpi.openmetadata.frameworks.auditlog.messagesets.MessageDefinition
Direct Known Subclasses:
AuditLogMessageDefinition, ExceptionMessageDefinition

public class MessageDefinition extends Object
MessageDefinition is a container that describes a single instance of a message. It is in fact the superclass of a message for an exception and for the audit log and as such, defines the values that are common to both. The concrete subclasses have the additional fields relevant to their specific definition.
  • Constructor Details

    • MessageDefinition

      public MessageDefinition(String messageId, String messageTemplate, String systemAction, String userAction)
      Constructor to save all the fixed values of a message. This is typically populated from an Enum message set. Use the constructor that takes a url if there is a page that explains this message's situation in more detail.
      Parameters:
      messageId - unique id of the message type.
      messageTemplate - template for the message text with placeholders for parameters.
      systemAction - description of the actions of the system when the situation arose.
      userAction - instructions on what to do next.
    • MessageDefinition

      public MessageDefinition(String messageId, String messageTemplate, String systemAction, String userAction, String url)
      Constructor to save all the fixed values of a message, including a link to further reading. This is typically populated from an Enum message set.
      Parameters:
      messageId - unique id of the message type.
      messageTemplate - template for the message text with placeholders for parameters.
      systemAction - description of the actions of the system when the situation arose.
      userAction - instructions on what to do next.
      url - link to a page that describes the component or concept behind this message - null if there is no suitable page.
  • Method Details

    • getMessageId

      public String getMessageId()
      Return the unique identifier for the message.
      Returns:
      string id
    • getMessageTemplate

      public String getMessageTemplate()
      Return the template of the message.
      Returns:
      string message text with placeholders
    • setMessageParameters

      public void setMessageParameters(String... params)
      Set up the specific values that apply to this message instance.
      Parameters:
      params - list of string message inserts for the message template
    • getMessageParams

      public String[] getMessageParams()
      Return the array of values that apply to this message instance.
      Returns:
      array of string message inserts for the message template
    • getSystemAction

      public String getSystemAction()
      Returns a description of the action taken by the system when the condition that caused this exception was detected.
      Returns:
      systemAction String
    • getUserAction

      public String getUserAction()
      Returns instructions on what to do next, given that this situation has occurred.
      Returns:
      userAction String
    • getURL

      public String getURL()
      Returns the link to further reading about the component or concept behind this message. This gives the reader of a log record or an error response somewhere to go for background on the situation.
      Returns:
      url String - null if the message has no suitable page
    • toString

      public String toString()
      JSON-style toString.
      Overrides:
      toString in class Object
      Returns:
      list of properties and their values.