Class IndividualResultMapper

java.lang.Object
com.endurancetrio.business.event.mapper.IndividualResultMapper

@Component public class IndividualResultMapper extends Object
  • Constructor Details

  • Method Details

    • map

      public IndividualResultDTO map(RaceDTO race, IndividualResult entity, Integer rank, Duration winnerTotal)
      Maps an IndividualResult entity to an IndividualResultDTO.

      If the entity has a source result (indicating an inherited competition entry), the data is taken from that source - the original result from the feeder race — while the given entity's own rank is preserved for the current race's classification.

      The time gap relative to the overall winner is computed via getGap(com.endurancetrio.data.event.model.entity.IndividualResult, java.time.Duration).

      Parameters:
      race - the race context to attach to the result DTO
      entity - the individual result entity to map; may be null. Its id is always used as the DTO's id, regardless of the source-result chain
      rank - the rank assigned in the current race (may be overridden if the entity already has a rank)
      winnerTotal - the overall winner's total duration, used for gap computation
      Returns:
      the mapped IndividualResultDTO, or null if entity is null