Interface CarpoolingService
- All Known Implementing Classes:
CarpoolingServiceImpl
public interface CarpoolingService
Carpooling services.
-
Method Summary
Modifier and TypeMethodDescriptionfindAvailableCarsByMatch
(Match match) Finds the list of cars available to carpool for a given match.void
processCarSeatRequest
(Match match, Player player, Car car, UserContext ctx) If the carpooling feature is enabled for the input match, it sends an email message asking for a place to the driver of the input car for this match.void
processTransportationChange
(Match match, Car oldCar, Car newCar, UserContext ctx) If a player changes of transportation it updates the carpooling options for passengers previously confirmed.void
updateCarpoolingInformation
(Match match, Player player, Car car, boolean isCarConfirmed, UserContext ctx) Update the car used for a registration.
-
Method Details
-
findAvailableCarsByMatch
Finds the list of cars available to carpool for a given match.- Parameters:
match
- Match to search- Returns:
- The list of cars registered for the match
- Throws:
DatabaseException
-
updateCarpoolingInformation
void updateCarpoolingInformation(Match match, Player player, Car car, boolean isCarConfirmed, UserContext ctx) throws DatabaseException, ApplicationException Update the car used for a registration. If the user performing the action is the owner of the car, the car is confirmed for this match. Elsewhere, an exception is thrown.- Parameters:
match
- Match to updateplayer
- Player to updatecar
- Car to use for the registrationisCarConfirmed
- Indicates whether the user wants to accept and confirm a seat for carpoolctx
- Context of the user performing this action- Throws:
DatabaseException
ApplicationException
- If the context does not belong to the owner of the car
-
processCarSeatRequest
void processCarSeatRequest(Match match, Player player, Car car, UserContext ctx) throws DatabaseException, ApplicationException If the carpooling feature is enabled for the input match, it sends an email message asking for a place to the driver of the input car for this match.- Parameters:
match
- The match selected by the playerplayer
- Player asking for a seatcar
- Car selected by the playerctx
- Context of the user performing this action- Throws:
DatabaseException
ApplicationException
-
processTransportationChange
void processTransportationChange(Match match, Car oldCar, Car newCar, UserContext ctx) throws ApplicationException If a player changes of transportation it updates the carpooling options for passengers previously confirmed. If a new car is chosen to assist to a match and it belongs to the same owner, it transfers the passengers already confirmed for the old car to the new one. If there is not enough seats, an exception is thrown to prevent the user from this problem. If a new car is chosen but it belongs to another player or no new car is chosen, it resets the existing confirmations and removes the car for passengers' registrations.- Parameters:
match
- The match to processoldCar
- Car used for the existing registrationnewCar
- Car used for the transportation update. It can belong to another player.ctx
- Context of the user performing this action- Throws:
ApplicationException
- If a transfer of passengers is not possible from the old car to the new one
-