[rules-users] Synch Business Object / Working Memory

Jonathan Guéhenneux jojolemariole at hotmail.com
Fri Apr 11 04:34:19 EDT 2008


Hi,

I have two rules :

rule "rule 1 - 1"
    
    salience 90
    ruleflow-group "rfg1"
    when
        a : A(
            eComputed == "false",
            c < 15,
            d >= 75)        
    then
        c.setE(0);
end



rule "rule 1 - 2"

    salience 10
    ruleflow-group "rfg1"

    when

        a : A(

            eComputed == "false",

            c >= 15,

            d >= 75)        

    then

        c.setE(1);
end



and part of the corresponding business code :

public class A {

    ...

    public String getEComputed(){
        if(eComputed)
            return "true";
        else
          return "false";
    }

    ...

    public void setE(int e){
        this.e = e;
        eComputed = true;
    }

    ...

}



so, I expected that if the first rule is activated, the second won't be. But according to my tests, the two rule can be fired on the same object A.
While debugging, I noticed the getEComputed method was only called once. I suppose that I should write this :



rule "rule 1 - 1"

    

    salience 90

    ruleflow-group "rfg1"

    when

        a : A(

            eComputed == "false",

            c < 15,

            d >= 75)        

    then

        c.setE(0);
         c.setEComputed("true);

end






rule "rule 1 - 2"



    salience 10

    ruleflow-group "rfg1"


    when


        a : A(


            eComputed == "false",


            c >= 15,


            d >= 75)        


    then


        c.setE(1);
         c.setEComputed("true);


end

But I would prefer another solution. Thanks for help.

_________________________________________________________________
Créez votre disque dur virtuel Windows Live SkyDrive, 5Go de stockage gratuit !
http://www.windowslive.fr/skydrive/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080411/a07d7152/attachment.html 


More information about the rules-users mailing list