Interface MatchManagementService
- All Known Implementing Classes:
MatchManagementServiceImpl
public interface MatchManagementService
Matches management service.
- Author:
- andresbustamante
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelMatch
(Match match, UserContext userContext) Cancels a match by a logical suppression in database.void
registerPlayer
(Player player, Match match, Car car, UserContext userContext) Register a player to an existing match.saveMatch
(Match match, UserContext userContext) Create a new match in database.void
unregisterPlayer
(Player player, Match match, UserContext userContext) Unregister a player from a match.void
unregisterPlayerFromAllMatches
(Player player, UserContext userContext) Unregister a player from all matches.
-
Method Details
-
saveMatch
Integer saveMatch(Match match, UserContext userContext) throws DatabaseException, ApplicationException Create a new match in database.- Parameters:
match
- Match to createuserContext
-- Returns:
- New match ID
- Throws:
DatabaseException
ApplicationException
- Invalid arguments
-
registerPlayer
void registerPlayer(Player player, Match match, Car car, UserContext userContext) throws ApplicationException, DatabaseException Register a player to an existing match. If the player is already registered, the existing registration is updated by the new one.- Parameters:
player
- Player to registermatch
- Match to updatecar
- Car used by the player to assist to the match. If the player is registering himself but is not the owner of the car, the player is registered but the car seat is not confirmed until the owner confirms ituserContext
-- Throws:
DatabaseException
ApplicationException
- Invalid arguments
-
unregisterPlayer
void unregisterPlayer(Player player, Match match, UserContext userContext) throws DatabaseException, ApplicationException Unregister a player from a match.- Parameters:
player
- Player to unregistermatch
- Match to searchuserContext
-- Throws:
DatabaseException
ApplicationException
- Invalid arguments
-
unregisterPlayerFromAllMatches
void unregisterPlayerFromAllMatches(Player player, UserContext userContext) throws DatabaseException Unregister a player from all matches.- Parameters:
player
- Player to searchuserContext
- User context- Throws:
DatabaseException
-
cancelMatch
void cancelMatch(Match match, UserContext userContext) throws DatabaseException, ApplicationException Cancels a match by a logical suppression in database. All registrations are kept for consultation.- Parameters:
match
- Match to canceluserContext
- Context of the user asking for this action- Throws:
DatabaseException
- Unexpected exception when updating the match in databaseApplicationException
- When the match is already in the past or the user is not allowed to cancel the match
-