@Test public void testMultipleStudents() { setFindEachReturn(Arrays.asList(student1, student2, student3)); Assert.assertEquals(new HashSet<String>(Arrays.asList("school1", "school2", "school3")), resolver.findGoverningEdOrgs(disciplineIncident)); }
@Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntityId()))); while (students.hasNext()) { Entity student = students.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs(student.getEntityId(), entity)); } return edOrgs; }
DisciplineIncidentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntityId()))); while (students.hasNext()) { Entity student = students.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs(student.getEntityId(), entity)); } return edOrgs; } }
DisciplineIncidentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntityId()))); while (students.hasNext()) { Entity student = students.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs(student.getEntityId(), entity)); } return edOrgs; }  }
DisciplineIncidentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntityId()))); while (students.hasNext()) { Entity student = students.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs(student.getEntityId(), entity)); } return edOrgs; }  @Override Set<String> findGoverningEdOrgs(Entity entity); }
DisciplineIncidentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntityId()))); while (students.hasNext()) { Entity student = students.next(); edOrgs.addAll(studentResolver.findGoverningEdOrgs(student.getEntityId(), entity)); } return edOrgs; }  @Override Set<String> findGoverningEdOrgs(Entity entity); static final String DISCIPLINE_INCIDENT_ID; }