Class Message
java.lang.Object
fr.utc.miage.sporttrack.entity.user.communication.Message
JPA entity representing a private message exchanged between two athletes
within the SportTrack application.
Each message has an initiator (sender) and a recipient. The message tracks whether it has been seen by the recipient. The send timestamp is automatically set upon first persistence if not already provided.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the textual content of this message.getId()Returns the unique identifier of this message.Returns the athlete who sent this message.Returns the athlete who received this message.Returns the timestamp at which this message was sent.booleanisSeen()Returns whether this message has been seen by the recipient.voidonCreate()Lifecycle callback that sets the send timestamp to the current time if it has not already been provided, before the entity is first persisted.voidsetContent(String content) Sets the textual content of this message.voidSets the unique identifier of this message.voidsetInitiator(Athlete initiator) Sets the athlete who sent this message.voidsetRecipient(Athlete recipient) Sets the athlete who received this message.voidsetSeen(boolean seen) Sets whether this message has been seen by the recipient.voidsetSentAt(LocalDateTime sentAt) Sets the timestamp at which this message was sent.
-
Constructor Details
-
Message
public Message()No-argument constructor required by JPA.
-
-
Method Details
-
getId
Returns the unique identifier of this message.- Returns:
- the message's database identifier
-
getInitiator
Returns the athlete who sent this message.- Returns:
- the sender
Athlete
-
getRecipient
Returns the athlete who received this message.- Returns:
- the recipient
Athlete
-
getContent
Returns the textual content of this message.- Returns:
- the message content
-
getSentAt
Returns the timestamp at which this message was sent.- Returns:
- the send timestamp
-
isSeen
public boolean isSeen()Returns whether this message has been seen by the recipient.- Returns:
trueif the message has been viewed,falseotherwise
-
setId
Sets the unique identifier of this message.- Parameters:
id- the database identifier to assign
-
setInitiator
Sets the athlete who sent this message.- Parameters:
initiator- the senderAthleteto assign
-
setRecipient
Sets the athlete who received this message.- Parameters:
recipient- the recipientAthleteto assign
-
setContent
Sets the textual content of this message.- Parameters:
content- the message text to assign
-
setSentAt
Sets the timestamp at which this message was sent.- Parameters:
sentAt- the send timestamp to assign
-
setSeen
public void setSeen(boolean seen) Sets whether this message has been seen by the recipient.- Parameters:
seen-trueto mark as seen,falseotherwise
-
onCreate
public void onCreate()Lifecycle callback that sets the send timestamp to the current time if it has not already been provided, before the entity is first persisted.
-