Interface CarDao


public interface CarDao
Interface for loading and saving car data in database.
Author:
andresbustamante
  • Method Details

    • findCarById

      Car findCarById(@Param("id") Integer id)
      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") 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") 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") 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") Player player)
      Deactivates all the cars registered by a player.
      Parameters:
      player - Player to search
      Returns:
      Number of deleted cars
    • findCarsByPlayer

      List<Car> findCarsByPlayer(@Param("player") 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<Car> findCarsByMatch(@Param("match") 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") 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