Interface CarManagementService
public interface CarManagementService
Service for managing cars in the DB.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeactivateCar(Car car, net.andresbustamante.yafoot.commons.model.UserContext ctx) Deactivates a given car.voiddeactivateCarsByPlayer(Player player, net.andresbustamante.yafoot.commons.model.UserContext ctx) Deactivates all the cars registered by a player.Registers a new car in the database.voidUpdates the car with the given ID.
-
Method Details
-
saveCar
Integer saveCar(Car car, net.andresbustamante.yafoot.commons.model.UserContext ctx) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException Registers a new car in the database.- Parameters:
car- New car to registerctx- User context- Returns:
- New car ID
- Throws:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
-
updateCar
void updateCar(Integer carId, Car updatedCar, net.andresbustamante.yafoot.commons.model.UserContext ctx) throws net.andresbustamante.yafoot.commons.exceptions.ApplicationException, net.andresbustamante.yafoot.commons.exceptions.DatabaseException Updates the car with the given ID.- Parameters:
carId- Car ID to searchupdatedCar- Car details to updatectx- User context- Throws:
net.andresbustamante.yafoot.commons.exceptions.ApplicationException- If the current user is not allowed to perform this actionnet.andresbustamante.yafoot.commons.exceptions.DatabaseException
-
deactivateCar
void deactivateCar(Car car, net.andresbustamante.yafoot.commons.model.UserContext ctx) throws net.andresbustamante.yafoot.commons.exceptions.ApplicationException, net.andresbustamante.yafoot.commons.exceptions.DatabaseException Deactivates a given car.- Parameters:
car- Car to deactivatectx- User context- Throws:
net.andresbustamante.yafoot.commons.exceptions.ApplicationException- If the current user is not allowed to perform this action of if the car is being used for a future matchnet.andresbustamante.yafoot.commons.exceptions.DatabaseException
-
deactivateCarsByPlayer
void deactivateCarsByPlayer(Player player, net.andresbustamante.yafoot.commons.model.UserContext ctx) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException Deactivates all the cars registered by a player.- Parameters:
player- Player to look forctx- User context for the responsible of this operation- Throws:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
-