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 TypeMethodDescriptionvoidcancelMatch(Match match, UserContext userContext) Cancels a match by a logical suppression in database.voidregisterPlayer(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.voidunregisterPlayer(Player player, Match match, UserContext ctx) Unregister a player from a match.voidunregisterPlayerFromAllMatches(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:MatchManagementServiceCreate a new match in database.- Specified by:
saveMatchin interfaceMatchManagementService- Parameters:
match- Match to create- Returns:
- New match ID
- Throws:
DatabaseExceptionApplicationException- 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:MatchManagementServiceRegister a player to an existing match. If the player is already registered, the existing registration is updated by the new one.- Specified by:
registerPlayerin 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:MatchManagementServiceUnregister a player from a match.- Specified by:
unregisterPlayerin interfaceMatchManagementService- Parameters:
player- Player to unregistermatch- Match to search- Throws:
DatabaseExceptionApplicationException- Invalid arguments
-
unregisterPlayerFromAllMatches
Description copied from interface:MatchManagementServiceUnregister a player from all matches.- Specified by:
unregisterPlayerFromAllMatchesin interfaceMatchManagementService- Parameters:
player- Player to searchuserContext- User context
-
cancelMatch
@Transactional public void cancelMatch(Match match, UserContext userContext) throws ApplicationException Description copied from interface:MatchManagementServiceCancels a match by a logical suppression in database. All registrations are kept for consultation.- Specified by:
cancelMatchin 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
-