3 Replies Latest reply on Jan 12, 2007 3:49 PM by Barry

    n-of-m join with jPDL

    Barry Newbie

      Is it possible to implement the n-of-m join pattern with pure jPDL? I am creating my process definitions with the eclipse process designer and need to have an n-of-m join.

      Regards,
      Barry

        • 1. Re: n-of-m join with jPDL
          Barry Newbie

          I did some more searching and see that n out of m joins is not directly supported in jpdl yet. However, in the post below, it is mentioned that it is possible with scripting. Can someone please provide an example script to implement n-out-of-m joins?

          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=93162&postdays=0&postorder=asc&start=10

          Regards,
          Barry

          • 2. Re: n-of-m join with jPDL
            Barry Newbie

            Here is a join with beanshell that I just created and it looks like it worked. Please let me know if you see any problems with this script.




            count = 0;
            if(executionContext.getContextInstance().hasVariable("count", token))
            {
            count = executionContext.getContextInstance().getVariable("count", token);
            }
            count = count + 1;
            if(count == 2)
            {
            executionContext.leaveNode();
            }
            else if(count > 2)
            {
            token.end();
            }
            executionContext.getContextInstance().setVariable("count",count,token);





            Regards,
            Barry

            • 3. Re: n-of-m join with jPDL
              Barry Newbie

              Here is the script ....

              <join name="join1">
               <event type="node-enter">
               <script>
               count = 0;
               if(executionContext.getContextInstance().hasVariable("count", token))
               {
               count = executionContext.getContextInstance().getVariable("count", token);
               }
               count = count + 1;
               if(count == 2)
               {
               executionContext.leaveNode();
               }
               else if(count > 2)
               {
               token.end();
               }
               executionContext.getContextInstance().setVariable("count",count,token);
               </script>
               </event>
               <transition name="" to="Some task"></transition>
               </join>