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 TypeMethodDescriptionintDeletes the team givenstatic TeamDaoListImplements singleton patternintInserts 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 nameintUpdates the team given
-
Method Details
-
getInstance
Implements singleton pattern- Returns:
- current instance
-
selectAll
Description copied from interface:TeamDaoInterfaceSelects all teams from data source- Specified by:
selectAllin interfaceTeamDaoInterface- Returns:
- list of all teams or empty list if none if found or null in case of error
-
selectWhereId
Description copied from interface:TeamDaoInterfaceSelects a team given id- Specified by:
selectWhereIdin 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:TeamDaoInterfaceSelects a team given name- Specified by:
selectWhereNamein 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:TeamDaoInterfaceSelects teams given name of coach- Specified by:
selectWhereCoachin 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:TeamDaoInterfaceSelects all teams that belongs to a category- Specified by:
selectWhereCategoryin 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:TeamDaoInterfaceInserts a new team- Specified by:
insertin 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:TeamDaoInterfaceUpdates the team given- Specified by:
updatein 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:TeamDaoInterfaceDeletes the team given- Specified by:
deletein 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
-