java.lang.Object
com.gentics.contentnode.rest.model.response.Message
All Implemented Interfaces:
Serializable

public class Message extends Object implements Serializable
Represents a message that can be displayed in the MessageLine.
Author:
floriangutmann
See Also:
  • Constructor Details

    • Message

      public Message()
      Default constructor needed for JAXB
    • Message

      public Message(Message.Type type, String fieldName, String message, String image, long timestamp)
      Constructor with all parameters.
      Parameters:
      type - The Message.Type of the message.
      fieldName - The name of the REST model field this message is about.
      message - The text of the message.
      image - The URL of the image that should be displayed aside the message.
      timestamp - The timestamp of the message.
    • Message

      public Message(Message.Type type, String fieldName, String message)
      Constructor for a message for a specific REST model field. The image will be null and the timestamp will be set to the current time.
      Parameters:
      type - The type of the message.
      fieldName - The name of the REST model field this message is about.
      message - The text of the message.
    • Message

      public Message(Message.Type type, String message, String image, long timestamp)
      Constructor for a Message with an image and a timestamp.
      Parameters:
      type - Type of the message
      message - Text of the message
      image - URL of the image that should be displayed aside the message
    • Message

      public Message(Message.Type type, String message)
      Simple constructor for a message. The timestamp of the message will be set to the actual time. Image of the message will be null.
      Parameters:
      type - Type of the message
      message - Text of the message
  • Method Details

    • getFieldName

      public String getFieldName()
      The name of the REST model field this message is about.
      Returns:
      The name of the REST model field this message is about, or null if this message is not about a specific REST model field.
    • setFieldName

      public void setFieldName(String fieldName)
      Set the name of the REST model field this message is about.
      Parameters:
      fieldName - Set the name of the REST model field this message is about (can be null).
    • getMessage

      public String getMessage()
    • setMessage

      public void setMessage(String message)
    • getType

      public Message.Type getType()
    • setType

      public void setType(Message.Type type)
    • getTimestamp

      public long getTimestamp()
    • setTimestamp

      public void setTimestamp(long timestamp)
    • getImage

      public String getImage()
    • setImage

      public void setImage(String image)
    • getSender

      public User getSender()
      Get the sender of the message
      Returns:
      message sender
    • setSender

      public void setSender(User sender)
      Set the sender of the message
      Parameters:
      sender - message sender
    • setId

      public void setId(Integer id)
      Set the message id
      Parameters:
      id - id of the message
    • getId

      public Integer getId()
      Get the message id
      Returns:
      id of the message
    • toString

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

      public boolean isExpired(int instantTimeMinutes)
      Helper function to determine if a message is an instant message. If the messages is expired, it is not considered as an instant message
      Returns:
      returns true if the message is expired, false otherwise
    • setInstantMessage

      public void setInstantMessage(boolean instantMessage)
      Sets the value of the isInstantMessage variable.
      Parameters:
      instantMessage - a boolean value that represents if the message is instant