[jboss-svn-commits] JBL Code SVN: r27179 - in labs/jbossrules/trunk/drools-solver/drools-solver-examples: src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jun 27 05:52:32 EDT 2009


Author: ge0ffrey
Date: 2009-06-27 05:52:32 -0400 (Sat, 27 Jun 2009)
New Revision: 27179

Added:
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/Department.java
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/DepartmentSpecialism.java
Modified:
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata01.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata02.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata03.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata04.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata05.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata06.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata07.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata08.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata09.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata10.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata11.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata12.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata13.xml
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/PatientAdmissionSchedule.java
   labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/persistence/PatientAdmissionSchedulingInputConvertor.java
Log:
pas: department + departmentspecialism

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata01.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata01.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata01.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,96 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata02.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata02.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata02.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -26,4 +26,140 @@
       <name>Specialism6</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="9">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="14">
+      <id>5</id>
+      <name>Department5</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="15">
+      <id>6</id>
+      <name>Department6</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="16">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>0</id>
+      <department reference="14"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="30">
+      <id>1</id>
+      <department reference="14"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="31">
+      <id>2</id>
+      <department reference="14"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="32">
+      <id>0</id>
+      <department reference="15"/>
+      <specialism reference="8"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="33">
+      <id>1</id>
+      <department reference="15"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="34">
+      <id>2</id>
+      <department reference="15"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata03.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata03.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata03.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -22,4 +22,118 @@
       <name>Specialism5</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="8">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>5</id>
+      <name>Department5</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="14">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata04.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata04.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata04.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -26,4 +26,140 @@
       <name>Specialism6</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="9">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="14">
+      <id>5</id>
+      <name>Department5</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="15">
+      <id>6</id>
+      <name>Department6</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="16">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>0</id>
+      <department reference="14"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="30">
+      <id>1</id>
+      <department reference="14"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="31">
+      <id>2</id>
+      <department reference="14"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="32">
+      <id>0</id>
+      <department reference="15"/>
+      <specialism reference="8"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="33">
+      <id>1</id>
+      <department reference="15"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="34">
+      <id>2</id>
+      <department reference="15"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata05.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata05.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata05.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,96 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata06.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata06.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata06.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,96 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata07.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata07.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata07.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -26,4 +26,142 @@
       <name>Specialism6</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="9">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>2</id>
+      <name>Department2</name>
+      <maximumAge>16</maximumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="14">
+      <id>5</id>
+      <name>Department5</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="15">
+      <id>6</id>
+      <name>Department6</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="16">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>0</id>
+      <department reference="14"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="30">
+      <id>1</id>
+      <department reference="14"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="31">
+      <id>2</id>
+      <department reference="14"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="32">
+      <id>0</id>
+      <department reference="15"/>
+      <specialism reference="8"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="33">
+      <id>1</id>
+      <department reference="15"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="34">
+      <id>2</id>
+      <department reference="15"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata08.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata08.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata08.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -26,4 +26,142 @@
       <name>Specialism6</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="9">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>2</id>
+      <name>Department2</name>
+      <maximumAge>16</maximumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>4</id>
+      <name>Department4</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="14">
+      <id>5</id>
+      <name>Department5</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="15">
+      <id>6</id>
+      <name>Department6</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="16">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>0</id>
+      <department reference="14"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="30">
+      <id>1</id>
+      <department reference="14"/>
+      <specialism reference="8"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="31">
+      <id>2</id>
+      <department reference="14"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="32">
+      <id>0</id>
+      <department reference="15"/>
+      <specialism reference="8"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="33">
+      <id>1</id>
+      <department reference="15"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="34">
+      <id>2</id>
+      <department reference="15"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata09.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata09.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata09.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,98 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+      <maximumAge>16</maximumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata10.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata10.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata10.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,96 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata11.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata11.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata11.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,97 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata12.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata12.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata12.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -18,4 +18,97 @@
       <name>Specialism4</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="7">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="8">
+      <id>1</id>
+      <name>Department1</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>3</id>
+      <name>Department3</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>4</id>
+      <name>Department4</name>
+      <maximumAge>16</maximumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="12">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="13">
+      <id>0</id>
+      <department reference="8"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="14">
+      <id>1</id>
+      <department reference="8"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>2</id>
+      <department reference="8"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata13.xml
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata13.xml	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/data/patientadmissionscheduling/unsolved/testdata13.xml	2009-06-27 09:52:32 UTC (rev 27179)
@@ -22,4 +22,121 @@
       <name>Specialism5</name>
     </org.drools.solver.examples.patientadmissionscheduling.domain.Specialism>
   </specialismList>
+  <departmentList id="8">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="9">
+      <id>1</id>
+      <name>Department1</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="10">
+      <id>2</id>
+      <name>Department2</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="11">
+      <id>3</id>
+      <name>Department3</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="12">
+      <id>4</id>
+      <name>Department4</name>
+      <minimumAge>65</minimumAge>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.Department id="13">
+      <id>5</id>
+      <name>Department5</name>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.Department>
+  </departmentList>
+  <departmentSpecialismList id="14">
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="15">
+      <id>0</id>
+      <department reference="9"/>
+      <specialism reference="3"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="16">
+      <id>1</id>
+      <department reference="9"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="17">
+      <id>2</id>
+      <department reference="9"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="18">
+      <id>0</id>
+      <department reference="10"/>
+      <specialism reference="4"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="19">
+      <id>1</id>
+      <department reference="10"/>
+      <specialism reference="5"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="20">
+      <id>2</id>
+      <department reference="10"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="21">
+      <id>0</id>
+      <department reference="11"/>
+      <specialism reference="5"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="22">
+      <id>1</id>
+      <department reference="11"/>
+      <specialism reference="6"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="23">
+      <id>2</id>
+      <department reference="11"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="24">
+      <id>0</id>
+      <department reference="12"/>
+      <specialism reference="6"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="25">
+      <id>1</id>
+      <department reference="12"/>
+      <specialism reference="7"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="26">
+      <id>2</id>
+      <department reference="12"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="27">
+      <id>0</id>
+      <department reference="13"/>
+      <specialism reference="7"/>
+      <priority>1</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="28">
+      <id>1</id>
+      <department reference="13"/>
+      <specialism reference="3"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+    <org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism id="29">
+      <id>2</id>
+      <department reference="13"/>
+      <specialism reference="4"/>
+      <priority>2</priority>
+    </org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism>
+  </departmentSpecialismList>
 </org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule>
\ No newline at end of file

Copied: labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/Department.java (from rev 27156, labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/Specialism.java)
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/Department.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/Department.java	2009-06-27 09:52:32 UTC (rev 27179)
@@ -0,0 +1,50 @@
+package org.drools.solver.examples.patientadmissionscheduling.domain;
+
+import org.apache.commons.lang.builder.CompareToBuilder;
+import org.drools.solver.examples.common.domain.AbstractPersistable;
+
+/**
+ * @author Geoffrey De Smet
+ */
+public class Department extends AbstractPersistable implements Comparable<Department> {
+
+    private String name;
+    private Integer minimumAge = null;
+    private Integer maximumAge = null;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getMinimumAge() {
+        return minimumAge;
+    }
+
+    public void setMinimumAge(Integer minimumAge) {
+        this.minimumAge = minimumAge;
+    }
+
+    public Integer getMaximumAge() {
+        return maximumAge;
+    }
+
+    public void setMaximumAge(Integer maximumAge) {
+        this.maximumAge = maximumAge;
+    }
+
+    public int compareTo(Department other) {
+        return new CompareToBuilder()
+                .append(id, other.id)
+                .toComparison();
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+}
\ No newline at end of file

Copied: labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/DepartmentSpecialism.java (from rev 27151, labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/manners2009/domain/HobbyPractician.java)
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/DepartmentSpecialism.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/DepartmentSpecialism.java	2009-06-27 09:52:32 UTC (rev 27179)
@@ -0,0 +1,56 @@
+package org.drools.solver.examples.patientadmissionscheduling.domain;
+
+import org.apache.commons.lang.builder.CompareToBuilder;
+import org.drools.solver.examples.common.domain.AbstractPersistable;
+import org.drools.solver.examples.manners2009.domain.Guest;
+import org.drools.solver.examples.manners2009.domain.Hobby;
+import org.drools.solver.examples.manners2009.domain.HobbyPractician;
+
+/**
+ * @author Geoffrey De Smet
+ */
+public class DepartmentSpecialism extends AbstractPersistable implements Comparable<DepartmentSpecialism> {
+
+    private Department department;
+    private Specialism specialism;
+
+    private int priority; // AKA choice
+
+    public Department getDepartment() {
+        return department;
+    }
+
+    public void setDepartment(Department department) {
+        this.department = department;
+    }
+
+    public Specialism getSpecialism() {
+        return specialism;
+    }
+
+    public void setSpecialism(Specialism specialism) {
+        this.specialism = specialism;
+    }
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    public int compareTo(DepartmentSpecialism other) {
+        return new CompareToBuilder()
+                .append(department, other.department)
+                .append(specialism, other.specialism)
+                .append(id, other.id)
+                .toComparison();
+    }
+
+    @Override
+    public String toString() {
+        return department + "-" + specialism;
+    }
+
+}
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/PatientAdmissionSchedule.java
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/PatientAdmissionSchedule.java	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/domain/PatientAdmissionSchedule.java	2009-06-27 09:52:32 UTC (rev 27179)
@@ -17,12 +17,9 @@
 public class PatientAdmissionSchedule extends AbstractPersistable implements Solution {
 
     private List<Specialism> specialismList;
-    private List<Period> periodList;
-    private List<Room> roomList;
+    private List<Department> departmentList;
+    private List<DepartmentSpecialism> departmentSpecialismList;
 
-    private List<PeriodHardConstraint> periodHardConstraintList;
-    private List<RoomHardConstraint> roomHardConstraintList;
-
     private List<Exam> examList;
 
     public List<Specialism> getSpecialismList() {
@@ -33,17 +30,36 @@
         this.specialismList = specialismList;
     }
 
+    public List<Department> getDepartmentList() {
+        return departmentList;
+    }
+
+    public void setDepartmentList(List<Department> departmentList) {
+        this.departmentList = departmentList;
+    }
+
     public boolean isInitialized() {
         return (examList != null);
     }
 
+    public List<DepartmentSpecialism> getDepartmentSpecialismList() {
+        return departmentSpecialismList;
+    }
+
+    public void setDepartmentSpecialismList(List<DepartmentSpecialism> departmentSpecialismList) {
+        this.departmentSpecialismList = departmentSpecialismList;
+    }
+
     public Collection<? extends Object> getFacts() {
         List<Object> facts = new ArrayList<Object>();
         facts.addAll(specialismList);
-        facts.addAll(periodList);
-        facts.addAll(roomList);
-        facts.addAll(periodHardConstraintList);
-        facts.addAll(roomHardConstraintList);
+        facts.addAll(departmentList);
+        facts.addAll(departmentSpecialismList);
+
+
+//        facts.addAll(roomList);
+//        facts.addAll(periodHardConstraintList);
+//        facts.addAll(roomHardConstraintList);
         if (isInitialized()) {
             facts.addAll(examList);
         }
@@ -57,10 +73,13 @@
         PatientAdmissionSchedule clone = new PatientAdmissionSchedule();
         clone.id = id;
         clone.specialismList = specialismList;
-        clone.periodList = periodList;
-        clone.roomList = roomList;
-        clone.periodHardConstraintList = periodHardConstraintList;
-        clone.roomHardConstraintList = roomHardConstraintList;
+        clone.departmentList = departmentList;
+        clone.departmentSpecialismList = departmentSpecialismList;
+
+        
+//        clone.roomList = roomList;
+//        clone.periodHardConstraintList = periodHardConstraintList;
+//        clone.roomHardConstraintList = roomHardConstraintList;
         // deep clone exams
         List<Exam> clonedExamList = new ArrayList<Exam>(examList.size());
         for (Exam exam : examList) {

Modified: labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/persistence/PatientAdmissionSchedulingInputConvertor.java
===================================================================
--- labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/persistence/PatientAdmissionSchedulingInputConvertor.java	2009-06-27 09:08:07 UTC (rev 27178)
+++ labs/jbossrules/trunk/drools-solver/drools-solver-examples/src/main/java/org/drools/solver/examples/patientadmissionscheduling/persistence/PatientAdmissionSchedulingInputConvertor.java	2009-06-27 09:52:32 UTC (rev 27179)
@@ -4,10 +4,14 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.drools.solver.examples.common.persistence.AbstractInputConvertor;
 import org.drools.solver.examples.patientadmissionscheduling.domain.PatientAdmissionSchedule;
 import org.drools.solver.examples.patientadmissionscheduling.domain.Specialism;
+import org.drools.solver.examples.patientadmissionscheduling.domain.Department;
+import org.drools.solver.examples.patientadmissionscheduling.domain.DepartmentSpecialism;
 import org.drools.solver.core.solution.Solution;
 
 /**
@@ -23,6 +27,8 @@
         return "patientadmissionscheduling";
     }
 
+    private Map<Long, Specialism> specialismMap = null;
+
     public Solution readSolution(BufferedReader bufferedReader) throws IOException {
         PatientAdmissionSchedule patientAdmissionSchedule = new PatientAdmissionSchedule();
         patientAdmissionSchedule.setId(0L);
@@ -38,28 +44,98 @@
         readEmptyLine(bufferedReader);
         readEmptyLine(bufferedReader);
 
+        readSpecialismList(bufferedReader, patientAdmissionSchedule, specialismListSize);
+
+        readDepartmentListAndDepartmentSpecialismList(bufferedReader, patientAdmissionSchedule, departmentListSize);
+
+        
+        return patientAdmissionSchedule;
+    }
+
+    private void readSpecialismList(BufferedReader bufferedReader, PatientAdmissionSchedule patientAdmissionSchedule,
+            int specialismListSize) throws IOException {
         readConstantLine(bufferedReader, "SPECIALISMS:");
         List<Specialism> specialismList = new ArrayList<Specialism>(specialismListSize);
+        specialismMap = new HashMap<Long, Specialism>(specialismListSize);
         for (int i = 0; i < specialismListSize; i++) {
+            String line = bufferedReader.readLine();
+            String[] lineTokens = splitBySpace(line, 2);
             Specialism specialism = new Specialism();
-
-            String line = bufferedReader.readLine();
-            String[] lineTokens = line.split("\\ ");
-            if (lineTokens.length != 2) {
-                throw new IllegalArgumentException("Read line (" + line
-                        + ") is expected to contain 2 tokens.");
-            }
             specialism.setId(Long.parseLong(lineTokens[0]));
             specialism.setName(lineTokens[1]);
             specialismList.add(specialism);
+            specialismMap.put(specialism.getId(), specialism);
         }
         patientAdmissionSchedule.setSpecialismList(specialismList);
         readEmptyLine(bufferedReader);
+    }
 
-        // TODO
+    private void readDepartmentListAndDepartmentSpecialismList(BufferedReader bufferedReader, PatientAdmissionSchedule patientAdmissionSchedule, int departmentListSize) throws IOException {
+        readConstantLine(bufferedReader, "DEPARTMENTS:");
+        List<Department> departmentList = new ArrayList<Department>(departmentListSize);
+        List<DepartmentSpecialism> departmentSpecialismList = new ArrayList<DepartmentSpecialism>(
+                departmentListSize * 5);
+        for (int i = 0; i < departmentListSize; i++) {
+            String line = bufferedReader.readLine();
+            String[] lineTokens = splitByPipeline(line, 2);
 
-        
-        return patientAdmissionSchedule;
+            String[] departmentTokens = splitBySpace(lineTokens[0], 4);
+            Department department = new Department();
+            department.setId(Long.parseLong(departmentTokens[0]));
+            department.setName(departmentTokens[1]);
+            int minimumAge = Integer.parseInt(departmentTokens[2]);
+            if (minimumAge != 0) {
+                department.setMinimumAge(Integer.valueOf(minimumAge));
+            }
+            int maximumAge = Integer.parseInt(departmentTokens[3]);
+            if (maximumAge != 0) {
+                department.setMaximumAge(Integer.valueOf(maximumAge));
+            }
+            departmentList.add(department);
+
+            String[] departmentSpecialismTokens = splitBySpace(lineTokens[1]);
+            if (departmentSpecialismTokens.length % 2 != 0) {
+                throw new IllegalArgumentException("Read line (" + line
+                        + ") is expected to contain even number of tokens (" + departmentSpecialismTokens.length
+                        + ") after pipeline (|) seperated by a space ( ).");
+            }
+            for (int j = 0; j < departmentSpecialismTokens.length; j += 2) {
+                int priority = Integer.parseInt(departmentSpecialismTokens[j]);
+                long specialismId = Long.parseLong(departmentSpecialismTokens[j + 1]);
+                DepartmentSpecialism departmentSpecialism = new DepartmentSpecialism();
+                departmentSpecialism.setId((long) j / 2);
+                departmentSpecialism.setDepartment(department);
+                departmentSpecialism.setSpecialism(specialismMap.get(specialismId));
+                departmentSpecialism.setPriority(priority);
+                departmentSpecialismList.add(departmentSpecialism);
+            }
+        }
+        patientAdmissionSchedule.setDepartmentList(departmentList);
+        patientAdmissionSchedule.setDepartmentSpecialismList(departmentSpecialismList);
+        readEmptyLine(bufferedReader);
     }
 
+    private String[] splitBySpace(String line) {
+        String[] lineTokens = line.trim().split("\\ ");
+        return lineTokens;
+    }
+
+    private String[] splitBySpace(String line, int numberOfTokens) {
+        String[] lineTokens = line.trim().split("\\ ");
+        if (lineTokens.length != numberOfTokens) {
+            throw new IllegalArgumentException("Read line (" + line
+                    + ") is expected to contain " +  numberOfTokens + " tokens seperated by a space ( ).");
+        }
+        return lineTokens;
+    }
+
+    private String[] splitByPipeline(String line, int numberOfTokens) {
+        String[] lineTokens = line.trim().split("\\|");
+        if (lineTokens.length != numberOfTokens) {
+            throw new IllegalArgumentException("Read line (" + line
+                    + ") is expected to contain " +  numberOfTokens + " tokens seperated by a pipeline (|).");
+        }
+        return lineTokens;
+    }
+
 }
\ No newline at end of file




More information about the jboss-svn-commits mailing list