Class MatchDAO

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

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

    • MatchDAO

      public MatchDAO()
  • Method Details

    • getMatchesByDivision

      public ArrayList<Match> getMatchesByDivision(int divisionId)
      Gets matches in a division.
      Parameters:
      divisionId - int: the id of the division to get matches from
      Returns:
      matches ArrayList: The matches in a division with all data.
    • getMatchesByCup

      public ArrayList<Match> getMatchesByCup(int cupId)
      Gets matches in a cup.
      Parameters:
      cupId - int: the id of the cup to get matches from
      Returns:
      matches ArrayList: The matches in a cup with all data.
    • getMatchById

      public Match getMatchById(int matchId)
      Gets match by id.
      Parameters:
      matchId - int: the id of the match
      Returns:
      match Match: the match with a given id
    • updateMatchScore

      public void updateMatchScore(int score, int teamNr, int matchId)
      Method update match score.
      Parameters:
      score - the score
      teamNr - the team nr
      matchId - the match id
    • updateMatch

      public void updateMatch(Match match)
      Method to update match data.
      Parameters:
      match - Match: the new match data to overwrite the previous data.
    • addMatch

      public void addMatch(Match match)
      Method to add a match to the database.
      Parameters:
      match - Match: the match to add to the database.
    • deleteMatch

      public void deleteMatch(int matchId)
      Method to delete a match from the database.
      Parameters:
      matchId - int: the id of the match to delete.