Search in sources :

Example 1 with NotificationInfo

use of org.bedework.caldav.util.notifications.NotificationType.NotificationInfo in project bw-calendar-engine by Bedework.

the class Notifications method getMatching.

@Override
public List<NotificationType> getMatching(final QName type) throws CalFacadeException {
    final List<NotificationType> res = new ArrayList<>();
    final BwCalendar ncol = getCols().getSpecial(BwCalendar.calTypeNotifications, true);
    if (ncol == null) {
        return res;
    }
    final Collection<BwResource> rsrc = getSvc().getResourcesHandler().getAll(ncol.getPath());
    if (Util.isEmpty(rsrc)) {
        return res;
    }
    if (rsrc.size() > 100) {
        warn("Large resource collection for " + ncol.getPath());
    }
    for (final BwResource r : rsrc) {
        if (type != null) {
            final NotificationInfo ni = NotificationType.fromContentType(r.getContentType());
            if ((ni == null) || !type.equals(ni.type)) {
                continue;
            }
        }
        final NotificationType nt = makeNotification(r);
        if (nt != null) {
            res.add(nt);
        }
    }
    return res;
}
Also used : NotificationInfo(org.bedework.caldav.util.notifications.NotificationType.NotificationInfo) NotificationType(org.bedework.caldav.util.notifications.NotificationType) BwResource(org.bedework.calfacade.BwResource) ArrayList(java.util.ArrayList) BwCalendar(org.bedework.calfacade.BwCalendar)

Aggregations

ArrayList (java.util.ArrayList)1 NotificationType (org.bedework.caldav.util.notifications.NotificationType)1 NotificationInfo (org.bedework.caldav.util.notifications.NotificationType.NotificationInfo)1 BwCalendar (org.bedework.calfacade.BwCalendar)1 BwResource (org.bedework.calfacade.BwResource)1