Search in sources :

Example 1 with RecurrenceType

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

the class NotificationsInfo method instanceChanges.

private static CalendarChangesType instanceChanges(final String currentAuth, final BwEvent ev) throws Throwable {
    CalendarChangesType cc = new CalendarChangesType();
    RecurrenceType r = new RecurrenceType();
    r.setRecurrenceid(ev.getRecurrenceId());
    ChangesType c = new ChangesType();
    for (ChangeTableEntry cte : ev.getChangeset(currentAuth).getEntries()) {
        if (!cte.getChanged()) {
            continue;
        }
        if (cte.getIndex() == PropertyInfoIndex.XPROP) {
            /* Reflected a a set of removes and adds. */
            if (!Util.isEmpty(cte.getRemovedValues())) {
                for (BwXproperty xp : ((Collection<BwXproperty>) cte.getRemovedValues())) {
                    ChangedPropertyType cp = new ChangedPropertyType();
                    cp.setName(xp.getName());
                    cp.setDataFrom(String.valueOf(xp));
                    c.getChangedProperty().add(cp);
                }
            }
            if (!Util.isEmpty(cte.getAddedValues())) {
                for (BwXproperty xp : ((Collection<BwXproperty>) cte.getAddedValues())) {
                    ChangedPropertyType cp = new ChangedPropertyType();
                    cp.setName(xp.getName());
                    cp.setDataTo(String.valueOf(xp));
                    c.getChangedProperty().add(cp);
                }
            }
        } else {
            ChangedPropertyType cp = new ChangedPropertyType();
            cp.setName(cte.getIndex().name());
            cp.setDataFrom(getDataFrom(cte));
            cp.setDataTo(getDataTo(cte));
            c.getChangedProperty().add(cp);
        }
    }
    r.getChanges().add(c);
    cc.getRecurrence().add(r);
    return cc;
}
Also used : ChangedPropertyType(org.bedework.caldav.util.notifications.ChangedPropertyType) BwXproperty(org.bedework.calfacade.BwXproperty) RecurrenceType(org.bedework.caldav.util.notifications.RecurrenceType) CalendarChangesType(org.bedework.caldav.util.notifications.CalendarChangesType) ChangesType(org.bedework.caldav.util.notifications.ChangesType) CalendarChangesType(org.bedework.caldav.util.notifications.CalendarChangesType)

Aggregations

CalendarChangesType (org.bedework.caldav.util.notifications.CalendarChangesType)1 ChangedPropertyType (org.bedework.caldav.util.notifications.ChangedPropertyType)1 ChangesType (org.bedework.caldav.util.notifications.ChangesType)1 RecurrenceType (org.bedework.caldav.util.notifications.RecurrenceType)1 BwXproperty (org.bedework.calfacade.BwXproperty)1