6 Replies Latest reply on Jan 31, 2012 10:15 AM by Mahi M

    Solution needed

    Mahi M Newbie

                      Hi Everyone,

                                                    Please provide me solutions for the following doubts.

       

      1. How to set the variables in the rule task node(drl file) and carry the same variables to further nodes.

       

      2.  is it posssible to fire the drl file or rules  by sending the drl file name as a parameter to a node as on-entry condition.

        • 1. Re: Solution needed
          Maciej Swiderski Master

          1. How to set the variables in the rule task node(drl file) and carry the same variables to further nodes.

          you could try something like this:

           

          when
               $process : WorkflowProcessInstance()
          
          then
               $process.setVariable("name", "value")
          

           

           

          2.  is it posssible to fire the drl file or rules  by sending the drl file name as a parameter to a node as on-entry condition.

          Why would you like to do that? In my opinion for such purpose you have bunsiness rule task

           

          HTH

          • 2. Re: Solution needed
            Mahi M Newbie

            Hi Maciej thanks for replying.

             

                       i am convinced by the first answer thanks for that.

             

            For my second question,, I have a scenario like, when reaching a node certain rule should only be fired.. Now what is happening is, whenever i use ksession.fireAllRules() all the rules are getting triggered which are loaded in the knowledge base, so i want to fire specific rules in a drl file or  entire drl file by mentioning its name in a human task node.

             

                  Hope i made my doubt clear to you now.

             

             

            Please do reply

             

            Thanks

            Mahesh

            • 3. Re: Solution needed
              Maciej Swiderski Master

              For selecting particular rule(s) while invoking fireAllRules you could use implementation of AgendaFilter.

               

              A good out of the box implementation is org.drools.base.RuleNameEqualsAgendaFilter, that accepts name of the rule to execute as constructor argument.

               

              HTH

              • 4. Re: Solution needed
                Mahi M Newbie

                Thanks for your valuable solutions.

                 

                                I got it through your replies.

                 

                Thanks

                Mahesh

                • 5. Re: Solution needed
                  Maciej Swiderski Master

                  Goodie, please mark question as answered if you feel it provided you with enough information.

                   

                  Cheers

                  • 6. Re: Solution needed
                    Mahi M Newbie

                    Hi Maciej ,

                     

                           I have a requirement like, I need to pass a map to the drl.

                     

                    I have seen examples, wherein we are taking the variables of class by forming the object.

                     

                    Now I need to get and put the values from a map.

                     

                    Please provide me one example.

                     

                    Thanks