Search in sources :

Example 1 with FilterType

use of ietf.params.xml.ns.caldav.FilterType in project bw-calendar-engine by Bedework.

the class Filters method parse.

@Override
public ParseResult parse(final BwFilterDef val) {
    final String def = val.getDefinition();
    if ((def.length() > 5) && (def.startsWith("<?xml"))) {
        // Assume xml filter
        final ParseResult pr = new ParseResult();
        try {
            final FilterType f = org.bedework.caldav.util.filter.parse.Filters.parse(def);
            final EventQuery eq = org.bedework.caldav.util.filter.parse.Filters.getQuery(f);
            val.setFilters(eq.filter);
            pr.ok = true;
        } catch (final Throwable t) {
            pr.ok = false;
            pr.message = t.getMessage();
            pr.cfe = new CalFacadeException(t);
        }
        return pr;
    }
    // Assume simple expression filter
    final String source = "BwFilterDef:" + val.getOwnerHref() + ":" + val.getName();
    final ParseResult pr = getSvc().getFilterParser().parse(def, false, source);
    if (pr.ok) {
        val.setFilters(pr.filter);
    }
    return pr;
}
Also used : FilterType(ietf.params.xml.ns.caldav.FilterType) ParseResult(org.bedework.calfacade.filter.SimpleFilterParser.ParseResult) EventQuery(org.bedework.caldav.util.filter.parse.EventQuery) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Aggregations

FilterType (ietf.params.xml.ns.caldav.FilterType)1 EventQuery (org.bedework.caldav.util.filter.parse.EventQuery)1 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)1 ParseResult (org.bedework.calfacade.filter.SimpleFilterParser.ParseResult)1