Hi,<br><br>I need help with constructing rules for my scenario. <br><br>I started off by creating enum values in the main java file and comparing them with the rules to get different responses for different enum values. That was easy.<br>
<br>This time, I'm constructing a list of enum values and passing them into the rules engine as well. I would like to configure my rules in such a way that when they look for the different enum values, they should also look in the list to test if the enum value passed into the rules engine is a member of the list or not. My old rules looked like this:<br>
<br>rule "Testing for Alpha"<br>salience 100<br>when<br> alpha : AlphaWrapperClass(type == Class.ALPHA)<br>then <br> System.out.println("Found Alpha"); <br> alpha.isFound(true);<br>end<br><br>
I tweaked the above rule to :<br><br>rule "Testing for Alpha"<br>
salience 100<br>when<br> $test: AlphaEnumCollectionsWrapperClass(alphaList : alphaList) <br> alpha : AlphaWrapperClass(type == Class.ALPHA && $test contains type )<br>then <br> System.out.println("Found Loudspeaker Equipment. Who wants to jam that? Must resist... Jamming sequence in progress... ");<br>
materiel.setJam(true); <br>end<br><br>But I'm seeing the following error:<br><br>org.drools.rule.InvalidRulePackage: Unable to create Field Extractor for '$test' of '[ClassObjectType classAlphaEnumCollectionsWrapperClass]' in rule "Testing for Alpha": [Rule name=Testing for Alpha, agendaGroup=MAIN, salience=100, no-loop=false]<br>
<br>I'd greatly appreciate your help.<br><br>Thanks,<br>Armaghan<br><br>