use of org.opencastproject.index.service.impl.index.event.Event.SchedulingStatus in project opencast by opencast.
the class EventsEndpoint method extendEventsStatusOverview.
private void extendEventsStatusOverview(List<Field> fields, Series series) throws SearchIndexException {
EventSearchQuery query = new EventSearchQuery(getSecurityService().getOrganization().getId(), getSecurityService().getUser()).withoutActions().withSeriesId(series.getIdentifier());
SearchResult<Event> result = externalIndex.getByQuery(query);
// collect recording statuses
int blacklisted = 0;
int optOut = 0;
int ready = 0;
for (SearchResultItem<Event> item : result.getItems()) {
Event event = item.getSource();
if (event.getSchedulingStatus() == null)
continue;
SchedulingStatus schedulingStatus = SchedulingStatus.valueOf(event.getSchedulingStatus());
if (SchedulingStatus.BLACKLISTED.equals(schedulingStatus)) {
blacklisted++;
} else if (series.isOptedOut() || SchedulingStatus.OPTED_OUT.equals(schedulingStatus)) {
optOut++;
} else {
ready++;
}
}
fields.add(f("events", obj(f("BLACKLISTED", v(blacklisted)), f("OPTED_OUT", v(optOut)), f("READY", v(ready)))));
}
Aggregations