I'm trying to create a rule on Drools. My current code is:
rule "Test Rule #1"
when
obj1 : MyObject ( )
map : ArrayList (size < 1) from collect ( HashMap ( values ( House ( windows = 3) ) ) ) from obj1.getHouses()
then
// Do something
end
What I am trying to do is: check if there are any Houses with 3 windows in the HashMap. If there aren't // Do something
.
To do that I'm trying to access obj1.getHouses() which is an HashMap < String, List < Houses>>. Then I'm checking this HashMap values, and filter it for Houses that have 3 windows.
But there is something wrong with this code. I'm getting this error:
Unable to Analyse Expression values ( House ( windows = 3) ): java.lang.Class cannot be cast to org.mvel2.util.MethodStub]
Can someone help? Thanks in advance.