void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = flowSessions.isEmpty(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); status = FlowExecutionStatus.ENDED; } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
public void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public FlowSession endActiveFlowSession(MutableAttributeMap output) throws IllegalStateException { FlowSession session = getFlowExecutionContext().getActiveSession(); getExecutionListeners().fireSessionEnding(this, session, output); getActiveFlowInternal().end(this, output); if (logger.isDebugEnabled()) { logger.debug("Ending active session " + session + "; exposed session output is " + output); } session = flowExecution.endActiveFlowSession(); getExecutionListeners().fireSessionEnded(this, session, output); return session; }
public FlowSession endActiveFlowSession(MutableAttributeMap output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, output); endingSession.setStatus(FlowSessionStatus.ENDED); getMockFlowExecutionContext().setActiveSession(null); return endingSession; }
void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = flowSessions.isEmpty(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); status = FlowExecutionStatus.ENDED; } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
void endActiveFlowSession(String outcome, MutableAttributeMap output, RequestControlContext context) { FlowSessionImpl session = getActiveSessionInternal(); listeners.fireSessionEnding(context, session, outcome, output); session.getFlow().end(context, outcome, output); flowSessions.removeLast(); boolean executionEnded = hasEnded(); if (executionEnded) { // set the root flow execution outcome for external clients to use this.outcome = new FlowExecutionOutcome(outcome, output); } listeners.fireSessionEnded(context, session, outcome, output); if (!executionEnded) { // restore any variables that may have transient references getActiveSessionInternal().getFlow().restoreVariables(context); // treat the outcome as an event against the current state of the new active flow context.handleEvent(new Event(session.getState(), outcome, output)); } }
public void endActiveFlowSession(String outcome, MutableAttributeMap<Object> output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public void endActiveFlowSession(String outcome, MutableAttributeMap output) throws IllegalStateException { MockFlowSession endingSession = getMockFlowExecutionContext().getMockActiveSession(); endingSession.getDefinitionInternal().end(this, outcome, output); getMockFlowExecutionContext().setActiveSession(endingSession.getParent()); if (!getMockFlowExecutionContext().hasEnded()) { handleEvent(new Event(endingSession.getState(), outcome, output)); } }
public void testEnd() { TestAction action = new TestAction(); flow.getEndActionList().add(action); MockRequestControlContext context = new MockRequestControlContext(flow); LocalAttributeMap<Object> sessionOutput = new LocalAttributeMap<>(); flow.end(context, "finish", sessionOutput); assertEquals(1, action.getExecutionCount()); }
public void testEndWithOutputMapper() { DefaultMapper attributeMapper = new DefaultMapper(); ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser()); Expression x = parser.parseExpression("flowScope.attr", new FluentParserContext().evaluate(RequestContext.class)); Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class)); attributeMapper.addMapping(new DefaultMapping(x, y)); flow.setOutputMapper(attributeMapper); MockRequestControlContext context = new MockRequestControlContext(flow); context.getFlowScope().put("attr", "foo"); LocalAttributeMap<Object> sessionOutput = new LocalAttributeMap<>(); flow.end(context, "finish", sessionOutput); assertEquals("foo", sessionOutput.get("attr")); }