Search in sources :

Example 1 with ObjectContext

use of org.apache.commons.jexl2.ObjectContext in project vorto by eclipse.

the class AbstractDataMapper method matchesCondition.

private boolean matchesCondition(Map<String, String> attributes, JXPathContext context) {
    if (attributes.containsKey(ATTRIBUTE_CONDITION) && !attributes.get(ATTRIBUTE_CONDITION).equals("")) {
        Expression e = JEXL.createExpression(normalizeCondition(attributes.get(ATTRIBUTE_CONDITION)));
        JexlContext jc = new ObjectContext<Object>(JEXL, context.getContextBean());
        jc.set("this", context.getContextBean());
        return (boolean) e.evaluate(jc);
    } else {
        return true;
    }
}
Also used : Expression(org.apache.commons.jexl2.Expression) JexlContext(org.apache.commons.jexl2.JexlContext) ObjectContext(org.apache.commons.jexl2.ObjectContext)

Aggregations

Expression (org.apache.commons.jexl2.Expression)1 JexlContext (org.apache.commons.jexl2.JexlContext)1 ObjectContext (org.apache.commons.jexl2.ObjectContext)1