Discussion:
[jboss-user] [jBPM] - Prevent duplication in XOR gateway
Erik Pragt
2012-07-30 14:51:40 UTC
Permalink
Erik Pragt [https://community.jboss.org/people/bodiam] created the discussion

"Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751003#751003

--------------------------------------------------------------
Hi all,

I'm just getting started with jBPM, and I have a small question about XOR gateways. At the moment, our nodes have two endpoints, and the code for one endpoint looks like this:

switch(result) {
          case OK:
                    return true; 
          default:
                   return false;
}
 


While for the other endpoint (pointing to an 'end event'), it looks like this:


switch(result) {
          case OK:
                    return false; 
          default:
                   return true;
}
 
 


So in the other constraint it's the other way around. To me, this looks like a bit of duplication, and in this example it's not too bad, but in more complex examples, it's trickier. So I was wondering, isn't there a better way to do this? Isn't it possible to create one piece of code, and let true go to one sequence flow, and false to the other, without having the need to duplicate the code? Is something like this possible??

Thanks for the help,

Kind regards,

Erik
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751003#751003]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Esteban Aliverti
2012-07-30 15:24:18 UTC
Permalink
Esteban Aliverti [https://community.jboss.org/people/eaa] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751014#751014

--------------------------------------------------------------
Which process editor are you using?
One solution for this particular situation (having only 2 outgoing sequence flows) you could use a default sequence flow. So, in one of the sequence flows you write your logic and you configure the other one as a default sequence flow.
Unfortunately this is not yet supported in the Web Process Editor: https://issues.jboss.org/browse/JBPM-3704 https://issues.jboss.org/browse/JBPM-3704
AFAIK, jBPM5 eclipse plugin should support this feature.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751014#751014]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Erik Pragt
2012-07-31 07:52:22 UTC
Permalink
Erik Pragt [https://community.jboss.org/people/bodiam] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751128#751128

--------------------------------------------------------------
Hi Esteban,

Thanks for the help! I'm using the Eclipse jBPM5 editor, but I cannot find a way to set the default sequence flow. Google doesn't provide much help here.

Thanks for the help so far!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751128#751128]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Esteban Aliverti
2012-07-31 08:45:51 UTC
Permalink
Esteban Aliverti [https://community.jboss.org/people/eaa] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751137#751137

--------------------------------------------------------------
I was re-thinking this and maybe what you can do is to use a low priority in your 'default' flow and as a confition just add 'return true == true;'. The flow containing the real logic must be always evaluated first, so it must have a higher priority.
I've checked the Eclips plugin and what you have there is a 'Always true' checkbox that creates the condition 'eval(true)'. You still have to use a low priority if you want to use this as a 'default' flow.

Hope it helps.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751137#751137]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Erik Pragt
2012-07-31 10:44:25 UTC
Permalink
Erik Pragt [https://community.jboss.org/people/bodiam] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751175#751175

--------------------------------------------------------------
I could also do that, but does this mean there is not really a way to use a 'real' default flow? And what is a higher priority? Is 1 the highest? Or is 1 low, and is (say) 1000 high?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751175#751175]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Esteban Aliverti
2012-07-31 13:28:39 UTC
Permalink
Esteban Aliverti [https://community.jboss.org/people/eaa] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/751223#751223

--------------------------------------------------------------
Higher number means higher priority.
I'm not sure about the new BPMN2 eclipse editor, but this feature seems to be missing in jBPM5 eclipse plugin (I wouldn't expect to be implemented any time soon) and jBPM Web Designer (there is a reported issue though: https://issues.jboss.org/browse/JBPM-3704 https://issues.jboss.org/browse/JBPM-3704).
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751223#751223]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Toshiya Kobayashi
2013-03-04 05:23:41 UTC
Permalink
Toshiya Kobayashi [https://community.jboss.org/people/tkobayashi] created the discussion

"Re: Prevent duplication in XOR gateway"

To view the discussion, visit: https://community.jboss.org/message/800506#800506

--------------------------------------------------------------
Hi,  a small correction:

Lower number means higher priority. So setting a very large number for default flow would be fine.

http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e1976 http://docs.jboss.org/jbpm/v5.4/userguide/ch.core-basics.html#d0e1976
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/800506#800506]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...