Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.IssuesTest$Container


        } else {
            jexlExpression = getOldExpression(jexlEngine);
        }
       
        final Map<String, Object> contextMap = contextManager.getContext(context);
        final JexlContext jexlContext = new MapContext(contextMap);

        return Boolean.TRUE.equals(jexlExpression.evaluate(jexlContext)) ? FeatureState.ENABLED : FeatureState.DISABLED;
    }
View Full Code Here


        String evalAccountLink = null;
        if (StringUtils.isNotBlank(attrUtil.getAccountLink(resource))) {
            final ConfigurableApplicationContext context = ApplicationContextProvider.getApplicationContext();
            final JexlUtil jexlUtil = context.getBean(JexlUtil.class);

            final JexlContext jexlContext = new MapContext();
            jexlUtil.addFieldsToContext(subject, jexlContext);
            jexlUtil.addAttrsToContext(subject.getAttributes(), jexlContext);
            jexlUtil.addDerAttrsToContext(subject.getDerivedAttributes(), subject.getAttributes(), jexlContext);
            evalAccountLink = jexlUtil.evaluate(attrUtil.getAccountLink(resource), jexlContext);
        }
View Full Code Here

    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

     * {@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

        return result;
    }

    public JexlContext addFieldsToContext(final Object attributable, final JexlContext jexlContext) {
        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        final Field[] fields = attributable.getClass().getDeclaredFields();
        for (int i = 0; i < fields.length; i++) {
            try {
View Full Code Here

    public JexlContext addAttrsToContext(final Collection<? extends AbstractAttr> attributes,
            final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractAttr attr : attributes) {
            List<String> attributeValues = attr.getValuesAsStrings();
            String expressionValue = attributeValues.isEmpty()
View Full Code Here

    public JexlContext addDerAttrsToContext(final Collection<? extends AbstractDerAttr> derAttrs,
            final Collection<? extends AbstractAttr> attrs, final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractDerAttr derAttr : derAttrs) {
            String expressionValue = derAttr.getValue(attrs);
            if (expressionValue == null) {
View Full Code Here

    public JexlContext addVirAttrsToContext(final Collection<? extends AbstractVirAttr> virAttrs,
            final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractVirAttr virAttr : virAttrs) {
            List<String> attributeValues = virAttr.getValues();
            String expressionValue = attributeValues.isEmpty()
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.IssuesTest$Container

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.