6 Replies Latest reply on Mar 4, 2013 12:23 AM by Toshiya Kobayashi

    Prevent duplication in XOR gateway

    Erik Pragt Newbie

      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