[rules-users] looping over list

odelyaholiday odelyay at sintecmedia.com
Tue Jan 25 13:21:27 EST 2011


I have a list of officers:
public static final Map<String, List<Officer>> officersPerGenre = new
HashMap<String, List<Officer>>();

Where the Officer with:

String name;
Integer mininumCost;
Integer maximumCost;

in officersPerGenre I fill for each genre list of officers.

In my drools:

rule "Select Officer"
    ruleflow-group "select_officer"
    no-loop true
    salience 20
    when
       $processInstance: WorkflowProcessInstance()
       $requestData: RequestData();
    then
       System.out.println("Hey!");
       List officersWithGenre = (List)officers.get($requestData.getGenre());       
end

Now I need to shrink the officersWithGenre only to officers that
$requestData.cost is between their mininumCost and maximum cost.

How do I write it in drools? In java i will simply iterate over the
collection.


-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/looping-over-list-tp2332677p2332677.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list