Search in sources :

Example 31 with ChangeTableEntry

use of org.bedework.calfacade.util.ChangeTableEntry in project bw-calendar-engine by Bedework.

the class Events method doCats.

private void doCats(final RealiasResult resp, final String colHref, final BwEvent ev) {
    try {
        final Set<BwCategory> cats = getCols().getCategorySet(colHref);
        if (Util.isEmpty(cats)) {
            return;
        }
        resp.getCats().addAll(cats);
        for (final BwCategory cat : cats) {
            if (ev.addCategory(cat)) {
                final ChangeTable changes = ev.getChangeset(getPrincipalHref());
                final ChangeTableEntry cte = changes.getEntry(PropertyInfoIndex.CATEGORIES);
                cte.addAddedValue(cat);
            }
        }
    } catch (final Throwable t) {
        Response.error(new RealiasResult(null), t.getMessage());
    }
}
Also used : ChangeTable(org.bedework.calfacade.util.ChangeTable) BwCategory(org.bedework.calfacade.BwCategory) ChangeTableEntry(org.bedework.calfacade.util.ChangeTableEntry)

Example 32 with ChangeTableEntry

use of org.bedework.calfacade.util.ChangeTableEntry in project bw-calendar-engine by Bedework.

the class SchedulingBase method addChangeInfo.

private void addChangeInfo(final EventInfo ei, final StringBuilder changeInfo, final String entity) throws CalFacadeException {
    if (ei.getChangeset(getPrincipalHref()).isEmpty()) {
        // Forced update?
        appendEntity(changeInfo, entity);
        return;
    }
    boolean changed = false;
    Collection<ChangeTableEntry> ctes = ei.getChangeset(getPrincipalHref()).getEntries();
    for (ChangeTableEntry cte : ctes) {
        if (!cte.getChanged()) {
            continue;
        }
        if (!changed) {
            appendEntity(changeInfo, entity);
            changeInfo.append(";CHANGES");
        }
        changed = true;
        changeInfo.append(";");
        /* TODO - fix this at source */
        if ((cte.getIndex() == PropertyInfoIndex.DTEND) && (ei.getEvent().getEntityType() == IcalDefs.entityTypeTodo)) {
            changeInfo.append(PropertyInfoIndex.DUE.toString());
        } else {
            changeInfo.append(cte.getIndex().toString());
        }
    }
}
Also used : ChangeTableEntry(org.bedework.calfacade.util.ChangeTableEntry)

Aggregations

ChangeTableEntry (org.bedework.calfacade.util.ChangeTableEntry)32 BwEvent (org.bedework.calfacade.BwEvent)26 UpdateResult (org.bedework.caldav.server.sysinterface.SysIntf.UpdateResult)20 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)10 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)10 BwDateTime (org.bedework.calfacade.BwDateTime)7 BwString (org.bedework.calfacade.BwString)7 BwXproperty (org.bedework.calfacade.BwXproperty)7 ChangeTable (org.bedework.calfacade.util.ChangeTable)7 BwAttendee (org.bedework.calfacade.BwAttendee)4 BwCategory (org.bedework.calfacade.BwCategory)4 DateDatetimePropertyType (ietf.params.xml.ns.icalendar_2.DateDatetimePropertyType)3 TextPropertyType (ietf.params.xml.ns.icalendar_2.TextPropertyType)3 Holder (javax.xml.ws.Holder)3 BwContact (org.bedework.calfacade.BwContact)3 BwEventProxy (org.bedework.calfacade.BwEventProxy)3 BigInteger (java.math.BigInteger)2 HashMap (java.util.HashMap)2 TreeSet (java.util.TreeSet)2 BwOrganizer (org.bedework.calfacade.BwOrganizer)2