All Implemented Interfaces:
Serializable
Direct Known Subclasses:
TriathlonBasedRace

@Entity(name="Race") public class Race extends BaseEntity<Long>
The Race's fields are defined as follows:
  • id : the unique identifier of the Race that is automatically generated and is the primary key.
  • raceReference : is a race reference number that has exactly 18 characters and has the format "YYYYMMDDXXXNNN-YYY". In this format, "YYYMMDDXXXNNN" follows the same formation rules as the eventReference with the particularity that the segment referring to the date corresponds to the start date of the Race. "YYY" corresponds to the Race order number which follows the order of the Race's start time. The raceReference is unique, there cannot be two different races with the same raceReference.
  • courses : the courses where the Race is raced.
  • raceType : the type of the Race
  • parentRaces : the list of Race that the Race depends on. For example, a collective Race (those in which the competitors are clubs and/or teams) has results that are calculated from the results of an individual Race and therefore that individual Race is its parent Race.
  • title : the title of the Race. Together with the subtitle it unequivocally identifies the Race. The title of the Race must preferably be the same as the championship it belongs to (e.g., Individual National Championship) or the distance of the Race (e.g., Duathlon Powerman Mafra Sprint and Duathlon Powerman Mafra Standard).
  • subtitle : the subtitle of the Race. Together with the title, it unequivocally identifies the Race. If the genderCategory of the Race is sufficient to unequivocally distinguish the genderCategory, only the genderCategory is used as a subtitle (e.g., "Women").
  • genderCategory the gender category of the Race.
  • date : the date of the Race.
  • time : the time scheduled for the starting gun of the Race.
  • raceStatus : the status of the Race, always displayed in the Race's time zone.
  • gunTime : the time of the starting gun of the Race, always displayed in the Race's time zone.
  • airTemperature : the official air temperature for the Race (in Celsius).
  • resultsFiles : the ResultsFile of the Race.
See Also:
  • Constructor Details

    • Race

      public Race()
      Default constructor for the Race entity.
  • Method Details

    • addCourse

      public void addCourse(Course course)
      Adds a Course to this Race's races collection. Ensures bidirectional consistency by also adding this Race to the Course's races collection.
      Parameters:
      course - the Course to add; ignored if null or already present
    • removeCourse

      public void removeCourse(Course course)
      Removes a Course from this Race's courses collection. Ensures bidirectional consistency by also removing this Race from the Course's races collection.
      Parameters:
      course - the Course to remove; ignored if null or not present
    • addParentRace

      public void addParentRace(Race parentRace)
      Adds a parent Race to this Race.

      This method establishes a parent-child relationship between the current Race and the provided Race. The parent Race must already be persisted in the database before adding it as a parent.

      Parameters:
      parentRace - The Race to be added as a parent. It must be a non-null race.
    • removeParentRace

      public void removeParentRace(Race parentRace)
      Removes a parent Race from this Race.

      This method removes the association between the current Race and the specified parent Race. The provided parent Race must be one of the already existing parentRaces of this Race.

      Parameters:
      parentRace - The Race to be removed from the list parentRaces. It must already be associated as a parent.
    • getRaceReference

      public String getRaceReference()
    • setRaceReference

      public void setRaceReference(String raceReference)
    • getCourses

      public Set<Course> getCourses()
    • setCourses

      public void setCourses(Set<Course> courses)
    • getRaceType

      public RaceType getRaceType()
    • setRaceType

      public void setRaceType(RaceType raceType)
    • getParentRaces

      public Set<Race> getParentRaces()
    • setParentRaces

      public void setParentRaces(Set<Race> parentRaces)
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getSubtitle

      public String getSubtitle()
    • setSubtitle

      public void setSubtitle(String subtitle)
    • getGenderCategory

      public GenderCategory getGenderCategory()
    • setGenderCategory

      public void setGenderCategory(GenderCategory genderCategory)
    • getDate

      public LocalDate getDate()
    • setDate

      public void setDate(LocalDate date)
    • getTime

      public LocalTime getTime()
    • setTime

      public void setTime(LocalTime time)
    • getRaceStatus

      public RaceStatus getRaceStatus()
    • setRaceStatus

      public void setRaceStatus(RaceStatus raceStatus)
    • getGunTime

      public LocalTime getGunTime()
    • setGunTime

      public void setGunTime(LocalTime gunTime)
    • getAirTemperature

      public Double getAirTemperature()
    • setAirTemperature

      public void setAirTemperature(Double airTemperature)
    • getResultsFiles

      public Set<ResultsFile> getResultsFiles()
    • setResultsFiles

      public void setResultsFiles(Set<ResultsFile> resultsFiles)
    • equals

      public boolean equals(Object o)
      Description copied from class: BaseEntity
      Equality is based on the entity's identifier. Two entities are considered equal if they are of the same class and have the same non-null identifier.

      If the ID is null, we treat it as a transient (new) object. Transient objects are only equal if they are the exact same instance.

      Overrides:
      equals in class BaseEntity<Long>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BaseEntity<Long>
    • toString

      public String toString()
      Overrides:
      toString in class Object