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

@Entity public class Notification extends Object
JPA entity representing an in-app notification delivered to an athlete within the SportTrack application.

Notifications are generated by various system events (e.g., message received, friendship request, badge earned) and are addressed to a specific recipient. An optional actor identifies the user who triggered the event. Each notification includes a title, content, an optional target URL for navigation, and a read/seen flag.

Author:
SportTrack Team
  • Constructor Details

    • Notification

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

    • getId

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

      public Athlete getRecipient()
      Returns the athlete to whom this notification is addressed.
      Returns:
      the recipient Athlete
    • getActor

      public Athlete getActor()
      Returns the athlete who triggered this notification.
      Returns:
      the actor Athlete, or null if system-generated
    • getType

      public NotificationType getType()
      Returns the type of this notification.
      Returns:
      the NotificationType
    • getTitle

      public String getTitle()
      Returns the title of this notification.
      Returns:
      the notification title
    • getContent

      public String getContent()
      Returns the content of this notification.
      Returns:
      the notification body text
    • getTargetUrl

      public String getTargetUrl()
      Returns the target URL associated with this notification.
      Returns:
      the target URL, or null if none is defined
    • isSeen

      public boolean isSeen()
      Returns whether this notification has been viewed by the recipient.
      Returns:
      true if seen, false otherwise
    • getCreatedAt

      public LocalDateTime getCreatedAt()
      Returns the creation timestamp of this notification.
      Returns:
      the creation timestamp
    • setId

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

      public void setRecipient(Athlete recipient)
      Sets the athlete to whom this notification is addressed.
      Parameters:
      recipient - the recipient Athlete to assign
    • setActor

      public void setActor(Athlete actor)
      Sets the athlete who triggered this notification.
      Parameters:
      actor - the actor Athlete to assign
    • setType

      public void setType(NotificationType type)
      Sets the type of this notification.
      Parameters:
      type - the NotificationType to assign
    • setTitle

      public void setTitle(String title)
      Sets the title of this notification.
      Parameters:
      title - the title to assign
    • setContent

      public void setContent(String content)
      Sets the content of this notification.
      Parameters:
      content - the body text to assign
    • setTargetUrl

      public void setTargetUrl(String targetUrl)
      Sets the target URL associated with this notification.
      Parameters:
      targetUrl - the target URL to assign
    • setSeen

      public void setSeen(boolean seen)
      Sets whether this notification has been viewed by the recipient.
      Parameters:
      seen - true to mark as seen, false otherwise
    • setCreatedAt

      public void setCreatedAt(LocalDateTime createdAt)
      Sets the creation timestamp of this notification.
      Parameters:
      createdAt - the creation timestamp to assign
    • onCreate

      public void onCreate()
      Lifecycle callback that sets the creation timestamp to the current time if not already provided, before the entity is first persisted.