Search in sources :

Example 1 with EventCriteria

use of io.gravitee.repository.management.api.search.EventCriteria in project gravitee-management-rest-api by gravitee-io.

the class SyncManager method getLastEvent.

private Event getLastEvent(String api) {
    EventCriteria eventCriteria;
    if (lastRefreshAt == -1) {
        eventCriteria = new EventCriteria.Builder().property(Event.EventProperties.API_ID.getValue(), api).build();
    } else {
        eventCriteria = new EventCriteria.Builder().property(Event.EventProperties.API_ID.getValue(), api).from(lastRefreshAt).to(System.currentTimeMillis()).build();
    }
    List<Event> events = eventRepository.search(eventCriteria, new PageableBuilder().pageNumber(0).pageSize(1).build()).getContent();
    return (!events.isEmpty()) ? events.get(0) : null;
}
Also used : Event(io.gravitee.repository.management.model.Event) EventCriteria(io.gravitee.repository.management.api.search.EventCriteria) PageableBuilder(io.gravitee.repository.management.api.search.builder.PageableBuilder)

Aggregations

EventCriteria (io.gravitee.repository.management.api.search.EventCriteria)1 PageableBuilder (io.gravitee.repository.management.api.search.builder.PageableBuilder)1 Event (io.gravitee.repository.management.model.Event)1