Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TSimpleJSONProtocol$MapContext


        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

        return context;
    }

    public String evaluate(final String expression, final AbstractAttributableTO attributableTO) {
        final JexlContext context = new MapContext();

        addFieldsToContext(attributableTO, context);

        for (AttributeTO attr : attributableTO.getAttributes()) {
            List<String> values = attr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add attribute {} with value {}", attr.getSchema(), expressionValue);

            context.set(attr.getSchema(), expressionValue);
        }
        for (AttributeTO derAttr : attributableTO.getDerivedAttributes()) {
            List<String> values = derAttr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema(), expressionValue);

            context.set(derAttr.getSchema(), expressionValue);
        }
        for (AttributeTO virAttr : attributableTO.getVirtualAttributes()) {
            List<String> values = virAttr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema(), expressionValue);

            context.set(virAttr.getSchema(), expressionValue);
        }

        // Evaluate expression using the context prepared before
        return evaluate(expression, context);
    }
View Full Code Here

        } 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

TOP

Related Classes of org.apache.thrift.protocol.TSimpleJSONProtocol$MapContext

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.