use of org.springframework.webflow.action.EvaluateAction 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.webflow.action.EvaluateAction in project cas by apereo.
the class SpringWebflowEndpoint method convertActionToString.
private static String convertActionToString(final Action action) {
if (action instanceof EvaluateAction) {
return convertEvaluateActionToString(action);
}
if (action instanceof AnnotatedAction) {
val eval = (AnnotatedAction) action;
if (eval.getTargetAction() instanceof EvaluateAction) {
return convertEvaluateActionToString(eval.getTargetAction());
}
return eval.getTargetAction().toString();
}
if (action instanceof SetAction) {
val expF = ReflectionUtils.findField(action.getClass(), "nameExpression");
val resultExpF = ReflectionUtils.findField(action.getClass(), "valueExpression");
return "set " + stringifyActionField(action, expF) + " = " + stringifyActionField(action, resultExpF);
}
return action.toString();
}
use of org.springframework.webflow.action.EvaluateAction in project cas by apereo.
the class CasCaptchaWebflowConfigurerTests method verifyOperation.
@Test
public void verifyOperation() {
assertFalse(casWebflowExecutionPlan.getWebflowConfigurers().isEmpty());
val flow = (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(CasWebflowConfigurer.FLOW_ID_LOGIN);
assertNotNull(flow);
val state = (ActionState) flow.getState(CasWebflowConstants.STATE_ID_REAL_SUBMIT);
assertTrue(Arrays.stream(state.getActionList().toArray()).filter(r -> r instanceof EvaluateAction).map(EvaluateAction.class::cast).anyMatch(r -> r.toString().contains(CasWebflowConstants.ACTION_ID_VALIDATE_CAPTCHA)));
}
use of org.springframework.webflow.action.EvaluateAction in project cas by apereo.
the class SpringWebflowEndpoint method convertEvaluateActionToString.
private static String convertEvaluateActionToString(final Action action) {
val eval = (EvaluateAction) action;
val expF = ReflectionUtils.findField(eval.getClass(), "expression");
val resultExpF = ReflectionUtils.findField(eval.getClass(), "resultExpression");
return stringifyActionField(action, expF, resultExpF);
}
use of org.springframework.webflow.action.EvaluateAction in project cas by apereo.
the class AbstractCasWebflowConfigurer method createEvaluateAction.
@Override
public EvaluateAction createEvaluateAction(final String expression) {
if (this.flowBuilderServices == null) {
LOGGER.warn("Flow builder services is not configured correctly.");
return null;
}
val ctx = new FluentParserContext();
val action = this.flowBuilderServices.getExpressionParser().parseExpression(expression, ctx);
val newAction = new EvaluateAction(action, null);
LOGGER.trace("Created evaluate action for expression [{}]", action.getExpressionString());
return newAction;
}
Aggregations