Class TeamDaoList
java.lang.Object
cat.proven.teamplayer.model.persist.TeamDaoList
- All Implemented Interfaces:
TeamDaoInterface
FriendDaoList.java
DAO class for Team persistence in a list. Implements singleton pattern.
- Author:
- Jordi and David
-
Method Summary
Modifier and TypeMethodDescriptionint
Deletes the team givenstatic TeamDaoList
Implements singleton patternint
Inserts a new teamSelects all teams from data sourceselectWhereCategory(String category)
Selects all teams that belongs to a categoryselectWhereCoach(String coach)
Selects teams given name of coachselectWhereId(long id)
Selects a team given idselectWhereName(String name)
Selects a team given nameint
Updates the team given
-
Method Details
-
getInstance
Implements singleton pattern- Returns:
- current instance
-
selectAll
Description copied from interface:TeamDaoInterface
Selects all teams from data source- Specified by:
selectAll
in interfaceTeamDaoInterface
- Returns:
- list of all teams or empty list if none if found or null in case of error
-
selectWhereId
Description copied from interface:TeamDaoInterface
Selects a team given id- Specified by:
selectWhereId
in interfaceTeamDaoInterface
- Parameters:
id
- the id from the team- Returns:
- a team or empty in case not found, null in case of error
-
selectWhereName
Description copied from interface:TeamDaoInterface
Selects a team given name- Specified by:
selectWhereName
in interfaceTeamDaoInterface
- Parameters:
name
- the name of the team- Returns:
- a team or empty in case not found, null in case of error
- Throws:
ParameterNull
- in case parameter passed is null a exeception will be throw
-
selectWhereCoach
Description copied from interface:TeamDaoInterface
Selects teams given name of coach- Specified by:
selectWhereCoach
in interfaceTeamDaoInterface
- Parameters:
coach
- the name of the coach- Returns:
- list of teams or empty in case not found, null in case of error
- Throws:
ParameterNull
- in case parameter passed is null a exeception will be throw
-
selectWhereCategory
Description copied from interface:TeamDaoInterface
Selects all teams that belongs to a category- Specified by:
selectWhereCategory
in interfaceTeamDaoInterface
- Parameters:
category
- the category to seach- Returns:
- list of all teams or empty list if none if found or null in case of error
- Throws:
ParameterNull
- in case parameter passed is null a exeception will be throw
-
insert
Description copied from interface:TeamDaoInterface
Inserts a new team- Specified by:
insert
in interfaceTeamDaoInterface
- Parameters:
team
- the team 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 throwAlreadyExistsTeam
- in case of the new team introduced already exists a exeception will be throw
-
update
Description copied from interface:TeamDaoInterface
Updates the team given- Specified by:
update
in interfaceTeamDaoInterface
- Parameters:
team
- the team 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:TeamDaoInterface
Deletes the team given- Specified by:
delete
in interfaceTeamDaoInterface
- Parameters:
team
- the team 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 throwTeamHavePlayers
- if the team to delete contains player a exeception will be throw
-