java.lang.Object
fr.utc.miage.sporttrack.entity.user.communication.Message

@Entity public class Message extends Object
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
    Constructor
    Description
    No-argument constructor required by JPA.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the textual content of this message.
    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.
    boolean
    Returns whether this message has been seen by the recipient.
    void
    Lifecycle callback that sets the send timestamp to the current time if it has not already been provided, before the entity is first persisted.
    void
    setContent(String content)
    Sets the textual content of this message.
    void
    Sets the unique identifier of this message.
    void
    setInitiator(Athlete initiator)
    Sets the athlete who sent this message.
    void
    setRecipient(Athlete recipient)
    Sets the athlete who received this message.
    void
    setSeen(boolean seen)
    Sets whether this message has been seen by the recipient.
    void
    Sets the timestamp at which this message was sent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Message

      public Message()
      No-argument constructor required by JPA.
  • Method Details

    • getId

      public Integer getId()
      Returns the unique identifier of this message.
      Returns:
      the message's database identifier
    • getInitiator

      public Athlete getInitiator()
      Returns the athlete who sent this message.
      Returns:
      the sender Athlete
    • getRecipient

      public Athlete getRecipient()
      Returns the athlete who received this message.
      Returns:
      the recipient Athlete
    • getContent

      public String getContent()
      Returns the textual content of this message.
      Returns:
      the message content
    • getSentAt

      public LocalDateTime 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:
      true if the message has been viewed, false otherwise
    • setId

      public void setId(Integer id)
      Sets the unique identifier of this message.
      Parameters:
      id - the database identifier to assign
    • setInitiator

      public void setInitiator(Athlete initiator)
      Sets the athlete who sent this message.
      Parameters:
      initiator - the sender Athlete to assign
    • setRecipient

      public void setRecipient(Athlete recipient)
      Sets the athlete who received this message.
      Parameters:
      recipient - the recipient Athlete to assign
    • setContent

      public void setContent(String content)
      Sets the textual content of this message.
      Parameters:
      content - the message text to assign
    • setSentAt

      public void setSentAt(LocalDateTime sentAt)
      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 - true to mark as seen, false otherwise
    • 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.