Which Java workflow framework can I use to bind it with a gui
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 g开发者_JAVA技巧iven 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.
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).
精彩评论