Drools explicitly disables control statements in MVEL consequences, at it is usually not a good sign. I.e., you should probably encapsulate that check you are doing in a LHS condition (even if you have to wrap it up in an eval()), so that the rule will not be activated and fired when it shouldn't.
Edson 2009/11/3 Shah, Malay <malay.s...@morganstanley.com> > Hi All, > > I am trying to compile a drool rule using MVEL dialect and getting the > following weird error. > > > Unable to determine the used declarations. > > unbalanced braces (near code: << ... core1_entityOID); ...>>) (position: > 33) : [Rule name=Legacy ETSDB Rule, agendaGroup=MAIN, salience=0, > no-loop=false] > * > > org.mvel.ParseException > *: unbalanced braces (near code: << ... core1_entityOID); ...>>) > (position: 33)Unable to build expression for 'consequence' > > The code I am trying to compile is: > > package S_124 > import com.ms.ieddata.dataQuality.violation.Violation; > import com.ms.ieddata.etsdb.model.EtsExecution_core; > import com.ms.ieddata.etsdb.model.EtsExecutionOrder_core; > global java.util.HashSet violations; > global java.util.HashSet violationKeys; > > dialect "mvel" > > rule "Legacy ETSDB Rule" > > when > EtsExecution_core1:EtsExecution_core(crossInd == "1" , lastCapacity != "3" > , lastDestinationID not in ("EUREX","IDEM","MEFF","LIFFE")) > EtsExecutionOrder_core1:EtsExecutionOrder_core(entityOID == > EtsExecution_core1.parentOID , exDestination in ("I","L") , > swapComponentType != "swaps" , orderCapacity not in > ("D","R","X","L","E","T","C","O","P","S"),EtsExecutionOrder_core1_entityOID:entityOID,EtsExecutionOrder_core1_application:application,EtsExecutionOrder_core1_entityVID:entityVID) > > then > > String key="S-124_EtsExecution_core" + "_entityVID_" + > "EtsExecutionOrder_core1_entityVID" + "_application_" + > "EtsExecutionOrder_core1_application" + "_entityOID_" + > "EtsExecutionOrder_core1_entityOID"; > > vPresent = violationKeys.contains(key); > > if (!vPresent) > { > violation = new Violation(); > violation.putRuleActionAttribute("ruleId","S-124"); > violation.putRuleActionAttribute("ruleName","Legacy ETSDB Rule"); > violation.putRuleActionAttribute("legacyRuleType","1"); > violation.putRuleActionAttribute("entityName","EtsExecution_core"); > violation.putRuleActionAttribute("fieldName","Field"); > > > violation.putRuleActionAttribute("entityVID",EtsExecutionOrder_core1_entityVID); > > > violation.putRuleActionAttribute("application",EtsExecutionOrder_core1_application); > > > violation.putRuleActionAttribute("entityOID",EtsExecutionOrder_core1_entityOID); > } > > end > > The code works fine when I use java dialect. Also, if I remove the if > statement from consequence, the code get compiled in mvel and java dialects. > Am I missing something obvious here? I am using drools 4.0.1. > > Thanks > > Malay Shah > Morgan Stanley | IDEAS Practice Areas > 750 Seventh Avenue, 6th Floor | New York, NY 10019 > Phone: +1 212 762-4495 > malay.s...@morganstanley.com > > ------------------------------ > > NOTICE: If received in error, please destroy, and notify sender. Sender > does not intend to waive confidentiality or privilege. Use of this email is > prohibited when received in error. We may monitor and store emails to the > extent permitted by applicable law. > > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users