java.lang.Object
fr.utc.miage.sporttrack.entity.event.Badge

@Entity public class Badge extends Object
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 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

      public String getLabel()
      Returns the display label of this badge.
      Returns:
      the badge label
    • getDescription

      public String getDescription()
      Returns the description of this badge's earning criteria.
      Returns:
      the badge description
    • getSport

      public Sport getSport()
      Returns the sport associated with this badge.
      Returns:
      the associated Sport
    • getMetric

      public Metric 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

      public String getIcon()
      Returns the CSS icon class name for this badge.
      Returns:
      the icon class string
    • getEarnedBy

      public List<Athlete> 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

      public void setLabel(String label)
      Sets the display label of this badge.
      Parameters:
      label - the label to assign
    • setDescription

      public void setDescription(String description)
      Sets the description of this badge.
      Parameters:
      description - the description to assign
    • setSport

      public void setSport(Sport sport)
      Sets the sport associated with this badge.
      Parameters:
      sport - the Sport to associate
    • setMetric

      public void setMetric(Metric metric)
      Sets the performance metric used for this badge.
      Parameters:
      metric - the Metric to assign
    • setThreshold

      public void setThreshold(double threshold)
      Sets the numeric threshold required to earn this badge.
      Parameters:
      threshold - the threshold value to assign
    • setIcon

      public void setIcon(String icon)
      Sets the CSS icon class name for this badge.
      Parameters:
      icon - the icon class string to assign
    • setEarnedBy

      public void setEarnedBy(List<Athlete> earnedBy)
      Sets the list of athletes who have earned this badge.
      Parameters:
      earnedBy - the list of Athletes to assign