[rules-users] Field value is different when and then section, very strange. Is it mvel vs java issue

kina06 reachkn6 at gmail.com
Mon Oct 29 18:59:24 EDT 2012


I have inserted 3 accounts into knowledge session with the following account
statuses 1-NEW, 2-TRANSFER,3-CLOSE.

EXPECTED BEHAVIOR:
As per below given rules, first rule should change all of them to 'pending'
status, so second rule should never fire and third rule always fire for
above 3 accounts.

ACTUAL BEHAVIOR:
second rule is fired for account with new status, i.e. the first one, but in
the system out its status is shown as PENDING before i set it to ERROR.

Can't figure out what's wrong with this, does it has to do anything with
MVEL vs JAVA usage? I mean in when claues it's mvel and in then clause it's
java, so is that causing problem?


rule "Rule1"
salience -1
when
        account : Account();
then
    System.out.println("Ac state rule1 before change "+
account.getAccountStatus());
      account.setAccountStatus( "PENDING" );
      System.out.println("Ac state rule1 after change "+
account.getAccountStatus());
end


rule "Rule2"
salience -2
     when
         account : Account(StringUtils.equals(accountStatus,"NEW"))
         then
            System.out.println("Ac state RuleNo2 before change "+
account.getAccountStatus());
         account.setAccountStatus("ERROR");
         System.out.println("Ac state RuleNo2 after change "+
account.getAccountStatus());
end

rule "Rule3"
salience -3
     when
         account : Account(StringUtils.equals(accountStatus,"PENDING"))
         then
            System.out.println("Ac state  "+ account.getAccountStatus()+ ".
YES
this is expected");
end



--
View this message in context: http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-section-very-strange-Is-it-mvel-vs-java-issue-tp4020550.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list