use of org.bedework.caldav.util.notifications.CalendarChangesType 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;
}
Aggregations