Class MessageTemplate

java.lang.Object
org.deltava.beans.system.MessageTemplate
All Implemented Interfaces:
Serializable, Cloneable, Comparable<MessageTemplate>, Auditable, ViewEntry, Cacheable

public class MessageTemplate extends Object implements Comparable<MessageTemplate>, Auditable, Cacheable, ViewEntry
A class for storing E-Mail message templates.
Since:
1.0
Version:
11.0
Author:
Luke
See Also:
  • Constructor Details

    • MessageTemplate

      public MessageTemplate(String name)
      Creates a new Message Template with a given name and subject.
      Parameters:
      name - the name of the template
      Throws:
      NullPointerException - if either name or subject are null
      See Also:
  • Method Details

    • getName

      public String getName()
      Returns the name of the template.
      Returns:
      the template name
    • getSubject

      public String getSubject()
      Returns the subject of the generated e-mail message.
      Returns:
      the e-mail message subject
      See Also:
    • getDescription

      public String getDescription()
      Returns a user-readable description of this Message template.
      Returns:
      the template description
      See Also:
    • getBody

      public String getBody()
      Returns the body of the message template.
      Returns:
      the message template body. This can contain macros to be parsed by MessageContext.
      See Also:
    • getIsHTML

      public boolean getIsHTML()
      Returns if the message should be sent as HTML or plain text.
      Returns:
      TRUE if the message is formatted as HTML, otherwise FALSE
      See Also:
    • getNoReply

      public boolean getNoReply()
      Returns if replies to the message should be disabled.
      Returns:
      TRUE if replies disabled, otherwise FALSE
      See Also:
    • getActionTypes

      public Collection<NotifyActionType> getActionTypes()
      Returns the action types to embed in the push notification.
      Returns:
      a Collection of NotifyActionType enums
    • getNotifyContext

      public String getNotifyContext()
      Returns the ID of the push notification context object.
      Returns:
      the context object ID or null if none
    • getNotificationTTL

      public int getNotificationTTL()
      Returns the TTL of the push notification sent.
      Returns:
      the TTL in seconds
    • isCrossApp

      public boolean isCrossApp()
      Description copied from interface: Auditable
      Returns whether this object is within multiple web applications. Objects where this is false will need additional data appended to the audit ID to prevent information leakage across applications where the audit IDs are identical between apps.
      Specified by:
      isCrossApp in interface Auditable
      Returns:
      TRUE if cross-application, otherwise FALSE
    • setDescription

      public void setDescription(String desc)
      Updates the description of this message template.
      Parameters:
      desc - the new template description
      Throws:
      NullPointerException - if desc is null
      See Also:
    • setBody

      public void setBody(String body)
      Updates the body of this message template.
      Parameters:
      body - the new template body
      See Also:
    • setSubject

      public void setSubject(String subj)
      Updates the e-mail message subject.
      Parameters:
      subj - the subject
      Throws:
      NullPointerException - if subj is null
      See Also:
    • setIsHTML

      public void setIsHTML(boolean html)
      Sets whether this message should be sent as HTML or plain text.
      Parameters:
      html - TRUE if the message is HTML, otherwise FALSE
      See Also:
    • setNoReply

      public void setNoReply(boolean noReply)
      Sets whether replies to this message should be disabled.
      Parameters:
      noReply - TRUE if replies are disabled, otherwise FALSE
      See Also:
    • setActionTypes

      public void setActionTypes(Collection<NotifyActionType> types)
      Updates the action types appended to the push notification.
      Parameters:
      types - a Collection of NotifyActionType enumerations
    • setNotificationTTL

      public void setNotificationTTL(int ttl)
      Updates the TTL of the push notification.
      Parameters:
      ttl - the ttl in seconds
    • setNotifyContext

      public void setNotifyContext(String id)
      Updates the ID of the push notification context object.
      Parameters:
      id - the ID
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(MessageTemplate mt2)
      Specified by:
      compareTo in interface Comparable<MessageTemplate>
    • cacheKey

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Returns:
      the cache key for the object
    • getAuditID

      public String getAuditID()
      Description copied from interface: Auditable
      Returns the object ID for this auditable object.
      Specified by:
      getAuditID in interface Auditable
      Returns:
      the ID
    • getRowClassName

      public String getRowClassName()
      Description copied from interface: ViewEntry
      Returns the CSS class for this object if rendered in a view table.
      Specified by:
      getRowClassName in interface ViewEntry
      Returns:
      the CSS class name, or NULL if none