Search in sources :

Example 6 with BwFilterDef

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

the class FilterDefsDAO method fetch.

public BwFilterDef fetch(final String name, final BwPrincipal owner) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(fetchFilterDefQuery);
    sess.setString("ownerHref", owner.getPrincipalRef());
    sess.setString("name", name);
    sess.cacheableQuery();
    return (BwFilterDef) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwFilterDef(org.bedework.calfacade.BwFilterDef)

Example 7 with BwFilterDef

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

the class BwLongStringRule method end.

@Override
public void end(final String ns, final String name) throws Exception {
    if (name.equals("bwlongstring")) {
        // 3.5 onwards we wrapped with a tag. Do nothing
        return;
    }
    BwLongString entity;
    try {
        entity = (BwLongString) pop();
        if (top() instanceof BwFilterDef) {
            BwFilterDef f = (BwFilterDef) top();
            if (name.equals("subaddr")) {
                f.addDescription(entity);
            } else {
                throw new Exception("unknown tag " + name);
            }
            return;
        }
        EventInfo ei = (EventInfo) top();
        BwEvent e = ei.getEvent();
        if (e instanceof BwEventProxy) {
            e = ((BwEventProxy) e).getRef();
        }
        if (name.equals("description")) {
            e.addDescription(entity);
        } else {
            throw new Exception("unknown tag " + name);
        }
    } catch (Throwable t) {
        handleException(t);
    }
}
Also used : BwLongString(org.bedework.calfacade.BwLongString) EventInfo(org.bedework.calfacade.svc.EventInfo) BwFilterDef(org.bedework.calfacade.BwFilterDef) BwEvent(org.bedework.calfacade.BwEvent) BwEventProxy(org.bedework.calfacade.BwEventProxy)

Example 8 with BwFilterDef

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

the class FilterFieldRule method field.

public void field(String name) throws Exception {
    BwStringBase str = null;
    if (top() instanceof BwStringBase) {
        str = (BwStringBase) pop();
    }
    BwFilterDef f = (BwFilterDef) top();
    if (name.equals("name")) {
        f.setName(stringFld());
    } else if (name.equals("definition")) {
        f.setDefinition(stringFld());
    } else if (name.equals("description")) {
        f.addDescription((BwLongString) str);
    } else if (name.equals("displayName")) {
        f.addDisplayName((BwString) str);
    } else if (name.equals("descriptions")) {
    // Nothing to do.
    } else if (name.equals("displayNames")) {
    // Nothing to do.
    }
}
Also used : BwStringBase(org.bedework.calfacade.base.BwStringBase) BwFilterDef(org.bedework.calfacade.BwFilterDef) BwString(org.bedework.calfacade.BwString)

Aggregations

BwFilterDef (org.bedework.calfacade.BwFilterDef)8 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)3 BwEvent (org.bedework.calfacade.BwEvent)2 BwEventProxy (org.bedework.calfacade.BwEventProxy)2 BwLongString (org.bedework.calfacade.BwLongString)2 BwString (org.bedework.calfacade.BwString)2 EventInfo (org.bedework.calfacade.svc.EventInfo)2 HibSession (org.bedework.calcorei.HibSession)1 BwAlarm (org.bedework.calfacade.BwAlarm)1 BwCategory (org.bedework.calfacade.BwCategory)1 BwContact (org.bedework.calfacade.BwContact)1 BwLocation (org.bedework.calfacade.BwLocation)1 BwRequestStatus (org.bedework.calfacade.BwRequestStatus)1 BwXproperty (org.bedework.calfacade.BwXproperty)1 BwStringBase (org.bedework.calfacade.base.BwStringBase)1 GetFilterDefResponse (org.bedework.calfacade.responses.GetFilterDefResponse)1