Search in sources :

Example 1 with PageAndContent

use of alfio.controller.api.support.PageAndContent in project alf.io by alfio-event.

the class EmailMessageApiController method loadEmailMessages.

@RequestMapping("/")
public PageAndContent<List<LightweightEmailMessage>> loadEmailMessages(@PathVariable("eventName") String eventName, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "search", required = false) String search, Principal principal) {
    Event event = eventManager.getSingleEvent(eventName, principal.getName());
    ZoneId zoneId = event.getZoneId();
    Pair<Integer, List<LightweightMailMessage>> found = notificationManager.loadAllMessagesForEvent(event.getId(), page, search);
    return new PageAndContent<>(found.getRight().stream().map(m -> new LightweightEmailMessage(m, zoneId, true)).collect(Collectors.toList()), found.getLeft());
}
Also used : ZoneId(java.time.ZoneId) Event(alfio.model.Event) List(java.util.List) PageAndContent(alfio.controller.api.support.PageAndContent) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PageAndContent (alfio.controller.api.support.PageAndContent)1 Event (alfio.model.Event)1 ZoneId (java.time.ZoneId)1 List (java.util.List)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1