Interface CarDao
public interface CarDao
Interface for loading and saving car data in database.
- Author:
- andresbustamante
-
Method Summary
Modifier and TypeMethodDescriptionint
deactivateCar
(net.andresbustamante.yafoot.core.model.Car car) Deactivates a given car.int
deactivateCarsByPlayer
(net.andresbustamante.yafoot.core.model.Player player) Deactivates all the cars registered by a player.net.andresbustamante.yafoot.core.model.Car
findCarById
(Integer id) Loads a car details from database.List<net.andresbustamante.yafoot.core.model.Car>
findCarsByMatch
(net.andresbustamante.yafoot.core.model.Match match) Returs the list of cars registered by players for a given match.List<net.andresbustamante.yafoot.core.model.Car>
findCarsByPlayer
(net.andresbustamante.yafoot.core.model.Player player) Loads the list of cars that a player has registered in database.boolean
isCarUsedForComingMatches
(net.andresbustamante.yafoot.core.model.Car car) Finds whether a car is being used for a coming match.int
saveCar
(net.andresbustamante.yafoot.core.model.Car car) Creates the car used in parameter into the database.int
updateCar
(net.andresbustamante.yafoot.core.model.Car car) Updates a given car.
-
Method Details
-
findCarById
Loads a car details from database.- Parameters:
id
- Car's unique identifier- Returns:
- Car found for the given ID. Null if no car found
-
saveCar
int saveCar(@Param("car") net.andresbustamante.yafoot.core.model.Car car) Creates the car used in parameter into the database.- Parameters:
car
- Car to save- Returns:
- Number of created cars. It should be 0 or 1
-
updateCar
int updateCar(@Param("car") net.andresbustamante.yafoot.core.model.Car car) Updates a given car.- Parameters:
car
- Car to update- Returns:
- Number of updated cars. It should be 0 or 1
-
deactivateCar
int deactivateCar(@Param("car") net.andresbustamante.yafoot.core.model.Car car) Deactivates a given car.- Parameters:
car
- Car to deactivate- Returns:
- Number of deactivated cars. It should be 0 or 1
-
deactivateCarsByPlayer
int deactivateCarsByPlayer(@Param("player") net.andresbustamante.yafoot.core.model.Player player) Deactivates all the cars registered by a player.- Parameters:
player
- Player to search- Returns:
- Number of deleted cars
-
findCarsByPlayer
List<net.andresbustamante.yafoot.core.model.Car> findCarsByPlayer(@Param("player") net.andresbustamante.yafoot.core.model.Player player) Loads the list of cars that a player has registered in database.- Parameters:
player
- The player to use for the research- Returns:
- List of cars found
-
findCarsByMatch
List<net.andresbustamante.yafoot.core.model.Car> findCarsByMatch(@Param("match") net.andresbustamante.yafoot.core.model.Match match) Returs the list of cars registered by players for a given match.- Parameters:
match
- Match to search- Returns:
- List of cars found for the match
-
isCarUsedForComingMatches
boolean isCarUsedForComingMatches(@Param("car") net.andresbustamante.yafoot.core.model.Car car) Finds whether a car is being used for a coming match.- Parameters:
car
- Car to search- Returns:
- True if the given car is still used for a coming match
-