Search in sources :

Example 1 with SchedulingStatus

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)))));
}
Also used : EventSearchQuery(org.opencastproject.index.service.impl.index.event.EventSearchQuery) Event(org.opencastproject.index.service.impl.index.event.Event) SchedulingStatus(org.opencastproject.index.service.impl.index.event.Event.SchedulingStatus)

Aggregations

Event (org.opencastproject.index.service.impl.index.event.Event)1 SchedulingStatus (org.opencastproject.index.service.impl.index.event.Event.SchedulingStatus)1 EventSearchQuery (org.opencastproject.index.service.impl.index.event.EventSearchQuery)1