java - Spring Webflow : How to change the destination of a transition in a child flow

标签 java spring spring-webflow

我正在使用 Spring Webflow 2,并且有以下父流程:

<flow ...>
  ...
  <view-state id="show-task">
    <transition on="approve" to="search">
      <!-- lots of things -->
    </transition>
    <!-- several other transitions and other instructions -->
  </view-state>
</flow>

我有一个子流程,在其中,我想将上面看到的 "search" 替换为 "execute" 而不修改父流程(除非它是为了使其更通用)。 “很多事情”仍然必须执行,而不需要复制/粘贴到子流程。

如何做到这一点?

谢谢!

最佳答案

我认为你做不到。

我看到几个选项:

  • 您将父流程更改为具有 boolean 输入,您可以在决策状态中检查该输入的值,以决定是否需要转到“搜索”(在本例中包括空值,这样您就不需要不必更改您 child 的代码)或“执行”作为您批准转换的结果。

  • 更改您的逻辑,以便父级在“批准”时进入最终状态,并在需要时使用输出,以便子级可以在此最终状态上转换并执行其必须执行的操作。

  • 您在子流程中创建一个新的转换,并使用不同的“目标”状态复制其中的“很多内容”。

我更喜欢#1,我认为这是正确的选择。家长应该了解其转变可能产生的不同结果。或者 #2 parent 需要完成这些事情,以便 child 决定还需要做什么。

关于java - Spring Webflow : How to change the destination of a transition in a child flow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19222666/

相关文章:

java - 尝试使用 java 中的变量将对象设置为 true 或 false

JAVA加载页面后获取url内容

java - Spring 的 @Retryable 在运行 JUnit 测试时不起作用

spring - Spring Integration 定义的基于 Java 的容器配置

java - 使用 Spring Data Hadoop 类路径资源的 IOException

具有绝对路径的 Java FileNotFoundException - 无法读取或执行,但文件存在

java - SingleConnectionDataSource 连接在大约 40 分钟不活动后关闭

spring - 如何在异常时设置文字字符串 flowScope 值?

spring - 使用 Spring 3 在 REST 中登录/注销

java - 如何在 Spring WebFlow2 中检查日期格式