/** * Builds any start actions to execute when the flow starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildStartActions() throws FlowBuilderException { getFlow().getStartActionList().addAll(parseActions(flowModel.getOnStartActions())); }
/** * Create initial flow actions. * * @param flow the flow */ protected void createInitialFlowActions(final Flow flow) { flow.getStartActionList().add(createEvaluateAction(CasWebflowConstants.ACTION_ID_INIT_FLOW_SETUP)); }
private void parseAndAddStartActions(Element element, Flow flow) { Element startElement = getChildElementByTagName(element, START_ACTIONS_ELEMENT); if (startElement != null) { flow.getStartActionList().addAll(parseAnnotatedActions(startElement)); } }
/** * Builds any start actions to execute when the flow starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildStartActions() throws FlowBuilderException { getFlow().getStartActionList().addAll(parseActions(flowModel.getOnStartActions())); }
/** * Builds any start actions to execute when the flow starts. * @throws FlowBuilderException an exception occurred building the flow */ public void buildStartActions() throws FlowBuilderException { getFlow().getStartActionList().addAll(parseActions(flowModel.getOnStartActions())); }
public void testAddActions() { flow.getStartActionList().add(new TestMultiAction()); flow.getStartActionList().add(new TestMultiAction()); flow.getEndActionList().add(new TestMultiAction()); assertEquals(2, flow.getStartActionList().size()); assertEquals(1, flow.getEndActionList().size()); }
val mfaFlow = (Flow) mfaProviderFlowRegistry.getFlowDefinition(subflowId); mfaFlow.getStartActionList().add(createSetAction("flowScope.".concat(CasWebflowConstants.VAR_ID_MFA_PROVIDER_ID), StringUtils.quote(providerId)));
public void testStartWithAction() { MockRequestControlContext context = new MockRequestControlContext(flow); TestAction action = new TestAction(); flow.getStartActionList().add(action); flow.start(context, new LocalAttributeMap<>()); assertEquals("Wrong start state", "myState1", context.getCurrentState().getId()); assertEquals(1, action.getExecutionCount()); }
public void testSetActionWithResultType() throws Exception { SetModel setModel = new SetModel("flowScope.stringArray", "intArray"); setModel.setType("java.lang.String[]"); model.setOnStartActions(asList(setModel)); model.setStates(asList(new ViewStateModel("view"))); Flow flow = getFlow(model); AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0); MockRequestContext context = new MockRequestContext(flow); context.getFlowScope().put("intArray", new int[] { 1, 2 }); action.execute(context); String[] expected = (String[]) context.getFlowScope().get("stringArray"); assertEquals("1", expected[0]); assertEquals("2", expected[1]); }
public void testEvaluateActionWithELExpression() throws Exception { EvaluateModel evaluateModel = new EvaluateModel("testBean.getIntegers()"); evaluateModel.setResult("flowScope.stringArray"); evaluateModel.setResultType("java.lang.String[]"); model.setOnStartActions(asList(evaluateModel)); model.setStates(asList(new ViewStateModel("view"))); Flow flow = getFlow(model); AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0); MockRequestContext context = new MockRequestContext(flow); context.getFlowScope().put("testBean", new TestBean()); action.execute(context); String[] expected = (String[]) context.getFlowScope().get("stringArray"); assertEquals("1", expected[0]); assertEquals("2", expected[1]); }
public void testSetActionWithImplicitTypeConversion() throws Exception { SetModel setModel = new SetModel("testBean.stringArray", "intArray"); model.setOnStartActions(asList(setModel)); ViewStateModel state = new ViewStateModel("view"); model.setStates(asList(state)); Flow flow = getFlow(model); AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0); MockRequestContext context = new MockRequestContext(flow); context.getFlowScope().put("testBean", new TestBean()); context.getFlowScope().put("intArray", new int[] { 1, 2 }); action.execute(context); TestBean expected = (TestBean) context.getFlowScope().get("testBean"); assertEquals("1", expected.stringArray[0]); assertEquals("2", expected.stringArray[1]); }
public void testEvaluateActionWithResultType() throws Exception { EvaluateModel evaluateModel = new EvaluateModel("testBean.getIntegers()"); evaluateModel.setResult("flowScope.stringArray"); evaluateModel.setResultType("java.lang.String[]"); model.setOnStartActions(asList(evaluateModel)); model.setStates(asList(new ViewStateModel("view"))); Flow flow = getFlow(model); AnnotatedAction action = (AnnotatedAction) flow.getStartActionList().get(0); MockRequestContext context = new MockRequestContext(flow); context.getFlowScope().put("testBean", new TestBean()); action.execute(context); String[] expected = (String[]) context.getFlowScope().get("stringArray"); assertEquals("1", expected[0]); assertEquals("2", expected[1]); }