Class PlayerDaoList

java.lang.Object
cat.proven.teamplayer.model.persist.PlayerDaoList
All Implemented Interfaces:
PlayerDaoInterface

public class PlayerDaoList extends Object implements PlayerDaoInterface
FriendDaoList.java DAO class for Player persistence in a list. Implements singleton pattern.
Author:
Jordi and David
  • Method Details

    • getInstance

      public static PlayerDaoList getInstance()
      Implements singleton pattern
      Returns:
      current instance
    • selectAll

      public List<Player> selectAll()
      Description copied from interface: PlayerDaoInterface
      Selects all players from data source
      Specified by:
      selectAll in interface PlayerDaoInterface
      Returns:
      list of all players or empty list if none if found or null in case of error
    • selectWhereId

      public Player selectWhereId(long id) throws ParameterNull
      Description copied from interface: PlayerDaoInterface
      Selects a player given id
      Specified by:
      selectWhereId in interface PlayerDaoInterface
      Parameters:
      id - the id from the player
      Returns:
      a player or empty in case not found, null in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw
    • selectWhereName

      public List<Player> selectWhereName(String name) throws ParameterNull
      Description copied from interface: PlayerDaoInterface
      Selects a player given name
      Specified by:
      selectWhereName in interface PlayerDaoInterface
      Parameters:
      name - the name of the player
      Returns:
      a list of players or empty in case not found, null in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw
    • selectWhereTeamId

      public List<Player> selectWhereTeamId(long teamId) throws ParameterNull
      Description copied from interface: PlayerDaoInterface
      Selects player given team ID
      Specified by:
      selectWhereTeamId in interface PlayerDaoInterface
      Parameters:
      teamId - the team id from the player's team
      Returns:
      list of players or empty in case not found, null in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw
    • insert

      public int insert(Player player) throws ParameterNull, AlreadyExistsPlayer
      Description copied from interface: PlayerDaoInterface
      Inserts a new player
      Specified by:
      insert in interface PlayerDaoInterface
      Parameters:
      player - the player to add
      Returns:
      1 if its correctly inserted or -1 in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw
      AlreadyExistsPlayer - in case of the new player introduced already exists a exeception will be throw
    • update

      public int update(Player player) throws ParameterNull
      Description copied from interface: PlayerDaoInterface
      Updates the player given
      Specified by:
      update in interface PlayerDaoInterface
      Parameters:
      player - the player to update their data
      Returns:
      1 if its correctly updated or -1 in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw
    • delete

      public int delete(Player player) throws ParameterNull
      Description copied from interface: PlayerDaoInterface
      Deletes the player given
      Specified by:
      delete in interface PlayerDaoInterface
      Parameters:
      player - the player to delete
      Returns:
      1 if its correctly updated or -1 in case of error
      Throws:
      ParameterNull - in case parameter passed is null a exeception will be throw