Class PlayerDaoList
java.lang.Object
cat.proven.teamplayer.model.persist.PlayerDaoList
- All Implemented Interfaces:
PlayerDaoInterface
FriendDaoList.java
DAO class for Player persistence in a list. Implements singleton pattern.
- Author:
- Jordi and David
-
Method Summary
Modifier and TypeMethodDescriptionintDeletes the player givenstatic PlayerDaoListImplements singleton patternintInserts a new playerSelects all players from data sourceselectWhereId(long id)Selects a player given idselectWhereName(String name)Selects a player given nameselectWhereTeamId(long teamId)Selects player given team IDintUpdates the player given
-
Method Details
-
getInstance
Implements singleton pattern- Returns:
- current instance
-
selectAll
Description copied from interface:PlayerDaoInterfaceSelects all players from data source- Specified by:
selectAllin interfacePlayerDaoInterface- Returns:
- list of all players or empty list if none if found or null in case of error
-
selectWhereId
Description copied from interface:PlayerDaoInterfaceSelects a player given id- Specified by:
selectWhereIdin interfacePlayerDaoInterface- 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
Description copied from interface:PlayerDaoInterfaceSelects a player given name- Specified by:
selectWhereNamein interfacePlayerDaoInterface- 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
Description copied from interface:PlayerDaoInterfaceSelects player given team ID- Specified by:
selectWhereTeamIdin interfacePlayerDaoInterface- 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
Description copied from interface:PlayerDaoInterfaceInserts a new player- Specified by:
insertin interfacePlayerDaoInterface- 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 throwAlreadyExistsPlayer- in case of the new player introduced already exists a exeception will be throw
-
update
Description copied from interface:PlayerDaoInterfaceUpdates the player given- Specified by:
updatein interfacePlayerDaoInterface- 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
Description copied from interface:PlayerDaoInterfaceDeletes the player given- Specified by:
deletein interfacePlayerDaoInterface- 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
-