Class MatchManagementServiceImpl
java.lang.Object
net.andresbustamante.yafoot.core.services.impl.MatchManagementServiceImpl
- All Implemented Interfaces:
MatchManagementService
- Author:
- andresbustamante
-
Constructor Summary
ConstructorsConstructorDescriptionMatchManagementServiceImpl
(MatchDao matchDAO, SiteDao siteDAO, CarDao carDAO, PlayerDao playerDAO, SiteManagementService siteManagementService, CarManagementService carManagementService, CarpoolingService carpoolingService, org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate) -
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 ctx) Unregister a player from a match.void
unregisterPlayerFromAllMatches
(Player player, UserContext userContext) Unregister a player from all matches.
-
Constructor Details
-
MatchManagementServiceImpl
public MatchManagementServiceImpl(MatchDao matchDAO, SiteDao siteDAO, CarDao carDAO, PlayerDao playerDAO, SiteManagementService siteManagementService, CarManagementService carManagementService, CarpoolingService carpoolingService, org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate)
-
-
Method Details
-
saveMatch
@Transactional public Integer saveMatch(Match match, UserContext userContext) throws DatabaseException, ApplicationException Description copied from interface:MatchManagementService
Create a new match in database.- Specified by:
saveMatch
in interfaceMatchManagementService
- Parameters:
match
- Match to create- Returns:
- New match ID
- Throws:
DatabaseException
ApplicationException
- Invalid arguments
-
registerPlayer
@Transactional(rollbackFor={ApplicationException.class,DatabaseException.class}) public void registerPlayer(Player player, Match match, Car car, UserContext userContext) throws ApplicationException, DatabaseException Description copied from interface:MatchManagementService
Register a player to an existing match. If the player is already registered, the existing registration is updated by the new one.- Specified by:
registerPlayer
in interfaceMatchManagementService
- 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 it- Throws:
ApplicationException
- Invalid argumentsDatabaseException
-
unregisterPlayer
@Transactional public void unregisterPlayer(Player player, Match match, UserContext ctx) throws DatabaseException, ApplicationException Description copied from interface:MatchManagementService
Unregister a player from a match.- Specified by:
unregisterPlayer
in interfaceMatchManagementService
- Parameters:
player
- Player to unregistermatch
- Match to search- Throws:
DatabaseException
ApplicationException
- Invalid arguments
-
unregisterPlayerFromAllMatches
Description copied from interface:MatchManagementService
Unregister a player from all matches.- Specified by:
unregisterPlayerFromAllMatches
in interfaceMatchManagementService
- Parameters:
player
- Player to searchuserContext
- User context
-
cancelMatch
@Transactional public void cancelMatch(Match match, UserContext userContext) throws ApplicationException Description copied from interface:MatchManagementService
Cancels a match by a logical suppression in database. All registrations are kept for consultation.- Specified by:
cancelMatch
in interfaceMatchManagementService
- Parameters:
match
- Match to canceluserContext
- Context of the user asking for this action- Throws:
ApplicationException
- When the match is already in the past or the user is not allowed to cancel the match
-