Search in sources :

Example 1 with ShiftedCursor

use of org.zalando.nakadi.view.ShiftedCursor in project nakadi by zalando.

the class CursorOperationsController method moveCursors.

@RequestMapping(path = "/event-types/{eventTypeName}/shifted-cursors", method = RequestMethod.POST)
public ResponseEntity<?> moveCursors(@PathVariable("eventTypeName") final String eventTypeName, @Valid @RequestBody final ValidListWrapper<ShiftedCursor> cursors) throws InternalNakadiException, NoSuchEventTypeException {
    final EventType eventType = eventTypeRepository.findByName(eventTypeName);
    authorizationValidator.authorizeStreamRead(eventType);
    final List<ShiftedNakadiCursor> domainCursor = cursors.getList().stream().map(this.toShiftedNakadiCursor(eventTypeName)).collect(Collectors.toList());
    final List<NakadiCursor> domainResultCursors = cursorOperationsService.unshiftCursors(domainCursor);
    final List<Cursor> viewResult = domainResultCursors.stream().map(cursorConverter::convert).collect(Collectors.toList());
    return status(OK).body(viewResult);
}
Also used : NakadiCursor(org.zalando.nakadi.domain.NakadiCursor) ShiftedNakadiCursor(org.zalando.nakadi.domain.ShiftedNakadiCursor) EventType(org.zalando.nakadi.domain.EventType) ShiftedNakadiCursor(org.zalando.nakadi.domain.ShiftedNakadiCursor) NakadiCursor(org.zalando.nakadi.domain.NakadiCursor) Cursor(org.zalando.nakadi.view.Cursor) ShiftedNakadiCursor(org.zalando.nakadi.domain.ShiftedNakadiCursor) ShiftedCursor(org.zalando.nakadi.view.ShiftedCursor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 EventType (org.zalando.nakadi.domain.EventType)1 NakadiCursor (org.zalando.nakadi.domain.NakadiCursor)1 ShiftedNakadiCursor (org.zalando.nakadi.domain.ShiftedNakadiCursor)1 Cursor (org.zalando.nakadi.view.Cursor)1 ShiftedCursor (org.zalando.nakadi.view.ShiftedCursor)1