Class Badge
java.lang.Object
fr.utc.miage.sporttrack.entity.event.Badge
JPA entity representing an achievement badge within the SportTrack application.
A badge defines a performance milestone tied to an optional sport and measurement metric (e.g., "Run 100 km in total"). When an athlete meets or exceeds the defined threshold value, the badge is awarded and linked to that athlete via a many-to-many relationship. If no sport is specified, the badge is universal and applies to activities of any sport.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the description of this badge's earning criteria.Returns the list of athletes who have earned this badge.getIcon()Returns the CSS icon class name for this badge.intgetId()Returns the unique identifier of this badge.getLabel()Returns the display label of this badge.Returns the performance metric used for this badge.getSport()Returns the sport associated with this badge.doubleReturns the numeric threshold required to earn this badge.voidsetDescription(String description) Sets the description of this badge.voidsetEarnedBy(List<Athlete> earnedBy) Sets the list of athletes who have earned this badge.voidSets the CSS icon class name for this badge.voidsetId(int id) Sets the unique identifier of this badge.voidSets the display label of this badge.voidSets the performance metric used for this badge.voidSets the sport associated with this badge.voidsetThreshold(double threshold) Sets the numeric threshold required to earn this badge.
-
Constructor Details
-
Badge
public Badge()No-argument constructor required by JPA.
-
-
Method Details
-
getId
public int getId()Returns the unique identifier of this badge.- Returns:
- the badge's database identifier
-
getLabel
Returns the display label of this badge.- Returns:
- the badge label
-
getDescription
Returns the description of this badge's earning criteria.- Returns:
- the badge description
-
getSport
Returns the sport associated with this badge.- Returns:
- the associated
Sport
-
getMetric
Returns the performance metric used for this badge.- Returns:
- the
Metric
-
getThreshold
public double getThreshold()Returns the numeric threshold required to earn this badge.- Returns:
- the threshold value
-
getIcon
Returns the CSS icon class name for this badge.- Returns:
- the icon class string
-
getEarnedBy
Returns the list of athletes who have earned this badge.- Returns:
- the list of
Athletes
-
setId
public void setId(int id) Sets the unique identifier of this badge.- Parameters:
id- the database identifier to assign
-
setLabel
Sets the display label of this badge.- Parameters:
label- the label to assign
-
setDescription
Sets the description of this badge.- Parameters:
description- the description to assign
-
setSport
Sets the sport associated with this badge.- Parameters:
sport- theSportto associate
-
setMetric
Sets the performance metric used for this badge.- Parameters:
metric- theMetricto assign
-
setThreshold
public void setThreshold(double threshold) Sets the numeric threshold required to earn this badge.- Parameters:
threshold- the threshold value to assign
-
setIcon
Sets the CSS icon class name for this badge.- Parameters:
icon- the icon class string to assign
-
setEarnedBy
Sets the list of athletes who have earned this badge.- Parameters:
earnedBy- the list ofAthletes to assign
-