Class Comment
java.lang.Object
fr.utc.miage.sporttrack.entity.user.communication.Comment
JPA entity representing a comment or interaction left by an athlete on an
activity within the SportTrack application.
Each comment is associated with an author (athlete), a target activity, an interaction type (e.g., like, cheer), and an optional textual content. The creation timestamp is automatically set upon persistence.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the activity to which this comment is attached.Returns the athlete who authored this comment.Returns the textual content of this comment.Returns the creation timestamp of this comment.intgetId()Returns the unique identifier of this comment.Returns the interaction type of this comment.protected voidonCreate()Lifecycle callback that automatically sets the creation timestamp before the entity is first persisted.voidsetActivity(Activity activity) Sets the activity to which this comment is attached.voidSets the athlete who authored this comment.voidsetContent(String content) Sets the textual content of this comment.voidsetCreatedAt(LocalDateTime createdAt) Sets the creation timestamp of this comment.voidsetId(int id) Sets the unique identifier of this comment.voidsetInteractionType(InteractionType interactionType) Sets the interaction type of this comment.
-
Constructor Details
-
Comment
public Comment()No-argument constructor required by JPA.
-
-
Method Details
-
onCreate
protected void onCreate()Lifecycle callback that automatically sets the creation timestamp before the entity is first persisted. -
getId
public int getId()Returns the unique identifier of this comment.- Returns:
- the comment's database identifier
-
setId
public void setId(int id) Sets the unique identifier of this comment.- Parameters:
id- the database identifier to assign
-
getAuthor
Returns the athlete who authored this comment.- Returns:
- the author
Athlete
-
setAuthor
Sets the athlete who authored this comment.- Parameters:
author- the authorAthleteto assign
-
getActivity
Returns the activity to which this comment is attached.- Returns:
- the associated
Activity
-
setActivity
Sets the activity to which this comment is attached.- Parameters:
activity- theActivityto associate
-
getInteractionType
Returns the interaction type of this comment.- Returns:
- the
InteractionType
-
setInteractionType
Sets the interaction type of this comment.- Parameters:
interactionType- theInteractionTypeto assign
-
getContent
Returns the textual content of this comment.- Returns:
- the comment text, or
nullif only an interaction type was used
-
setContent
Sets the textual content of this comment.- Parameters:
content- the comment text to assign
-
getCreatedAt
Returns the creation timestamp of this comment.- Returns:
- the timestamp when the comment was created
-
setCreatedAt
Sets the creation timestamp of this comment.- Parameters:
createdAt- the creation timestamp to assign
-