Drools 6.2.0 workbench edit jbpm variable from drl rule

604 views Asked by At

I try to put my process variable into the business rule task and to change this variable in this task, but the value remains the same. What am I doing wrong? Process is developed in kie workbench, without using eclipse.

My variables initialized in the script task before the rule fired like

kcontext.setVariable("triggers",new   com.embeddedwireless.healthdesk.InitialTriggers(false,false,false,false));
kcontext.setVariable("answers",new   com.embeddedwireless.healthdesk.InitialAnswers("not","not","not","not","not","not","not","not","not","not","not","not","not","not","not","not","not","twice","not"));

The rule looks like

   package com.embeddedwireless.healthdesk;

    import com.embeddedwireless.healthdesk.InitialAnswers
    import com.embeddedwireless.healthdesk.InitialTriggers



rule "BehavioralHealth" ruleflow-group "InitialCheck"
no-loop
lock-on-active     
salience 1
        when
            answers : InitialAnswers( q9a in ( "always", "most", "some" ) || q10a in ( "always", "most", "some" ) || q12a in ( "always", "most", "some" ) )
        triggers_out : InitialTriggers()
     then
        System.out.println("Beh!!!!");
            triggers_out.setBehavioral( true );
           update( triggers_out );

end

rule "OccupationalRule" ruleflow-group "InitialCheck"
no-loop
lock-on-active   
salience 2 
        when
            answers : InitialAnswers( q3a in ( "some", "rare", "not" ) || q3b in ( "some", "rare", "not" ) || q4a in ( "some", "rare", "not" ) || q7b in ( "always", "most", "some" ) )
        triggers_out :  InitialTriggers()
        then

          System.out.println("Occupation!!!!");
                triggers_out.setOccupational( true );
              update( triggers_out );

    end

    rule "PhysicalRule" ruleflow-group "InitialCheck"
    no-loop
      lock-on-active
    salience 3
        when
            answers : InitialAnswers( q1a in ( "some", "rare", "not" ) || q1b in ( "some", "rare", "not" ) || q2a in ( "some", "rare", "not" ) || q2b in ( "some", "rare", "not" ) || q11a in ( "always", "most", "some" ) || q11b in ( "once", "twice", "more", "often" ) )
        triggers_out:InitialTriggers()
        then
        System.out.println("Phys!!!!");
            triggers_out.setPhysical( true );
            update( triggers_out );

    end

    rule "Speech Rule" ruleflow-group "InitialCheck"
        no-loop
       lock-on-active
    salience 4
        when
            answers : InitialAnswers( q7a in ( "always", "most", "some" ) )
        triggers_out : InitialTriggers()
        then
             System.out.println("Speech!!!!");
            triggers_out.setSpeech( true );
            update( triggers_out );

    end 

I am wait for trigger variable is changed, but it stays like

InitialTriggers{physical=false, occupational=false, speech=false, behavioral=false}

Data assigments is ok, and tomcat log contains debugging messages like "Phys!!!!". What am i doing wrong?

Thanks for the help!

1

There are 1 answers

0
Alex Kichev On

Well, everything was OK. I look at the variable history and don't see changes. There was a problem in kie-wb. My variable was changed, but in kie-wb was shown the old value.