【问题标题】:In Spring Webflow how do I transition from a failed on-start evaluate在 Spring Webflow 中,我如何从失败的启动评估过渡
【发布时间】:2013-03-15 07:07:50
【问题描述】:

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

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

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

>

【问题讨论】:

    标签: spring spring-webflow


    【解决方案1】:

    您并不总是需要&lt;on-start&gt;。您可以将决策状态作为起始状态,并在该决策状态中检查您的条件是真还是假,如果为真,则转换到您的视图状态或其他状态,如果不转换到带有视图的结束状态。

    假设您将流程称为 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>
    

    【讨论】:

      猜你喜欢
      • 2012-02-13
      • 2011-05-07
      • 1970-01-01
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 2018-03-31
      • 1970-01-01
      相关资源
      最近更新 更多