Interface MatchDao
public interface MatchDao
Interface describing the operations allowed with matches on database.
- Author:
- andresbustamante
-
Method Summary
Modifier and TypeMethodDescriptionnet.andresbustamante.yafoot.core.model.Match
findMatchByCode
(String code) Loads a match and its details by using its unique code.net.andresbustamante.yafoot.core.model.Match
findMatchById
(Integer id) Loads a match and its details by using its unique numeric identifier.List<net.andresbustamante.yafoot.core.model.Match>
findMatchesByPlayer
(net.andresbustamante.yafoot.core.model.Player player, net.andresbustamante.yafoot.core.model.enums.SportEnum sport, net.andresbustamante.yafoot.core.model.enums.MatchStatusEnum status, LocalDateTime startDate, LocalDateTime endDate) Find the list of matches associated to a player by optionally using a date interval.List<net.andresbustamante.yafoot.core.model.Registration>
findPassengerRegistrationsByCar
(net.andresbustamante.yafoot.core.model.Match match, net.andresbustamante.yafoot.core.model.Car car) Finds the list of passenger registrations for a given car.boolean
Verifies if the code passed as parameter has already been used for another match.boolean
isPlayerRegistered
(net.andresbustamante.yafoot.core.model.Player player, net.andresbustamante.yafoot.core.model.Match match) Checks if a player is already registered to a match.net.andresbustamante.yafoot.core.model.Registration
loadRegistration
(net.andresbustamante.yafoot.core.model.Match match, net.andresbustamante.yafoot.core.model.Player player) Loads registration details for a player in a specific match.int
registerPlayer
(net.andresbustamante.yafoot.core.model.Player player, net.andresbustamante.yafoot.core.model.Match match, net.andresbustamante.yafoot.core.model.Car car, Boolean isCarConfirmed) Registers a player to an existing match.int
resetCarDetails
(net.andresbustamante.yafoot.core.model.Match match, net.andresbustamante.yafoot.core.model.Player player) Resets car details for a player registration in a given match.void
saveMatch
(net.andresbustamante.yafoot.core.model.Match match) Creates a match on database.void
unregisterPlayer
(net.andresbustamante.yafoot.core.model.Player player, net.andresbustamante.yafoot.core.model.Match match) Unregisters a player from a match.int
unregisterPlayerFromAllMatches
(net.andresbustamante.yafoot.core.model.Player player) Unregisters a player from all the matches where he/her was registered even past matches.int
updateCarForRegistration
(net.andresbustamante.yafoot.core.model.Match match, net.andresbustamante.yafoot.core.model.Player player, net.andresbustamante.yafoot.core.model.Car car, boolean isCarConfirmed) Updates and confirms a car for a player registered into a match.void
updateMatchStatus
(net.andresbustamante.yafoot.core.model.Match match) Update a match with new status details.
-
Method Details
-
isCodeAlreadyRegistered
Verifies if the code passed as parameter has already been used for another match.- Parameters:
code
- Code to check- Returns:
- True or false if the code is already in use or not
-
findMatchByCode
Loads a match and its details by using its unique code.- Parameters:
code
- Code to look for- Returns:
- The match using the code and its details
-
findMatchesByPlayer
List<net.andresbustamante.yafoot.core.model.Match> findMatchesByPlayer(@Param("player") net.andresbustamante.yafoot.core.model.Player player, @Param("sport") net.andresbustamante.yafoot.core.model.enums.SportEnum sport, @Param("status") net.andresbustamante.yafoot.core.model.enums.MatchStatusEnum status, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate) Find the list of matches associated to a player by optionally using a date interval.- Parameters:
player
- Player to use for the researchsport
- Sport to search in the list of matchesstatus
- Match status to searchstartDate
- Start date for the researchendDate
- Limit date for the research- Returns:
- List of matches returned by the research
-
findMatchById
Loads a match and its details by using its unique numeric identifier.- Parameters:
id
- Match technical ID- Returns:
- The match identified by this number and its details
-
saveMatch
void saveMatch(@Param("match") net.andresbustamante.yafoot.core.model.Match match) Creates a match on database.- Parameters:
match
- Match to create
-
registerPlayer
int registerPlayer(@Param("player") net.andresbustamante.yafoot.core.model.Player player, @Param("match") net.andresbustamante.yafoot.core.model.Match match, @Param("car") net.andresbustamante.yafoot.core.model.Car car, @Param("carConfirmation") Boolean isCarConfirmed) Registers a player to an existing match.- Parameters:
player
- Player to registermatch
- Match to updatecar
- Car used to go to the match (optional)isCarConfirmed
- Indicates if there's a confirmation for assisting to a match with the selected car- Returns:
- Number of registered players. It should be 0 or 1
-
isPlayerRegistered
boolean isPlayerRegistered(@Param("player") net.andresbustamante.yafoot.core.model.Player player, @Param("match") net.andresbustamante.yafoot.core.model.Match match) Checks if a player is already registered to a match.- Parameters:
player
- Player to searchmatch
- Match to search- Returns:
- True if the player is already registered
-
unregisterPlayer
void unregisterPlayer(@Param("player") net.andresbustamante.yafoot.core.model.Player player, @Param("match") net.andresbustamante.yafoot.core.model.Match match) Unregisters a player from a match.- Parameters:
player
- Player to unregistermatch
- Match to update
-
unregisterPlayerFromAllMatches
int unregisterPlayerFromAllMatches(@Param("player") net.andresbustamante.yafoot.core.model.Player player) Unregisters a player from all the matches where he/her was registered even past matches.- Parameters:
player
- Player to unregister- Returns:
- Number of updated matches
-
updateCarForRegistration
int updateCarForRegistration(@Param("match") net.andresbustamante.yafoot.core.model.Match match, @Param("player") net.andresbustamante.yafoot.core.model.Player player, @Param("car") net.andresbustamante.yafoot.core.model.Car car, @Param("confirmed") boolean isCarConfirmed) Updates and confirms a car for a player registered into a match.- Parameters:
match
- Match to searchplayer
- Player to searchcar
- Car to setisCarConfirmed
- Is the car confirmed or not- Returns:
- Number of updated cars. It should be 0 or 1
-
loadRegistration
net.andresbustamante.yafoot.core.model.Registration loadRegistration(@Param("match") net.andresbustamante.yafoot.core.model.Match match, @Param("player") net.andresbustamante.yafoot.core.model.Player player) Loads registration details for a player in a specific match.- Parameters:
match
- Match to searchplayer
- Player to search- Returns:
- Registration details
-
findPassengerRegistrationsByCar
List<net.andresbustamante.yafoot.core.model.Registration> findPassengerRegistrationsByCar(@Param("match") net.andresbustamante.yafoot.core.model.Match match, @Param("car") net.andresbustamante.yafoot.core.model.Car car) Finds the list of passenger registrations for a given car.- Parameters:
match
- Match to searchcar
- Car to search- Returns:
- List of registrations made with the given car for a match
-
resetCarDetails
int resetCarDetails(@Param("match") net.andresbustamante.yafoot.core.model.Match match, @Param("player") net.andresbustamante.yafoot.core.model.Player player) Resets car details for a player registration in a given match.- Parameters:
match
- Match to searchplayer
- Player to search- Returns:
- Number of lines touched by this operation
-
updateMatchStatus
void updateMatchStatus(@Param("match") net.andresbustamante.yafoot.core.model.Match match) Update a match with new status details.- Parameters:
match
- Match to update
-