use of org.springframework.binding.expression.Expression 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;
}
use of org.springframework.binding.expression.Expression in project cas by apereo.
the class AbstractCasWebflowConfigurer method createDecisionState.
@Override
public DecisionState createDecisionState(final Flow flow, final String id, final String testExpression, final String thenStateId, final String elseStateId) {
if (containsFlowState(flow, id)) {
LOGGER.debug("Flow [{}] already contains a definition for state id [[{}]]", flow.getId(), id);
return (DecisionState) flow.getTransitionableState(id);
}
final DecisionState decisionState = new DecisionState(flow, id);
final Expression expression = createExpression(testExpression, Boolean.class);
final Transition thenTransition = createTransition(expression, thenStateId);
decisionState.getTransitionSet().add(thenTransition);
final Transition elseTransition = createTransition("*", elseStateId);
decisionState.getTransitionSet().add(elseTransition);
return decisionState;
}
use of org.springframework.binding.expression.Expression 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;
}
use of org.springframework.binding.expression.Expression in project cas by apereo.
the class AbstractCasWebflowConfigurer method getExpressionStringFromAction.
/**
* Gets expression string from action.
*
* @param act the act
* @return the expression string from action
*/
protected Expression getExpressionStringFromAction(final EvaluateAction act) {
final Field field = ReflectionUtils.findField(act.getClass(), "expression");
ReflectionUtils.makeAccessible(field);
return (Expression) ReflectionUtils.getField(field, act);
}
use of org.springframework.binding.expression.Expression in project cas by apereo.
the class AbstractCasWebflowConfigurer method createEndState.
@Override
public EndState createEndState(final Flow flow, final String id, final String viewId, final boolean redirect) {
if (!redirect) {
return createEndState(flow, id, viewId);
}
final Expression expression = createExpression(viewId, String.class);
final ActionExecutingViewFactory viewFactory = new ActionExecutingViewFactory(new ExternalRedirectAction(expression));
return createEndState(flow, id, viewFactory);
}
Aggregations