/** * Factory method that creates a new end state, a state where an executing flow session terminates. This method is * an atomic operation that returns a fully initialized state. It encapsulates the selection of the end 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 finalResponseAction the state response renderer; may be null * @param outputMapper the state output mapper; may be null * @param exceptionHandlers any exception handlers; 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 createEndState(String id, Flow flow, Action[] entryActions, Action finalResponseAction, Mapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap<?> attributes) { EndState endState = new EndState(flow, id); if (finalResponseAction != null) { endState.setFinalResponseAction(finalResponseAction); } if (outputMapper != null) { endState.setOutputMapper(outputMapper); } configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; }
/** * Factory method that creates a new end state, a state where an executing flow session terminates. This method is * an atomic operation that returns a fully initialized state. It encapsulates the selection of the end 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 finalResponseAction the state response renderer; may be null * @param outputMapper the state output mapper; may be null * @param exceptionHandlers any exception handlers; 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 createEndState(String id, Flow flow, Action[] entryActions, Action finalResponseAction, Mapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap<?> attributes) { EndState endState = new EndState(flow, id); if (finalResponseAction != null) { endState.setFinalResponseAction(finalResponseAction); } if (outputMapper != null) { endState.setOutputMapper(outputMapper); } configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; }
/** * Factory method that creates a new end state, a state where an executing flow session terminates. This method is * an atomic operation that returns a fully initialized state. It encapsulates the selection of the end 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 finalResponseAction the state response renderer; may be null * @param outputMapper the state output mapper; may be null * @param exceptionHandlers any exception handlers; 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 createEndState(String id, Flow flow, Action[] entryActions, Action finalResponseAction, Mapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap attributes) { EndState endState = new EndState(flow, id); if (finalResponseAction != null) { endState.setFinalResponseAction(finalResponseAction); } if (outputMapper != null) { endState.setOutputMapper(outputMapper); } configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; }
/** * Factory method that creates a new end state, a state where an executing flow session terminates. This method is * an atomic operation that returns a fully initialized state. It encapsulates the selection of the end 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 viewSelector the state confirmation view selector strategy; may be null * @param outputMapper the state output mapper; may be null * @param exceptionHandlers any exception handlers; 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 createEndState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, AttributeMapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap attributes) throws FlowArtifactLookupException { EndState endState = new EndState(flow, id); if (viewSelector != null) { endState.setViewSelector(viewSelector); } if (outputMapper != null) { endState.setOutputMapper(outputMapper); } configureCommonProperties(endState, entryActions, exceptionHandlers, attributes); return endState; }
public void testEnterEndStateWithOutputMapper() { Flow flow = new Flow("myFlow") { @SuppressWarnings("unused") public void end(RequestControlContext context, MutableAttributeMap<Object> output) throws FlowExecutionException { assertEquals("foo", output.get("y")); } }; EndState state = new EndState(flow, "end"); DefaultMapper mapper = new DefaultMapper(); ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser()); Expression x = parser.parseExpression("flowScope.x", new FluentParserContext().evaluate(RequestContext.class)); Expression y = parser.parseExpression("y", new FluentParserContext().evaluate(MutableAttributeMap.class)); mapper.addMapping(new DefaultMapping(x, y)); state.setOutputMapper(mapper); MockRequestControlContext context = new MockRequestControlContext(flow); context.getFlowScope().put("x", "foo"); state.enter(context); }