Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.Expression


    public String getValue(final Collection<? extends AbstractAttr> attributes) {
        final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
        final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

        // Prepare context using user attributes
        final JexlContext jexlContext = new MapContext();
        jexlUtil.addAttrsToContext(attributes, jexlContext);
        jexlUtil.addFieldsToContext(getOwner(), jexlContext);

        // Evaluate expression using the context prepared before
        return jexlUtil.evaluate(getDerivedSchema().getExpression(), jexlContext);
View Full Code Here


                if (role.getResourceNames().contains(task.getResource().getName())
                        && StringUtils.isNotBlank(task.getResource().getRmapping().getAccountLink())) {

                    LOG.debug("Evaluating accountLink for {}", role);

                    final JexlContext jexlContext = new MapContext();
                    jexlUtil.addFieldsToContext(role, jexlContext);
                    jexlUtil.addAttrsToContext(role.getAttributes(), jexlContext);
                    jexlUtil.addDerAttrsToContext(role.getDerivedAttributes(), role.getAttributes(), jexlContext);
                    final String roleAccountLink = jexlUtil.evaluate(task.getResource().getRmapping().getAccountLink(),
                            jexlContext);
View Full Code Here

    }

    private boolean evaluateMandatoryCondition(final String mandatoryCondition,
            final AbstractAttributable attributable) {

        JexlContext jexlContext = new MapContext();
        jexlUtil.addAttrsToContext(attributable.getAttributes(), jexlContext);
        jexlUtil.addDerAttrsToContext(attributable.getDerivedAttributes(), attributable.getAttributes(), jexlContext);
        jexlUtil.addVirAttrsToContext(attributable.getVirtualAttributes(), jexlContext);

        return Boolean.parseBoolean(jexlUtil.evaluate(mandatoryCondition, jexlContext));
View Full Code Here

    /**
     * {@inheritDoc }
     */
    public Object evaluate(Object context, String expression) {
        Expression jexlExpression = engine.createExpression(expression);
        JexlContext jexlContext = new ObjectContext(engine, context);
       
        return jexlExpression.evaluate(jexlContext);
    }
View Full Code Here

        log.debug("Evaluating expression: {}", expression);
       
        Expression expr = engine.createExpression(expression);

        JexlContext ctx = new MapContext(vars);

        Object result = expr.evaluate(ctx);
        log.debug("Result: {}", result);

        return result;
View Full Code Here

     * {@link FeatureState#DISABLED} otherwise.
     */
    @Override
    public FeatureState process(final ContextManager contextManager)
    {
        final JexlEngine jexlEngine = new JexlEngine();
        Expression jexlExpression;
        if (expression != null) {
            jexlExpression = jexlEngine.createExpression(expression);
        } else {
            jexlExpression = getOldExpression(jexlEngine);
        }
       
        final Map<String, Object> contextMap = contextManager.getContext(context);
View Full Code Here

    public JexlExpressionParser(final Map<String, Object> vars) {
        if (vars == null) {
            throw new IllegalArgumentException("vars");
        }
       
        engine = new JexlEngine();
        context = new MapContext(vars);
        variables = vars;
       
        log.trace("Using variables: {}", vars);
    }
View Full Code Here

        Map<String, Object> sysVars = new HashMap<String, Object>();
        for (Entry<Object,Object> entry : System.getProperties().entrySet()){
            sysVars.put((String)entry.getKey(), entry.getValue());
        }
       
        engine = new JexlEngine();
        context = new MapContext(sysVars);
        variables = sysVars;
       
        log.trace("Using variables: {}", sysVars);
    }
View Full Code Here

    public JexlConditionParser(final Map<String, Object> vars) {
        if (vars == null) {
            throw new IllegalArgumentException("vars");
        }
        this.vars = vars;
        engine = new JexlEngine();
    }
View Full Code Here

    public JexlConditionParser() {
        // Setup the default vars
        vars = new HashMap<String, Object>();
        ParserUtils.addDefaultVariables(vars);
       
        engine = new JexlEngine();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.