Search in sources :

Example 1 with ConfigurationManager

use of alfio.manager.system.ConfigurationManager in project alf.io by alfio-event.

the class AdminWaitingQueueApiController method loadStatus.

private Map<String, Boolean> loadStatus(Event event) {
    ZonedDateTime now = ZonedDateTime.now(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.getBooleanConfigValue(Configuration.from(event.getOrganizationId(), event.getId(), STOP_WAITING_QUEUE_SUBSCRIPTIONS), false);
    Map<String, Boolean> result = new HashMap<>();
    result.put("active", active);
    result.put("paused", paused);
    return result;
}
Also used : java.util(java.util) 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) 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) ConfigurationModification(alfio.model.modification.ConfigurationModification) EventStatisticsManager(alfio.manager.EventStatisticsManager) Configuration(alfio.model.system.Configuration) 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) AllArgsConstructor(lombok.AllArgsConstructor) ConfigurationKeys(alfio.model.system.ConfigurationKeys) WaitingQueueManager(alfio.manager.WaitingQueueManager) OptionalWrapper.optionally(alfio.util.OptionalWrapper.optionally) 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 Configuration (alfio.model.system.Configuration)1 ConfigurationKeys (alfio.model.system.ConfigurationKeys)1 STOP_WAITING_QUEUE_SUBSCRIPTIONS (alfio.model.system.ConfigurationKeys.STOP_WAITING_QUEUE_SUBSCRIPTIONS)1 EventUtil (alfio.util.EventUtil)1 OptionalWrapper.optionally (alfio.util.OptionalWrapper.optionally)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 HttpServletResponse (javax.servlet.http.HttpServletResponse)1