gpt4 book ai didi

spring - 在 Spring Webflow 中,我如何从失败的启动评估中过渡

转载 作者:行者123 更新时间:2023-12-02 05:11:13 25 4
gpt4 key购买 nike

我是 Spring Webflow 的新手,我正在尝试修改现有流程以检查用户授权以基于多个规则使用该流程。似乎没有一种明显的(广泛记录的)方法可以从评估过渡到某种结束条件。我理解的转换在开始时是不允许的。除了抛出异常之外,还有一种优雅的过渡方式吗?谢谢。

这是一个为编辑而创建的表单。我将授权检查代码添加到引用的方法中。我可以在此之前添加一个单独的评估来检查授权,但我仍然遇到转换问题。

<on-start>
<evaluate expression="solutionCreateEditFlowHelper.findDocumentForEdit(requestParameters.solutionId)" result="flowScope.documentForm"></evaluate>

>

最佳答案

你并不总是需要<on-start> .您可以将决策状态作为起始状态,并在该决策状态内部检查您的条件是否为真或假,如果为真则转换为您的 View 状态或其他状态,如果没有转换为带有 View 的结束状态。

假设您将流程称为 documentFlow.xml
在此文件中,您放置了如下决策状态:

<input name="solutionId" type="long" />

<decision-state id="isDocumentFormSet">
<on-entry>
<evaluate expression="solutionCreateEditFlowHelper.findDocumentForEdit(solutionId)" result="flowScope.documentForm"/>
</on-entry>
<if test="documentForm == null" then="chooseDocument" else="noDocument"/>
</decision-state>

<end-state id="noDocument"/>

<view-state id="chooseDocument">
....
</view-state>

关于spring - 在 Spring Webflow 中,我如何从失败的启动评估中过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15420456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com