Search in sources :

Example 1 with STOP_WAITING_QUEUE_SUBSCRIPTIONS

use of alfio.model.system.ConfigurationKeys.STOP_WAITING_QUEUE_SUBSCRIPTIONS in project alf.io by alfio-event.

the class AdminWaitingQueueApiController method loadStatus.

private Map<String, Boolean> loadStatus(Event event) {
    ZonedDateTime now = ZonedDateTime.now(clockProvider.getClock().withZone(event.getZoneId()));
    List<SaleableTicketCategory> stcList = eventManager.loadTicketCategories(event).stream().filter(tc -> !tc.isAccessRestricted()).map(tc -> new SaleableTicketCategory(tc, now, event, ticketReservationManager.countAvailableTickets(event, tc), tc.getMaxTickets(), null)).collect(Collectors.toList());
    boolean active = EventUtil.checkWaitingQueuePreconditions(event, stcList, configurationManager, eventStatisticsManager.noSeatsAvailable());
    boolean paused = active && configurationManager.getFor(STOP_WAITING_QUEUE_SUBSCRIPTIONS, event.getConfigurationLevel()).getValueAsBooleanOrDefault();
    Map<String, Boolean> result = new HashMap<>();
    result.put("active", active);
    result.put("paused", paused);
    return result;
}
Also used : java.util(java.util) ExportUtils(alfio.util.ExportUtils) ZonedDateTime(java.time.ZonedDateTime) SaleableTicketCategory(alfio.controller.decorator.SaleableTicketCategory) ConfigurationManager(alfio.manager.system.ConfigurationManager) Collections.singletonList(java.util.Collections.singletonList) Pair(org.apache.commons.lang3.tuple.Pair) HttpServletResponse(javax.servlet.http.HttpServletResponse) STOP_WAITING_QUEUE_SUBSCRIPTIONS(alfio.model.system.ConfigurationKeys.STOP_WAITING_QUEUE_SUBSCRIPTIONS) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) HttpStatus(org.springframework.http.HttpStatus) TicketReservationManager(alfio.manager.TicketReservationManager) WaitingQueueSubscription(alfio.model.WaitingQueueSubscription) EventManager(alfio.manager.EventManager) Principal(java.security.Principal) Stream(java.util.stream.Stream) ConfigurationModification(alfio.model.modification.ConfigurationModification) EventStatisticsManager(alfio.manager.EventStatisticsManager) Data(lombok.Data) org.springframework.web.bind.annotation(org.springframework.web.bind.annotation) EventUtil(alfio.util.EventUtil) ResponseEntity(org.springframework.http.ResponseEntity) Event(alfio.model.Event) ClockProvider(alfio.util.ClockProvider) AllArgsConstructor(lombok.AllArgsConstructor) ConfigurationKeys(alfio.model.system.ConfigurationKeys) WaitingQueueManager(alfio.manager.WaitingQueueManager) ZonedDateTime(java.time.ZonedDateTime) SaleableTicketCategory(alfio.controller.decorator.SaleableTicketCategory)

Aggregations

SaleableTicketCategory (alfio.controller.decorator.SaleableTicketCategory)1 EventManager (alfio.manager.EventManager)1 EventStatisticsManager (alfio.manager.EventStatisticsManager)1 TicketReservationManager (alfio.manager.TicketReservationManager)1 WaitingQueueManager (alfio.manager.WaitingQueueManager)1 ConfigurationManager (alfio.manager.system.ConfigurationManager)1 Event (alfio.model.Event)1 WaitingQueueSubscription (alfio.model.WaitingQueueSubscription)1 ConfigurationModification (alfio.model.modification.ConfigurationModification)1 ConfigurationKeys (alfio.model.system.ConfigurationKeys)1 STOP_WAITING_QUEUE_SUBSCRIPTIONS (alfio.model.system.ConfigurationKeys.STOP_WAITING_QUEUE_SUBSCRIPTIONS)1 ClockProvider (alfio.util.ClockProvider)1 EventUtil (alfio.util.EventUtil)1 ExportUtils (alfio.util.ExportUtils)1 IOException (java.io.IOException)1 Principal (java.security.Principal)1 ZonedDateTime (java.time.ZonedDateTime)1 java.util (java.util)1 Collections.singletonList (java.util.Collections.singletonList)1 Collectors (java.util.stream.Collectors)1