我可以使用哪个 Java 工作流框架将其与 gui 绑定
上下文
我必须创建一个创作工作流程(签入、签出、验证...)。
对于某些状态转换,用户必须填写报告。当用户将对象O的状态从状态S1改变到状态S2时,他必须填写报告。
- 用户可以取消报告,O保持在状态S1。
- 用户可以关闭浏览器,O保持在状态S1。
- 如果他验证了报告,O 就会进入状态 S2。
我正在尝试找到一个可以实现这些约束的框架。
jBPM / Drools
我可以通过 S1 和 S2 之间的“人工任务”来实现 1 和 3,但这对于简单的报告来说有点过大了。为了实现 1,我必须在 S1 和“人工任务”之间建立双向关系。 我无法做到第 2 点:如果用户关闭浏览器,O 仍处于“人工任务”状态。
另一种方式?
另一种方法是使用外部文件。该文件将给出要显示的给定转换S1->S2。
还有别的办法吗?您认为最好的用例是什么?
感谢您的帮助。
Context
I have to create an authoring workflow (checkin, checkout, validation...).
For some states transitions the user has to fill a report. When the user changes the state of an object O from the state S1 to the state S2 he has to fill a report.
- The user can cancel the report, O remains in the state S1.
- The user can close the browser, O remains in the state S1.
- If he validates the report, O goes to the state S2.
I'm trying to find a framework where I can implement these contraints.
jBPM / Drools
I can implement 1 and 3 with a "Human Task" between S1 and S2 but it's a bit overkill for a simple report. To implement 1, I must do a bidirectionnal relation between S1 and the "Human Task".
I cannot do point 2: if the user closes the browser, O remains in the state "Human Task".
Another Way ?
Another way would be to have an external file. This file would give for a given transition S1->S2 which report to display.
Is there another way ? And what is in your opinion the best use case ?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会这样做:
将自定义布尔属性 commitState (默认为 true)添加到进程中的所有节点。
所以有3个节点:
S1 - commitState=true,
报告 - commitState=false,
S2 - commitState=true
当执行从之前的任何内容继续到 S1 时,引擎将状态提交到数据库并向用户显示 S1 中的任何内容。然后用户执行某操作,执行继续到节点报告,向用户显示“SubmitReport”屏幕,但数据库事务仍未提交。
当用户此时关闭浏览器时,最终会出现会话超时,抛出异常,并在db状态下回滚到S1。
当用户取消报告时,我们也可以抛出异常并回滚到 S1,但我更喜欢通过流程图明确此类转换,并且只是进行此转换。
当用户提交报告时,我们进入 S2,并且状态被提交。
这要求数据库事务可以在向用户显示屏幕之间保持 - 例如在 StatefulBean 中(当从 StatefulBean 使用 jbpm 3 时存在一些错误,我不知道在新版本的 jbpm 中是否可以这样做这)。
I'd do it that way:
Add custom boolean attribute commitState (defaults to true) to all nodes in process.
So there are 3 nodes:
S1 - with commitState=true,
Report - with commitState=false,
S2 - with commitState=true
When execution proceeds to S1 from whatever was before, engine commits the state to the db and shows user whatever is in S1. Then user does sth, and execution proceeds to node Report, shows user the "SubmitReport" screen, but db transaction is still not commited.
When user closes the browser at this point, eventually there is session timeout, exception is thrown, and in the db state is rolled back to S1.
When user cancels report, we can also throw exception and be rolled back to S1, but I prefer such transitions to be made explicit by process graph, and just to take this transition.
When user submits report, we proceed to S2, and state is commited.
This requires, that db transaction can be hold between displaying screens to user - for example in StatefulBean (there was some bug in jbpm 3 when it was used from StatefulBean, I don't know if it is possible in new versions of jbpm to do this).