Class Notification
java.lang.Object
fr.utc.miage.sporttrack.entity.user.communication.Notification
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetActor()Returns the athlete who triggered this notification.Returns the content of this notification.Returns the creation timestamp of this notification.getId()Returns the unique identifier of this notification.Returns the athlete to whom this notification is addressed.Returns the target URL associated with this notification.getTitle()Returns the title of this notification.getType()Returns the type of this notification.booleanisSeen()Returns whether this notification has been viewed by the recipient.voidonCreate()Lifecycle callback that sets the creation timestamp to the current time if not already provided, before the entity is first persisted.voidSets the athlete who triggered this notification.voidsetContent(String content) Sets the content of this notification.voidsetCreatedAt(LocalDateTime createdAt) Sets the creation timestamp of this notification.voidSets the unique identifier of this notification.voidsetRecipient(Athlete recipient) Sets the athlete to whom this notification is addressed.voidsetSeen(boolean seen) Sets whether this notification has been viewed by the recipient.voidsetTargetUrl(String targetUrl) Sets the target URL associated with this notification.voidSets the title of this notification.voidsetType(NotificationType type) Sets the type of this notification.
-
Constructor Details
-
Notification
public Notification()No-argument constructor required by JPA.
-
-
Method Details
-
getId
Returns the unique identifier of this notification.- Returns:
- the notification's database identifier
-
getRecipient
Returns the athlete to whom this notification is addressed.- Returns:
- the recipient
Athlete
-
getActor
Returns the athlete who triggered this notification.- Returns:
- the actor
Athlete, ornullif system-generated
-
getType
Returns the type of this notification.- Returns:
- the
NotificationType
-
getTitle
Returns the title of this notification.- Returns:
- the notification title
-
getContent
Returns the content of this notification.- Returns:
- the notification body text
-
getTargetUrl
Returns the target URL associated with this notification.- Returns:
- the target URL, or
nullif none is defined
-
isSeen
public boolean isSeen()Returns whether this notification has been viewed by the recipient.- Returns:
trueif seen,falseotherwise
-
getCreatedAt
Returns the creation timestamp of this notification.- Returns:
- the creation timestamp
-
setId
Sets the unique identifier of this notification.- Parameters:
id- the database identifier to assign
-
setRecipient
Sets the athlete to whom this notification is addressed.- Parameters:
recipient- the recipientAthleteto assign
-
setActor
Sets the athlete who triggered this notification.- Parameters:
actor- the actorAthleteto assign
-
setType
Sets the type of this notification.- Parameters:
type- theNotificationTypeto assign
-
setTitle
Sets the title of this notification.- Parameters:
title- the title to assign
-
setContent
Sets the content of this notification.- Parameters:
content- the body text to assign
-
setTargetUrl
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-trueto mark as seen,falseotherwise
-
setCreatedAt
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.
-