Class Message
- 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Message.Type
Severity for a message
-
Constructor Summary
Constructors Constructor Description Message()
Default constructor needed for JAXBMessage(Message.Type type, String message)
Simple constructor for a message.Message(Message.Type type, String fieldName, String message)
Constructor for a message for a specific REST model field.Message(Message.Type type, String message, String image, long timestamp)
Constructor for a Message with an image and a timestamp.Message(Message.Type type, String fieldName, String message, String image, long timestamp)
Constructor with all parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFieldName()
The name of the REST model field this message is about.Integer
getId()
Get the message idString
getImage()
String
getMessage()
User
getSender()
Get the sender of the messagelong
getTimestamp()
Message.Type
getType()
boolean
isExpired(int instantTimeMinutes)
Helper function to determine if a message is an instant message.void
setFieldName(String fieldName)
Set the name of the REST model field this message is about.void
setId(Integer id)
Set the message idvoid
setImage(String image)
void
setInstantMessage(boolean instantMessage)
Sets the value of the isInstantMessage variable.void
setMessage(String message)
void
setSender(User sender)
Set the sender of the messagevoid
setTimestamp(long timestamp)
void
setType(Message.Type type)
String
toString()
-
-
-
Constructor Detail
-
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
- TheMessage.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. Theimage
will benull
and thetimestamp
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 messagemessage
- Text of the messageimage
- 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 messagemessage
- Text of the message
-
-
Method Detail
-
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
-
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
-
-