Search in sources :

Example 26 with BwEventAnnotation

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

the class EventStringKeyRule method field.

public void field(String name) throws Throwable {
    try {
        /* Top should now be an event object */
        EventInfo ei = (EventInfo) getTop(EventInfo.class, name);
        BwEventAnnotation ann = null;
        BwEvent e = ei.getEvent();
        if (e instanceof BwEventProxy) {
            ann = ((BwEventProxy) e).getRef();
            if (ann.getOverride()) {
                // Overrides have everything set already
                return;
            }
            String match = getDigester().getMatch();
            if (match.contains("/target/")) {
                e = ann.getTarget();
            } else if (match.contains("/master/")) {
                e = ann.getMaster();
            } else {
                e = ann;
            }
        }
        if (name.equals("uid")) {
            e.setUid(stringFld());
        } else if (name.equals("recurrenceId")) {
            e.setRecurrenceId(stringFld());
        } else {
            unknownTag(name);
        }
    } catch (Throwable t) {
        handleException(t);
    }
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwEventAnnotation(org.bedework.calfacade.BwEventAnnotation) BwEvent(org.bedework.calfacade.BwEvent) BwEventProxy(org.bedework.calfacade.BwEventProxy)

Example 27 with BwEventAnnotation

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

the class ContainerPathRule method field.

public void field(String name) throws Throwable {
    if (name.equals("path")) {
        /* If the top is an override skip this - container is set already. */
        BwEventAnnotation ann = null;
        BwEvent e = null;
        if (top() instanceof EventInfo) {
            EventInfo ei = (EventInfo) getTop(EventInfo.class, name);
            e = ei.getEvent();
            if (e instanceof BwEventProxy) {
                ann = ((BwEventProxy) e).getRef();
                if (ann.getOverride()) {
                    // Overrides have everything set already
                    return;
                }
            }
        }
        BwCalendar cal = globals.rintf.getCalendar(stringFld());
        if (cal == null) {
            error("No calendar for path " + stringFld());
        }
        if (top() instanceof BwShareableContainedDbentity) {
            BwShareableContainedDbentity scde = (BwShareableContainedDbentity) top();
            scde.setColPath(stringFld());
        } else if (top() instanceof EventInfo) {
            if (ann != null) {
                /* Could be target or master */
                String match = getDigester().getMatch();
                if (match.contains("/target/")) {
                    ann.getTarget().setColPath(stringFld());
                } else if (match.contains("/master/")) {
                    ann.getMaster().setColPath(stringFld());
                } else {
                    ann.setColPath(stringFld());
                }
            }
            e.setColPath(stringFld());
        } else {
            handleException(new Exception("Unexpected stack top "));
        }
    } else {
        unknownTag(name);
    }
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwEventAnnotation(org.bedework.calfacade.BwEventAnnotation) BwShareableContainedDbentity(org.bedework.calfacade.base.BwShareableContainedDbentity) BwEvent(org.bedework.calfacade.BwEvent) BwCalendar(org.bedework.calfacade.BwCalendar) BwEventProxy(org.bedework.calfacade.BwEventProxy)

Aggregations

BwEventAnnotation (org.bedework.calfacade.BwEventAnnotation)27 BwEvent (org.bedework.calfacade.BwEvent)22 BwEventProxy (org.bedework.calfacade.BwEventProxy)19 EventInfo (org.bedework.calfacade.svc.EventInfo)15 CoreEventInfo (org.bedework.calcorei.CoreEventInfo)10 BwDateTime (org.bedework.calfacade.BwDateTime)8 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)7 BwRecurrenceInstance (org.bedework.calfacade.BwRecurrenceInstance)6 BwCalendar (org.bedework.calfacade.BwCalendar)5 Dur (net.fortuna.ical4j.model.Dur)4 ArrayList (java.util.ArrayList)3 TreeSet (java.util.TreeSet)3 DateTime (net.fortuna.ical4j.model.DateTime)3 SearchResponse (org.elasticsearch.action.search.SearchResponse)3 SearchHit (org.elasticsearch.search.SearchHit)3 Period (net.fortuna.ical4j.model.Period)2 TimeZone (net.fortuna.ical4j.model.TimeZone)2 DtStart (net.fortuna.ical4j.model.property.DtStart)2 CurrentAccess (org.bedework.access.Acl.CurrentAccess)2 HibSession (org.bedework.calcorei.HibSession)2