[rules-users] Comparing 2 Lists [Planner]

André Fróes arfmoraes at gmail.com
Mon Feb 18 11:07:51 EST 2013


Hello everyone!

How can I compare 2 lists with a rule?
I upgraded my basic model to a more complex one now, but now I hit a wall.
My WorkOrder have a List of skills, and my Engineer also have a list of
Skills and I have to compare one with another.

Example:

Engineer A have skill ABC 1
Engineer B have skill ABC 2
Engineer C have skill ABC 3

WorkOrder A needs an engineer with skill ABC 3
WorkOrder B needs an engineer with skill ABC 1
WorkOrder C needs an engineer with skill ABC 2

The result should be this:

Engineer A will receive WorkOrder B
Engineer B will receive WorkOrder C
Engineer C will receive WorkOrder A
---------------

I am able to sort it by time, but not by skill, and I don't know how to
loop over each list to find if one have the skills needed to fulful the
other. These are my classes involved:

WorkOrder attributes:
--------
private int requiredWorktime;
private Priority priority;(enum)
private Severity severity;(enum)
private List<SkillWorkOrder> requiredSkills;
--------
Engineer attributes:
--------
private int worktime;
private String name;
private List<SkillEngineer> skillEngineerList;
--------
Skill attributes:
--------
private String name;
--------

both SkillEngineer and SkillWorkOrder are classes that simple receives the
named class and a Skill:
Eg:
private Engineer engineer; //Or WorkOrder
private Skill skill;

Is it possible to iterate over these 2 lists, by drool rule, to check wich
engineer have most coincidences with an workorder? (Eg: if and Engineer
have skill ABC1, ABC2 and a WorkOrder needs an engineer with skill ABC1,
ABC2 and ABC3 he would be choseng among the others because his skills)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130218/b94f6cb1/attachment.html 


More information about the rules-users mailing list