Package fr.utc.miage.sporttrack.dto
Class ActivityFormDTO
java.lang.Object
fr.utc.miage.sporttrack.dto.AbstractIdFormDTO
fr.utc.miage.sporttrack.dto.ActivityFormDTO
Data Transfer Object (DTO) used for activity creation and update form binding
within the SportTrack application.
This DTO replaces direct use of the Activity JPA entity as a
@ModelAttribute to prevent mass assignment vulnerabilities
(SonarQube java:S4684). It carries only the fields that are safe for
user input during activity form submission.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDateA()Returns the date of the activity.Returns the description of the activity.Returns the distance covered during the activity.doubleReturns the total duration of the activity.getId()Returns the unique identifier of the activity.Returns the city or location name where the activity was performed.Returns the repetition count for the activity.Returns the identifier of the associated sport.Returns the start time of the activity.getTitle()Returns the title of the activity.voidSets the date of the activity.voidsetDescription(String description) Sets the description of the activity.voidsetDistance(Double distance) Sets the distance covered during the activity.voidsetDuration(double duration) Sets the total duration of the activity.voidSets the unique identifier of the activity.voidsetLocationCity(String locationCity) Sets the city or location name where the activity was performed.voidsetRepetition(Integer repetition) Sets the repetition count for the activity.voidsetSportId(Integer sportId) Sets the identifier of the associated sport.voidsetStartTime(LocalTime startTime) Sets the start time of the activity.voidSets the title of the activity.
-
Constructor Details
-
ActivityFormDTO
public ActivityFormDTO()
-
-
Method Details
-
getId
Returns the unique identifier of the activity.- Overrides:
getIdin classAbstractIdFormDTO- Returns:
- the activity identifier, or
nullfor a new activity
-
setId
Sets the unique identifier of the activity.- Overrides:
setIdin classAbstractIdFormDTO- Parameters:
id- the activity identifier to assign
-
getDuration
public double getDuration()Returns the total duration of the activity.- Returns:
- the duration in hours
-
setDuration
public void setDuration(double duration) Sets the total duration of the activity.- Parameters:
duration- the duration in hours to assign
-
getTitle
Returns the title of the activity.- Returns:
- the activity title
-
setTitle
Sets the title of the activity.- Parameters:
title- the title to assign
-
getDescription
Returns the description of the activity.- Returns:
- the activity description
-
setDescription
Sets the description of the activity.- Parameters:
description- the description to assign
-
getRepetition
Returns the repetition count for the activity.- Returns:
- the repetition count, or
nullif not applicable
-
setRepetition
Sets the repetition count for the activity.- Parameters:
repetition- the repetition count to assign
-
getDistance
Returns the distance covered during the activity.- Returns:
- the distance in kilometres, or
nullif not applicable
-
setDistance
Sets the distance covered during the activity.- Parameters:
distance- the distance in kilometres to assign
-
getDateA
Returns the date of the activity.- Returns:
- the activity date
-
setDateA
Sets the date of the activity.- Parameters:
dateA- the activity date to assign
-
getStartTime
Returns the start time of the activity.- Returns:
- the start time
-
setStartTime
Sets the start time of the activity.- Parameters:
startTime- the start time to assign
-
getLocationCity
Returns the city or location name where the activity was performed.- Returns:
- the location city name
-
setLocationCity
Sets the city or location name where the activity was performed.- Parameters:
locationCity- the location city name to assign
-
getSportId
Returns the identifier of the associated sport.- Returns:
- the sport identifier
-
setSportId
Sets the identifier of the associated sport.- Parameters:
sportId- the sport identifier to assign
-