Interface MatchManagementService
public interface MatchManagementService
Matches management service.
- Author:
- andresbustamante
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelMatch
(Match match, net.andresbustamante.yafoot.commons.model.UserContext userContext) Cancels a match by a logical suppression in database.void
registerPlayer
(Player player, Match match, Car car, net.andresbustamante.yafoot.commons.model.UserContext userContext) Register a player to an existing match.Create a new match in database.void
unregisterPlayer
(Player player, Match match, net.andresbustamante.yafoot.commons.model.UserContext userContext) Unregister a player from a match.void
unregisterPlayerFromAllMatches
(Player player, net.andresbustamante.yafoot.commons.model.UserContext userContext) Unregister a player from all matches.
-
Method Details
-
saveMatch
Integer saveMatch(Match match, net.andresbustamante.yafoot.commons.model.UserContext userContext) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException, net.andresbustamante.yafoot.commons.exceptions.ApplicationException Create a new match in database.- Parameters:
match
- Match to createuserContext
-- Returns:
- New match ID
- Throws:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
net.andresbustamante.yafoot.commons.exceptions.ApplicationException
- Invalid arguments
-
registerPlayer
void registerPlayer(Player player, Match match, Car car, net.andresbustamante.yafoot.commons.model.UserContext userContext) throws net.andresbustamante.yafoot.commons.exceptions.ApplicationException, net.andresbustamante.yafoot.commons.exceptions.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:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
net.andresbustamante.yafoot.commons.exceptions.ApplicationException
- Invalid arguments
-
unregisterPlayer
void unregisterPlayer(Player player, Match match, net.andresbustamante.yafoot.commons.model.UserContext userContext) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException, net.andresbustamante.yafoot.commons.exceptions.ApplicationException Unregister a player from a match.- Parameters:
player
- Player to unregistermatch
- Match to searchuserContext
-- Throws:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
net.andresbustamante.yafoot.commons.exceptions.ApplicationException
- Invalid arguments
-
unregisterPlayerFromAllMatches
void unregisterPlayerFromAllMatches(Player player, net.andresbustamante.yafoot.commons.model.UserContext userContext) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException Unregister a player from all matches.- Parameters:
player
- Player to searchuserContext
- User context- Throws:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
-
cancelMatch
void cancelMatch(Match match, net.andresbustamante.yafoot.commons.model.UserContext userContext) throws net.andresbustamante.yafoot.commons.exceptions.DatabaseException, net.andresbustamante.yafoot.commons.exceptions.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:
net.andresbustamante.yafoot.commons.exceptions.DatabaseException
- Unexpected exception when updating the match in databasenet.andresbustamante.yafoot.commons.exceptions.ApplicationException
- When the match is already in the past or the user is not allowed to cancel the match
-