java.lang.Object
edu.ntnu.idatt1002.k1g4.dao.TeamDAO
The Database Access Object for the class Team.
- Version:
- 0.1
- Author:
- Callum Gran
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a team.void
deleteTeam
(int teamId, int divisionId) Method to delete a team from the database.getTeamById
(int teamId, int divisionId) Gets the team by id.getTeamByName
(String name) Gets a team by the name of the team.getTeams()
Gets all teams.getTeamsByDivision
(int divisionId) Gets teams in a division.void
linkTeamToDivision
(int teamId, int divisionId) Method to link a team to division.void
updateCompeting
(Team team, int divisionId) Method to update if a team is competing.
-
Constructor Details
-
TeamDAO
public TeamDAO()
-
-
Method Details
-
getTeams
Gets all teams.- Returns:
- teams List: All teams that exist.
-
getTeamsByDivision
Gets teams in a division.- Parameters:
divisionId
- int: the division id- Returns:
- teams HashMap: The teams in the division.
-
getTeamByName
Gets a team by the name of the team.- Parameters:
name
- String: the team name- Returns:
- team Team: the team with the given name
-
getTeamById
Gets the team by id.- Parameters:
teamId
- int: the id of the team.divisionId
- int: the division id.- Returns:
- team Team: the team with the corresponding id.
-
updateCompeting
Method to update if a team is competing.- Parameters:
divisionId
- int: the division id.team
- Team: the team to update.
-
addTeam
Adds a team.- Parameters:
divisionId
- int: division id.team
- Team: the team to be added to the database.- Throws:
IllegalArgumentException
-
linkTeamToDivision
public void linkTeamToDivision(int teamId, int divisionId) Method to link a team to division.- Parameters:
teamId
- int: the team iddivisionId
- int: the division id
-
deleteTeam
public void deleteTeam(int teamId, int divisionId) Method to delete a team from the database.- Parameters:
teamId
- int: the id of the team to deletedivisionId
- int: the division id
-