Search in sources :

Example 1 with FluentParserContext

use of org.springframework.binding.expression.support.FluentParserContext in project cas by apereo.

the class AbstractCasWebflowConfigurer method createEvaluateAction.

@Override
public EvaluateAction createEvaluateAction(final String expression) {
    if (this.flowBuilderServices == null) {
        LOGGER.error("Flow builder services is not configured correctly.");
        return null;
    }
    final ParserContext ctx = new FluentParserContext();
    final Expression action = this.flowBuilderServices.getExpressionParser().parseExpression(expression, ctx);
    final EvaluateAction newAction = new EvaluateAction(action, null);
    LOGGER.debug("Created evaluate action for expression [[{}]]", action.getExpressionString());
    return newAction;
}
Also used : FluentParserContext(org.springframework.binding.expression.support.FluentParserContext) Expression(org.springframework.binding.expression.Expression) LiteralExpression(org.springframework.binding.expression.support.LiteralExpression) EvaluateAction(org.springframework.webflow.action.EvaluateAction) FluentParserContext(org.springframework.binding.expression.support.FluentParserContext) ParserContext(org.springframework.binding.expression.ParserContext)

Example 2 with FluentParserContext

use of org.springframework.binding.expression.support.FluentParserContext in project cas by apereo.

the class AbstractCasWebflowConfigurer method createMappingToSubflowState.

/**
     * Create mapping to subflow state.
     *
     * @param name     the name
     * @param value    the value
     * @param required the required
     * @param type     the type
     * @return the default mapping
     */
protected DefaultMapping createMappingToSubflowState(final String name, final String value, final boolean required, final Class type) {
    final ExpressionParser parser = this.flowBuilderServices.getExpressionParser();
    final Expression source = parser.parseExpression(value, new FluentParserContext());
    final Expression target = parser.parseExpression(name, new FluentParserContext());
    final DefaultMapping mapping = new DefaultMapping(source, target);
    mapping.setRequired(required);
    final ConversionExecutor typeConverter = new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
    mapping.setTypeConverter(typeConverter);
    return mapping;
}
Also used : FluentParserContext(org.springframework.binding.expression.support.FluentParserContext) RuntimeBindingConversionExecutor(org.springframework.binding.convert.service.RuntimeBindingConversionExecutor) ConversionExecutor(org.springframework.binding.convert.ConversionExecutor) Expression(org.springframework.binding.expression.Expression) LiteralExpression(org.springframework.binding.expression.support.LiteralExpression) SpringELExpressionParser(org.springframework.binding.expression.spel.SpringELExpressionParser) ExpressionParser(org.springframework.binding.expression.ExpressionParser) SpelExpressionParser(org.springframework.expression.spel.standard.SpelExpressionParser) DefaultMapping(org.springframework.binding.mapping.impl.DefaultMapping) RuntimeBindingConversionExecutor(org.springframework.binding.convert.service.RuntimeBindingConversionExecutor)

Aggregations

Expression (org.springframework.binding.expression.Expression)2 FluentParserContext (org.springframework.binding.expression.support.FluentParserContext)2 LiteralExpression (org.springframework.binding.expression.support.LiteralExpression)2 ConversionExecutor (org.springframework.binding.convert.ConversionExecutor)1 RuntimeBindingConversionExecutor (org.springframework.binding.convert.service.RuntimeBindingConversionExecutor)1 ExpressionParser (org.springframework.binding.expression.ExpressionParser)1 ParserContext (org.springframework.binding.expression.ParserContext)1 SpringELExpressionParser (org.springframework.binding.expression.spel.SpringELExpressionParser)1 DefaultMapping (org.springframework.binding.mapping.impl.DefaultMapping)1 SpelExpressionParser (org.springframework.expression.spel.standard.SpelExpressionParser)1 EvaluateAction (org.springframework.webflow.action.EvaluateAction)1