<div dir="ltr">Hello everyone!<div><br></div><div style>How can I compare 2 lists with a rule?</div><div style>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.</div>
<div style><br></div><div style>Example:</div><div style><br></div><div style>Engineer A have skill ABC 1</div><div style>Engineer B have skill ABC 2</div><div style>Engineer C have skill ABC 3</div><div style><br></div><div style>
WorkOrder A needs an engineer with skill ABC 3</div><div style>WorkOrder B needs an engineer with skill ABC 1</div><div style>WorkOrder C needs an engineer with skill ABC 2<br></div><div style><br></div><div style>The result should be this:</div>
<div style><br></div><div style>Engineer A will receive WorkOrder B</div><div style>Engineer B will receive WorkOrder C<br></div><div style>Engineer C will receive WorkOrder A<br></div><div style>---------------</div><div style>
<br></div><div style>I am able to sort it by time, but not by skill, and I don&#39;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:</div><div style>
<br></div><div style>WorkOrder attributes:</div><div style>--------</div><div style><div>private int requiredWorktime;</div><div>private Priority priority;(enum)</div><div>private Severity severity;(enum)</div><div>private List&lt;SkillWorkOrder&gt; requiredSkills;</div>
<div>--------</div><div style>Engineer attributes:</div><div style>--------</div><div style><div>private int worktime;</div><div>private String name;</div><div>private List&lt;SkillEngineer&gt; skillEngineerList;</div><div>
--------</div><div style>Skill attributes:</div><div style>--------</div><div style>private String name;</div><div style>--------</div><div style><br></div><div style>both SkillEngineer and SkillWorkOrder are classes that simple receives the named class and a Skill:<br>
</div><div style>Eg:</div><div style><div>private Engineer engineer; //Or WorkOrder</div><div>private Skill skill;</div><div><br></div><div style>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)</div>
</div><div style><br></div></div></div></div>