Class TeamDAO

java.lang.Object
edu.ntnu.idatt1002.k1g4.dao.TeamDAO

public class TeamDAO extends Object
The Database Access Object for the class Team.
Version:
0.1
Author:
Callum Gran
  • Constructor Details

    • TeamDAO

      public TeamDAO()
  • Method Details

    • getTeams

      public List<Team> getTeams()
      Gets all teams.
      Returns:
      teams List: All teams that exist.
    • getTeamsByDivision

      public HashMap<Integer,Team> getTeamsByDivision(int divisionId)
      Gets teams in a division.
      Parameters:
      divisionId - int: the division id
      Returns:
      teams HashMap: The teams in the division.
    • getTeamByName

      public Team getTeamByName(String name)
      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

      public Team getTeamById(int teamId, int divisionId)
      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

      public void updateCompeting(Team team, int divisionId)
      Method to update if a team is competing.
      Parameters:
      divisionId - int: the division id.
      team - Team: the team to update.
    • addTeam

      public void addTeam(Team team, int divisionId) throws IllegalArgumentException
      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 id
      divisionId - 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 delete
      divisionId - int: the division id