How do I represent concurrent actions in jBPM, any of which can end a process?
An example: a permit must be examined by two lawyers and one engineer. If any of those three reject it, the process enters a "rejected" end state. If all three grant the permit, it enters a "granted" end state. All three examiners may examine simultaneously, or in any order.
Once one engineer has granted it, it shouldn't be available to be examined by an engineer; once two lawyers have examined it, it shouldn't be available to lawyers; once one engineer a开发者_Go百科nd two lawyers have examined it should go to the granted end state.
My initial thinking is that either I have a overly complicated state transition diagram, with "the same" intermediate states multiply repeated, or I carry (external) state with the process { bool rejected; int engineerSignoffId; int lawyer1SignoffId; int lawyer2SignoffId}.
Or something like this? If so, how does the engineer's rejection terminate the subprocess that is in "Lawyers"?
START->FORK->Engineer->Granted?---------------->Y->JOIN-->Granted
|->Lawyers-->Granted?->by 2 lawyers?->Y---^
^ |
|--------------------------N
What's the canonical jBPM answer to this? Can you point me to examples or documentation of such answers?
Thanks.
Well, I'm not sure if I get your use case properly but let me try.
The rejected end states are easy - you can have many of them or one, it doesn't matter. If the process hits an end state, the process ends. Rejected. End of story: http://docs.jboss.com/jbpm/v4/userguide/html_single/#end
Now, make three human tasks for acceptance. One should be assigned to engineer candidate group and two others to lawyers candidate group. Once a person takes a task (i.e. assigns to himself) it can't be taken by anybody else. http://docs.jboss.com/jbpm/v4/userguide/html_single/#task
All the human tasks should be then merged at the end with a node waiting for all concurrent paths in order to continue. I.e.: join with correct multiplicity: http://docs.jboss.com/jbpm/v4/userguide/html_single/#decision
I'm not sure which JBPM version are you using but this of course is also possible in BPMN 2.0, in case you use JBPM 5.
精彩评论