Interface CarpoolingService

All Known Implementing Classes:
CarpoolingServiceImpl

public interface CarpoolingService
Carpooling services.
  • Method Details

    • findAvailableCarsByMatch

      List<Car> findAvailableCarsByMatch(Match match) throws DatabaseException
      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 update
      player - Player to update
      car - Car to use for the registration
      isCarConfirmed - Indicates whether the user wants to accept and confirm a seat for carpool
      ctx - 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 player
      player - Player asking for a seat
      car - Car selected by the player
      ctx - 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 process
      oldCar - Car used for the existing registration
      newCar - 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