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 TypeMethodDescriptionint
Deletes the player givenstatic PlayerDaoList
Implements singleton patternint
Inserts 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 IDint
Updates the player given
-
Method Details
-
getInstance
Implements singleton pattern- Returns:
- current instance
-
selectAll
Description copied from interface:PlayerDaoInterface
Selects all players from data source- Specified by:
selectAll
in interfacePlayerDaoInterface
- Returns:
- list of all players or empty list if none if found or null in case of error
-
selectWhereId
Description copied from interface:PlayerDaoInterface
Selects a player given id- Specified by:
selectWhereId
in 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:PlayerDaoInterface
Selects a player given name- Specified by:
selectWhereName
in 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:PlayerDaoInterface
Selects player given team ID- Specified by:
selectWhereTeamId
in 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:PlayerDaoInterface
Inserts a new player- Specified by:
insert
in 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:PlayerDaoInterface
Updates the player given- Specified by:
update
in 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:PlayerDaoInterface
Deletes the player given- Specified by:
delete
in 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
-