14 Replies Latest reply on Jun 23, 2014 7:21 AM by Mauricio Salatino

    Using multiple rules simultaneously in DRL

    Jeewani Lakshani Newbie

      Hi All,

      I have a small problem in splitting two rules. it is as follows.  when user selects table and laptop the process is not working. please assist me.

       

      rule "set as admin_task" ruleflow-group "requestrule"

      no-loop

      when

        $p : Capex( table == true ) || $p :Capex( chair == true )

      then

        modify($p) {

        setAdmin_item(true);

        }

      end

       

      rule "set as it_task" ruleflow-group "requestrule"

      no-loop

      when

        $p : Capex( computer_pc == true) || $p :Capex( laptop == true)

      then

        modify($p) {

        setIt_item(true);

        }

      end

       

      Untitled.jpg

        • 1. Re: Using multiple rules simultaneously in DRL
          micste Newbie

          Sevearal possibilities, dependent on what you like to achieve

          - don't use an xor Gateway but a parallel Gateway to have both human Tasks triggered

          - don't allow the choice to select table and laptop

          - define a salience for the two rules and don't execute the second rule if the first was fired

          - have a third rule that trades the choice "table and laptop"

          1 of 1 people found this helpful
          • 2. Re: Using multiple rules simultaneously in DRL
            Jeewani Lakshani Newbie

            Thank u for your response.  But if select "table and laptop" it belong to two separate task which are "Admin and IT". then how can i split it?

            and How we don't allow the choice to select table and laptop thru JBPM?

            if u can provide an example that is great.

             

            Thank u.

            • 3. Re: Re: Using multiple rules simultaneously in DRL
              micste Newbie

              See here für documentation of diverging (AND or parallel) gateways

              Chapter 6. Processes

              You are currently using an Xor Gateway which Triggers only one of the Manual Tasks, you may use a parallel Gateway.

              I don't know your application and how the data is generated. If you have an Input form, you need to implement in the form to not allow to select both values (table and laptop), if that would be the correct way.

              Maybe you should describe your application in more Detail to get a clou on what you like to do.

              • 4. Re: Re: Using multiple rules simultaneously in DRL
                Jeewani Lakshani Newbie

                my requirement is as follows, there are several items to select and request.

                IT Item = computer, laptop, mobile

                Admin item = table, chair etc.

                it comes thru a human task and the user can select any value computer, laptop,table, chair etc from the above items. based on the above items two separate user task comes.

                 

                eg: Admin Task and IT Task.

                and also user select simultaneously admin and IT item my rule doesn't work. if he select only the items belong to admin or IT then only the rule be excecute. i need to execute both user task parallel when user select both admin and IT items simultaneously.

                I defined a salience as follows.

                rule "set as admin_task" ruleflow-group "requestrule"

                no-loop

                when

                  $p : Capex( table == true ) || $p :Capex( chair == true )

                then

                  modify($p) {

                  setAdmin_item(true);

                  }

                end

                 

                rule "set as it_task" ruleflow-group "requestrule"

                no-loop

                salience -50

                when

                  $p : Capex( computer_pc == true) || $p :Capex( laptop == true)

                then

                  modify($p) {

                  setIt_item(true);

                  }

                end

                 

                and also if the user select only laptop and computer which come under IT item, it only should goes to the IT Task human user node. shouldn't go parallel with admin task

                • 5. Re: Re: Re: Using multiple rules simultaneously in DRL
                  micste Newbie

                  Sounds for me as if you don't Need an xor Gateway and no parallel Gateway but an Or (or inclusive) Gateway, see link to documentation in answer above, here an excerpt

                   

                  "OR or inclusive means that all outgoing connections whose condition evaluates to true are selected. Conditions are similar to the exclusive gateway, except that no priorities are taken into account. Note that you should make sure that at least one of the outgoing connections will evaluate to true at runtime because the engine will throw an exception at runtime if it cannot determine an outgoing connection."

                   

                  So the flow should trigger each human Task which condition ist true. Try to change the Gateway type in your jbpm process to "inclusive" from "xor".

                  • 6. Re: Re: Re: Using multiple rules simultaneously in DRL
                    Jeewani Lakshani Newbie

                    could u kindly send me the link to the documentation. i changed it to inclusive and it didnt work when i select both computer and table which belong to both IT and Admin task.

                     

                    Thank u.

                    • 8. Re: Using multiple rules simultaneously in DRL
                      Jeewani Lakshani Newbie

                      thank u very much. in my case i should use inclusive gateway so the condition for the connection of the split should same?

                      return KieFunctions.isTrue(Capex.getAdmin_item())==true;

                      • 9. Re: Using multiple rules simultaneously in DRL
                        micste Newbie

                        What's the variable Name of your Capex object in process?
                        Let's say the variable name is "cap".

                         

                        return (cap.getAdmin_item() == true);

                         

                        should work. I have no experiences using KieFunctions.isTrue, but looks correct if the variable name is correct.

                        • 10. Re: Using multiple rules simultaneously in DRL
                          Jeewani Lakshani Newbie

                          i tried it. but it doesn't work and got the following error.

                           

                          12:11:22,958 WARN  [com.arjuna.ats.arjuna] (http--127.0.0.1-8080-5) ARJUNA012127: TwoPhaseCoordinator.afterCompletion - returned failure for SynchronizationImple< 0:ffffc0a8ff29:4fc052ef:53a12cd1:cfb, org.drools.persistence.jta.JtaTransactionSynchronizationAdapter@7c09ca >

                          12:11:56,023 INFO  [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (http--127.0.0.1-8080-6) KieModule was added:MemoryKieModule[ ReleaseId=org.jbpm:inclusive:1.0]

                          12:12:32,351 WARN  [org.jbpm.services.task.persistence.TaskTransactionInterceptor] (http--127.0.0.1-8080-2) Could not commit session: java.lang.IllegalArgumentException: Named query not found: getAllTasksEvents

                              at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:636) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

                              at org.jbpm.services.task.persistence.JPATaskPersistenceContext.queryWithParametersInTransaction(JPATaskPersistenceContext.java:371) [jbpm-human-task-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.audit.GetAuditEventsCommand.execute(GetAuditEventsCommand.java:33) [jbpm-human-task-audit-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.audit.GetAuditEventsCommand.execute(GetAuditEventsCommand.java:16) [jbpm-human-task-audit-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.commands.TaskCommandExecutorImpl$SelfExecutionCommandService.execute(TaskCommandExecutorImpl.java:65) [jbpm-human-task-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.persistence.TaskTransactionInterceptor.execute(TaskTransactionInterceptor.java:53) [jbpm-human-task-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.commands.TaskCommandExecutorImpl.execute(TaskCommandExecutorImpl.java:40) [jbpm-human-task-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.services.task.impl.command.CommandBasedTaskService.execute(CommandBasedTaskService.java:128) [jbpm-human-task-core-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.console.ng.ht.backend.server.TaskServiceEntryPointImpl.getAllTaskEvents(TaskServiceEntryPointImpl.java:528) [jbpm-console-ng-human-tasks-backend-6.0.1.Final.jar:6.0.1.Final]

                              at org.jbpm.console.ng.ht.backend.server.TaskServiceEntryPointImpl$Proxy$_$$_WeldClientProxy.getAllTaskEvents(TaskServiceEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-human-tasks-backend-6.0.1.Final.jar:6.0.1.Final]

                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_11]

                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_11]

                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_11]

                              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_11]

                              at org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:48) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:22) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:499) [errai-weld-integration-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:284) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:92) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:109) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:140) [errai-bus-2.4.3.Final.jar:2.4.3.Final]

                              at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.2.1.Final.jar:3.2.1.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.2.1.Final.jar:3.2.1.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) [jbpm-designer-backend-6.0.1.Final.jar:6.0.1.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) [uberfire-security-server-0.3.1.Final.jar:0.3.1.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.13.Final.jar:]

                              at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:416) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

                              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

                              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]

                          • 12. Re: Using multiple rules simultaneously in DRL
                            Jeewani Lakshani Newbie

                            problem is, when i define the inclusive gateway without a business rule task it works.  but when i define it with a business rule task it doesn't work.

                            rule "set as admin_item" ruleflow-group "ruletask"

                            no-loop

                            when $p : Person( table == true ) || $p :Person( chair == true )

                            then

                            modify($p) { setAdmin_item(true); }

                            end

                            rule "set as it_item" ruleflow-group "ruletask" no-loop when $p : Person( computer== true ) || $p :Person( laptop== true ) then modify($p) { setIt_item(true); } end

                             

                            My variable is "Person" and the conditions are, return (Person.getIt_item() == true); and return (Person.getAdmin_item() == true);

                            but i get following error now;

                            ERROR [org.jbpm.formModeler.components.editor.WysiwygMenuFormatter] (http-jboss-jbpm.lolc.com/192.168.255.150:8080-7) Error: : java.lang.NullPointerException

                                at org.jbpm.formModeler.components.editor.WysiwygFormEditor.getCurrentForm(WysiwygFormEditor.java:176) [jbpm-form-modeler-form-editor-6.0.1.Final.jar:]

                                at org.jbpm.formModeler.components.editor.WysiwygFormEditor$Proxy$_$$_WeldClientProxy.getCurrentForm(WysiwygFormEditor$Proxy$_$$_WeldClientProxy.java) [jbpm-form-modeler-form-editor-6.0.1.Final.jar:]

                                ruletask.jpg

                            • 13. Re: Using multiple rules simultaneously in DRL
                              Jeewani Lakshani Newbie

                              Appreciate very much someone can resolve my problem stated above

                              • 14. Re: Using multiple rules simultaneously in DRL
                                Mauricio Salatino Master

                                This question is already marked as answered. Please create another question and states the exact problem that you are having. Make sure that you share the full stack trace, so we can help you better.

                                Cheers