Interface CarDao
public interface CarDao
Interface for loading and saving car data in database.
- Author:
- andresbustamante
-
Method Summary
Modifier and TypeMethodDescriptionint
deactivateCar
(Car car) Deactivates a given car.int
deactivateCarsByPlayer
(Player player) Deactivates all the cars registered by a player.findCarById
(Integer id) Loads a car details from database.findCarsByMatch
(Match match) Returs the list of cars registered by players for a given match.findCarsByPlayer
(Player player) Loads the list of cars that a player has registered in database.boolean
Finds whether a car is being used for a coming match.int
Creates the car used in parameter into the database.int
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
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
Updates a given car.- Parameters:
car
- Car to update- Returns:
- Number of updated cars. It should be 0 or 1
-
deactivateCar
Deactivates a given car.- Parameters:
car
- Car to deactivate- Returns:
- Number of deactivated cars. It should be 0 or 1
-
deactivateCarsByPlayer
Deactivates all the cars registered by a player.- Parameters:
player
- Player to search- Returns:
- Number of deleted cars
-
findCarsByPlayer
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
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
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
-