Search in sources :

Example 1 with SchedAttendeeUpdate

use of org.bedework.inoutsched.processors.SchedAttendeeUpdate 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)

Aggregations

BwEvent (org.bedework.calfacade.BwEvent)1 CalFacadeStaleStateException (org.bedework.calfacade.exc.CalFacadeStaleStateException)1 EventInfo (org.bedework.calfacade.svc.EventInfo)1 CalSvcI (org.bedework.calsvci.CalSvcI)1 SchedAttendeeUpdate (org.bedework.inoutsched.processors.SchedAttendeeUpdate)1 SchedProcessor (org.bedework.inoutsched.processors.SchedProcessor)1 SchedProcResult (org.bedework.inoutsched.processors.SchedProcessor.SchedProcResult)1