org.springframework.webflow.engine.Flow.end()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.springframework.webflow.engine.Flow.end()方法的一些代码示例,展示了Flow.end()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.end()方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:end

Flow.end介绍

[英]Inform this flow definition that an execution session of itself has ended. As a result, the flow will do the following:

  1. Execute all registered end actions ( #getEndActionList()).
  2. Map data available in the flow execution control context into provided output map using a registered output mapper ( #setOutputMapper(Mapper)).
    [中]通知此流定义自身的执行会话已结束。因此,流将执行以下操作:
    1.执行所有已注册的结束操作(#getEndActionList())。
    1.使用注册的输出映射器(#setOutputMapper(映射器))将流执行控制上下文中可用的数据映射到提供的输出映射中。

代码示例

代码示例来源:origin: org.springframework.webflow/spring-webflow

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));
  }
}

代码示例来源:origin: org.springframework.webflow/spring-webflow

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));
  }
}

代码示例来源:origin: org.springframework/spring-webflow

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;
}

代码示例来源:origin: org.springframework/spring-webflow

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;
}

代码示例来源:origin: spring-projects/spring-webflow

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));
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

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));
  }
}

代码示例来源:origin: spring-projects/spring-webflow

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));
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

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));
  }
}

代码示例来源:origin: spring-projects/spring-webflow

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());
}

代码示例来源:origin: spring-projects/spring-webflow

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"));
}

相关文章