JBoss Community

why java.util.Map doesn't work on RHS update

created by hardawaycg in jBPM - View the full discussion

my rule just like this:

==================java code=====================

......

StatefulKnowledgeSession statefulKSession = kbase.newStatefulKnowledgeSession();

Map valueMap = new HashMap();

valueMap.put("year", "2012");

statefulKSession.insert(valueMap);

statefulKSession.fireAllRules();

......

==============================================

=================rule code======================

rule "rule1"

          lock-on-active true

          salience 100

     when

          $map : Map(this["year"] == "2012")

    then

                   System.out.println(drools.getRule().getName());

          //String state = service.getState();

          $map.put("state","2");

          update($m);

end

 

rule "rule2"

  lock-on-active true

  salience 99

     when

            $map : Map(this["state"] == "2")

    then

          System.out.println(drools.getRule().getName());

end

=============================================

 

i insert a HashMap as a fact to the working memory

my first rule(rule1) just get "state" from service ,then put into the map then update ,and in the next rule(rule2) judge "state" ,but it never goes into rule2's RHS,why?

 

any guys can help me? tks

Reply to this message by going to Community

Start a new discussion in jBPM at Community