[rules-users] Using Character typed properties in Drool 5.3
Welsh, Armand
AWelsh at StateStreet.com
Mon Feb 13 18:15:55 EST 2012
Community,
In drools 5.2 I had the following LHS"
when
BloombergColumn (columnName == "CRNCY", $cur : stringValue != null)
Country (currency == $cur, emergingMkt == 'Y' || countryCode in ("BH","HR","CZ","EE","HK","HU","IL","KR","KW","MO","OM","QA","SA","SG","SK","SI","TT"))
I am switching to Drool 5.3, and Drools Guvnor reports the following error upon validate (or compile):
[bum_code_value.currency 01] Unable to Analyse Expression emergingMkt == 'Y' || countryCode == "BH" || countryCode == "HR" || countryCode == "CZ" || countryCode == "EE" || countryCode == "HK" || countryCode == "HU" || countryCode == "IL" || countryCode == "KR" || countryCode == "KW" || countryCode == "MO" || countryCode == "OM" || countryCode == "QA" || countryCode == "SA" || countryCode == "SG" || countryCode == "SK" || countryCode == "SI" || countryCode == "TT": [Error: Comparison operation requires compatible types. Found class java.lang.Character and class java.lang.String] [Near : {... == "SK" || countryCode == "SI" || countryCode == "TT" ....}] ^ [Line: 7, Column: 28]
Looking at the emergingMkt in my data model, I see that it is defined as a Character. If I change my LHS to:
BloombergColumn (columnName == "CRNCY", $cur : stringValue != null)
Country (currency == $cur, emergingMkt == Character.valueOf('Y') || countryCode in ("BH","HR","CZ","EE","HK","HU","IL","KR","KW","MO","OM","QA","SA","SG","SK","SI","TT"))
Then the validate passes.
Was this change in behavior intentional? I don't see a reference to this change in the Drools 5.3 documentation, and this makes for a harder to read rule for our Drools analysts.
Thanks in advance,
Armand
More information about the rules-users
mailing list