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;
}
Aggregations