Search in sources :

Example 36 with EventInfo

use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.

the class DumpPrincipal method dumpCol.

protected void dumpCol(final BwCalendar col, final boolean doChildren) throws CalFacadeException {
    final CalendarsI colsI = getSvc().getCalendarsHandler();
    try {
        incCount(DumpGlobals.collections);
        makeDir(col.getName(), false);
        col.dump(makeFile(col.getName() + ".xml"));
        /* Dump any events in this collection */
        final Iterable<EventInfo> eis = getDi().getEventInfos(col.getPath());
        eis.forEach(new EventConsumer());
        if (!doChildren || !col.getCollectionInfo().childrenAllowed) {
            return;
        }
        final Collection<BwCalendar> cols = colsI.getChildren(col);
        if (Util.isEmpty(cols)) {
            return;
        }
        for (final BwCalendar ch : cols) {
            dumpCol(ch, true);
        }
    } finally {
        popPath();
    }
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) CalendarsI(org.bedework.calsvci.CalendarsI) BwCalendar(org.bedework.calfacade.BwCalendar)

Example 37 with EventInfo

use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.

the class BwStringRule method end.

@Override
public void end(final String ns, final String name) throws Exception {
    if (name.equals("bwstring")) {
        // 3.5 onwards we wrapped with a tag. Do nothing
        return;
    }
    BwString entity = (BwString) pop();
    if (top() instanceof BwRequestStatus) {
        BwRequestStatus rs = (BwRequestStatus) top();
        rs.setDescription(entity);
        return;
    }
    if (top() instanceof BwCategory) {
        BwCategory cat = (BwCategory) top();
        if (name.equals("keyword")) {
            cat.setWord(entity);
        } else if (name.equals("desc")) {
            cat.setDescription(entity);
        } else {
            unknownTag(name);
        }
        return;
    }
    if (top() instanceof BwContact) {
        BwContact ent = (BwContact) top();
        if (name.equals("value")) {
            ent.setCn(entity);
        } else {
            unknownTag(name);
        }
        return;
    }
    if (top() instanceof BwLocation) {
        BwLocation loc = (BwLocation) top();
        if (name.equals("addr")) {
            loc.setAddress(entity);
        } else if (name.equals("subaddr")) {
            loc.setSubaddress(entity);
        } else {
            unknownTag(name);
        }
        return;
    }
    if (top() instanceof BwFilterDef) {
        BwFilterDef f = (BwFilterDef) top();
        if (name.equals("display-name")) {
            f.addDisplayName(entity);
        } else if (name.equals("subaddr")) {
            f.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
        } else {
            unknownTag(name);
        }
        return;
    }
    if (top() instanceof BwAlarm) {
        BwAlarm a = (BwAlarm) top();
        if (name.equals("description")) {
            a.addDescription(entity);
            if (entity.getLang() != null) {
                a.addXproperty(new BwXproperty(entity.getLang(), null, entity.getValue()));
            } else {
                a.addDescription(entity);
            }
            return;
        }
        if (name.equals("summary")) {
            a.addSummary(entity);
        } else {
            unknownTag(name);
        }
        return;
    }
    EventInfo ei = (EventInfo) top();
    BwEvent e = ei.getEvent();
    if (e instanceof BwEventProxy) {
        e = ((BwEventProxy) e).getRef();
    }
    if (name.equals("comment")) {
        e.addComment(entity);
    } else if (name.equals("description")) {
        e.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
    } else if (name.equals("resource")) {
        e.addResource(entity);
    } else if (name.equals("summary")) {
        e.addSummary(entity);
    } else {
        unknownTag(name);
    }
}
Also used : BwLongString(org.bedework.calfacade.BwLongString) BwLocation(org.bedework.calfacade.BwLocation) BwRequestStatus(org.bedework.calfacade.BwRequestStatus) EventInfo(org.bedework.calfacade.svc.EventInfo) BwXproperty(org.bedework.calfacade.BwXproperty) BwCategory(org.bedework.calfacade.BwCategory) BwFilterDef(org.bedework.calfacade.BwFilterDef) BwEvent(org.bedework.calfacade.BwEvent) BwString(org.bedework.calfacade.BwString) BwContact(org.bedework.calfacade.BwContact) BwEventProxy(org.bedework.calfacade.BwEventProxy) BwAlarm(org.bedework.calfacade.BwAlarm)

Example 38 with EventInfo

use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.

the class AlarmRule method end.

public void end(String ns, String name) throws Exception {
    BwAlarm entity = (BwAlarm) pop();
    globals.counts[globals.valarms]++;
    if (!(top() instanceof EventInfo)) {
        warn("Expected an event info object: found " + top());
        return;
    }
    BwEvent ev = ((EventInfo) top()).getEvent();
    if (entity.getOwnerHref() == null) {
        entity.setOwnerHref(ev.getOwnerHref());
    }
    entity.setEvent(ev);
    ev.addAlarm(entity);
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwEvent(org.bedework.calfacade.BwEvent) BwAlarm(org.bedework.calfacade.BwAlarm)

Example 39 with EventInfo

use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.

the class InScheduler method processScheduleUpdateEvent.

private ProcessMessageResult processScheduleUpdateEvent(final ScheduleUpdateEvent msg) {
    try (final CalSvcI svci = getSvci(msg.getOwnerHref())) {
        if (debug) {
            trace("ScheduleUpdateEvent for principal " + msg.getOwnerHref());
        }
        final EventInfo ei = svci.getEventsHandler().get(getParentPath(msg.getHref()), getName(msg.getHref()));
        if (ei == null) {
            // Event deleted?.
            if (debug) {
                trace("InSchedule event deleted?");
            }
            return ProcessMessageResult.NO_ACTION;
        }
        final BwEvent ev = ei.getEvent();
        SchedProcessor proc = null;
        switch(msg.getChange()) {
            case attendeeChange:
                {
                    proc = new SchedAttendeeUpdate(svci);
                    break;
                }
            default:
                warn("InSchedule: unhandled change type for " + ev.getOwnerHref() + " " + msg.getChange());
        }
        if (proc == null) {
            return ProcessMessageResult.PROCESSED;
        }
        final SchedProcResult pr = proc.process(ei);
        if (debug) {
            trace("InSchedule " + pr.sr);
        }
        return ProcessMessageResult.PROCESSED;
    } catch (final CalFacadeStaleStateException csse) {
        if (debug) {
            trace("Stale state exception");
        }
        rollback(getSvc());
        return ProcessMessageResult.STALE_STATE;
    } catch (final Throwable t) {
        rollback(getSvc());
        error(t);
    }
    return ProcessMessageResult.FAILED;
}
Also used : SchedProcessor(org.bedework.inoutsched.processors.SchedProcessor) CalFacadeStaleStateException(org.bedework.calfacade.exc.CalFacadeStaleStateException) SchedProcResult(org.bedework.inoutsched.processors.SchedProcessor.SchedProcResult) EventInfo(org.bedework.calfacade.svc.EventInfo) CalSvcI(org.bedework.calsvci.CalSvcI) BwEvent(org.bedework.calfacade.BwEvent) SchedAttendeeUpdate(org.bedework.inoutsched.processors.SchedAttendeeUpdate)

Example 40 with EventInfo

use of org.bedework.calfacade.svc.EventInfo in project bw-calendar-engine by Bedework.

the class OutScheduler method getOutboxEvents.

private Collection<EventInfo> getOutboxEvents() throws CalFacadeException {
    BwCalendar outbox = getSvc().getCalendarsHandler().getSpecial(BwCalendar.calTypeOutbox, false);
    if (outbox == null) {
        return null;
    }
    Collection<EventInfo> eis = getSvc().getEventsHandler().getEvents(outbox, null, null, null, // retrieveList
    null, BwIndexer.DeletedState.noDeleted, RecurringRetrievalMode.overrides);
    if (Util.isEmpty(eis)) {
        if (debug) {
            trace("autoSchedule: no outbox events for " + getSvc().getPrincipal().getPrincipalRef());
        }
        return null;
    }
    return eis;
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwCalendar(org.bedework.calfacade.BwCalendar)

Aggregations

EventInfo (org.bedework.calfacade.svc.EventInfo)111 BwEvent (org.bedework.calfacade.BwEvent)80 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)37 BwCalendar (org.bedework.calfacade.BwCalendar)27 BwEventProxy (org.bedework.calfacade.BwEventProxy)24 BwAttendee (org.bedework.calfacade.BwAttendee)19 ArrayList (java.util.ArrayList)16 CoreEventInfo (org.bedework.calcorei.CoreEventInfo)15 BwEventAnnotation (org.bedework.calfacade.BwEventAnnotation)15 BwString (org.bedework.calfacade.BwString)11 BwDateTime (org.bedework.calfacade.BwDateTime)10 BwEventObj (org.bedework.calfacade.BwEventObj)10 TreeSet (java.util.TreeSet)9 BwXproperty (org.bedework.calfacade.BwXproperty)9 BwPrincipal (org.bedework.calfacade.BwPrincipal)7 CalFacadeAccessException (org.bedework.calfacade.exc.CalFacadeAccessException)7 WebdavException (org.bedework.webdav.servlet.shared.WebdavException)7 Calendar (net.fortuna.ical4j.model.Calendar)6 Period (net.fortuna.ical4j.model.Period)6 BwOrganizer (org.bedework.calfacade.BwOrganizer)6