/** * Factory method that creates a new subflow state, a state where a parent flow spawns another flow as a subflow. * This method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the * subflow state implementation as well as the state assembly. * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param subflow the subflow definition (required) * @param attributeMapper the subflow input and output attribute mapper; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be * null * @return the fully initialized subflow state instance */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Expression subflow, SubflowAttributeMapper attributeMapper, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap<?> attributes) { SubflowState subflowState = new SubflowState(flow, id, subflow); if (attributeMapper != null) { subflowState.setAttributeMapper(attributeMapper); } configureCommonProperties(subflowState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return subflowState; }
/** * Factory method that creates a new subflow state, a state where a parent flow spawns another flow as a subflow. * This method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the * subflow state implementation as well as the state assembly. * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param subflow the subflow definition (required) * @param attributeMapper the subflow input and output attribute mapper; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be * null * @return the fully initialized subflow state instance */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Expression subflow, SubflowAttributeMapper attributeMapper, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes) { SubflowState subflowState = new SubflowState(flow, id, subflow); if (attributeMapper != null) { subflowState.setAttributeMapper(attributeMapper); } configureCommonProperties(subflowState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return subflowState; }
/** * Factory method that creates a new subflow state, a state where a parent flow spawns another flow as a subflow. * This method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the * subflow state implementation as well as the state assembly. * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param subflow the subflow definition (required) * @param attributeMapper the subflow input and output attribute mapper; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be * null * @return the fully initialized subflow state instance * @throws FlowArtifactLookupException an exception occured creating the state */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes) throws FlowArtifactLookupException { SubflowState subflowState = new SubflowState(flow, id, subflow); if (attributeMapper != null) { subflowState.setAttributeMapper(attributeMapper); } configureCommonProperties(subflowState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return subflowState; }
/** * Factory method that creates a new subflow state, a state where a parent flow spawns another flow as a subflow. * This method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the * subflow state implementation as well as the state assembly. * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param subflow the subflow definition (required) * @param attributeMapper the subflow input and output attribute mapper; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be * null * @return the fully initialized subflow state instance */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Expression subflow, SubflowAttributeMapper attributeMapper, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap<?> attributes) { SubflowState subflowState = new SubflowState(flow, id, subflow); if (attributeMapper != null) { subflowState.setAttributeMapper(attributeMapper); } configureCommonProperties(subflowState, entryActions, transitions, exceptionHandlers, exitActions, attributes); return subflowState; }
/** * Create subflow state. * * @param flow the flow * @param id the id * @param subflow the subflow * @param entryAction the entry action * @return the subflow state */ protected SubflowState createSubflowState(final Flow flow, final String id, final String subflow, final Action entryAction) { final SubflowState state = new SubflowState(flow, id, new BasicSubflowExpression(subflow)); if (entryAction != null) { state.getEntryActionList().add(entryAction); } return state; }
/** * Create subflow state. * * @param flow the flow * @param id the id * @param subflow the subflow * @param entryAction the entry action * @return the subflow state */ protected SubflowState createSubflowState(final Flow flow, final String id, final String subflow, final Action entryAction) { final SubflowState state = new SubflowState(flow, id, new BasicSubflowExpression(subflow, this.loginFlowDefinitionRegistry)); if (entryAction != null) { state.getEntryActionList().add(entryAction); } return state; }
@Override public SubflowState createSubflowState(final Flow flow, final String id, final String subflow, final Action entryAction) { if (containsFlowState(flow, id)) { LOGGER.trace("Flow [{}] already contains a definition for state id [{}]", flow.getId(), id); return getTransitionableState(flow, id, SubflowState.class); } val state = new SubflowState(flow, id, new BasicSubflowExpression(subflow, this.loginFlowDefinitionRegistry)); if (entryAction != null) { state.getEntryActionList().add(entryAction); } return state; }
public void setUp() { parentFlow = new Flow("parent"); subflow = new Flow("child"); subflowState = new SubflowState(parentFlow, "subflow", new AbstractGetValueExpression() { public Object getValue(Object context) throws EvaluationException { return subflow; } }); context = new MockRequestControlContext(parentFlow); context.setCurrentState(subflowState); }
public void testEnterEndStateTerminateFlowSession() { final Flow subflow = new Flow("mySubflow"); EndState state = new EndState(subflow, "end"); MockFlowSession session = new MockFlowSession(subflow); Flow parent = new Flow("parent"); SubflowState subflowState = new SubflowState(parent, "subflow", new AbstractGetValueExpression() { public Object getValue(Object context) throws EvaluationException { return subflow; } }); subflowState.getTransitionSet().add(new Transition(on("end"), to("end"))); new EndState(parent, "end"); MockFlowSession parentSession = new MockFlowSession(parent); parentSession.setState(subflowState); session.setParent(parentSession); MockRequestControlContext context = new MockRequestControlContext(new MockFlowExecutionContext(session)); state.enter(context); assertFalse("Active", context.getFlowExecutionContext().isActive()); }