2 Replies Latest reply on Sep 29, 2011 8:50 AM by jovijesc

    Business Rules using Fluent API - JBPM 5

    jovijesc

      Business Rules using Fluent API - JBPM 5

      Hello people.

      I wonder how to create business rules or rules of navigation using the Fluent API.
      I found this code below:

      Split split = new Split ();
             
      split.setName ("split");
             
      split.setMetaData ("x", 1);
             
      split.setMetaData ("y", 2);
             
      split.setMetaData ("width", 3);
             
      split.setMetaData ("height", 4);
             
      split.setType (Split.TYPE_XOR);
             
      Connection connection = new ConnectionImpl (split, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE);
             
      ConstraintImpl Constraint constraint = new ();
             
      constraint.setName ("constraint1 ><&&");
             
      constraint.setPriority (1);
             
      constraint.setDialect ("dialect1");
             
      constraint.setType ("type1");
             
      constraint.setConstraint ("constraint-text1");
             
      split.setConstraint (connection, constraint);
             
      connection = new ConnectionImpl (split, Node.CONNECTION_DEFAULT_TYPE, ruleSetNode, Node.CONNECTION_DEFAULT_TYPE);
             
      ConstraintImpl constraint = new ();
             
      constraint.setName ("constraint2");
             
      constraint.setPriority (2);
             
      constraint.setDialect ("dialect2");
             
      constraint.setType ("type2");
             
      constraint.setConstraint ("constraint-text2");
             
      split.setConstraint (connection, constraint);
             
      process.addNode (split);
             
      new ConnectionImpl (startNode, Node.CONNECTION_DEFAULT_TYPE, split, Node.CONNECTION_DEFAULT_TYPE);

      How could I set an expression? If age> 18 go to XXXX activity, if it goes to another activity.!

      I can not find how to set the terms of navigation.

      Sorry for English, I used google translate!

        • 1. Re: Business Rules using Fluent API - JBPM 5
          tsurdilovic

          Hi, the fluent API should still work, but has not been updated to the latest features - so not sure I would recommend using it at this point. There is a small section in the docs on it: http://docs.jboss.org/jbpm/v5.1/userguide/ch05.html#d0e779.

           

          Hope this helps.

          • 2. Re: Business Rules using Fluent API - JBPM 5
            jovijesc

            Hi Thanks for the reply. I had seen this link. I'm having trouble setting my rules ofnavigation through the Fluent API.

             

            For example: I think this passage is what I define it, but do not know how the syntax for this:

             

            ConstraintImpl restriction = new ();

                     constraint.setName ("constraint2");

                     constraint.setPriority (2);

                     constraint.setDialect ("dialect2");

                     constraint.setType ("type2");

             

                    / / HERE WHERE SHOULD DEFINE RULE

                     constraint.setConstraint ("restriction text2");

             

             

                     split.setConstraint (restricted connection);

             

            Thank you.