Interface TeamDaoInterface

All Known Implementing Classes:
TeamDaoList

public interface TeamDaoInterface
Author:
Jordi and David
  • Method Details

    • selectAll

      List<Team> selectAll()
      Selects all teams from data source
      Returns:
      list of all teams or empty list if none if found or null in case of error
    • selectWhereId

      Team selectWhereId(long id)
      Selects a team given id
      Parameters:
      id - the id from the team
      Returns:
      a team or empty in case not found, null in case of error
    • selectWhereName

      Team selectWhereName(String name) throws ParameterNull
      Selects a team given name
      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

      List<Team> selectWhereCoach(String coach) throws ParameterNull
      Selects teams given name of coach
      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

      List<Team> selectWhereCategory(String category) throws ParameterNull
      Selects all teams that belongs to a category
      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

      int insert(Team team) throws ParameterNull, AlreadyExistsTeam
      Inserts a new team
      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 throw
      AlreadyExistsTeam - in case of the new team introduced already exists a exeception will be throw
    • update

      int update(Team team) throws ParameterNull
      Updates the team given
      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

      int delete(Team team) throws ParameterNull, TeamHavePlayers
      Deletes the team given
      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 throw
      TeamHavePlayers - if the team to delete contains player a exeception will be throw