@Test public void returnEmptySetIfNoStudent() { Entity courseTranscript = buildCourseTranscript(); courseTranscript.getBody().remove(STUDENT_ID); courseTranscript.getBody().remove(STUDENT_ACADEMIC_RECORD_ID); assertEquals(Collections.emptySet(), underTest.findGoverningEdOrgs(courseTranscript)); }
@Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs(studentId, entity)); } String studentAcademicRecordId = (String) entity.getBody().get(STUDENT_ACADEMIC_RECORD_ID); if (studentAcademicRecordId != null) { Entity studentAcademicRecord = repo.findById(EntityNames.STUDENT_ACADEMIC_RECORD, studentAcademicRecordId); if (studentAcademicRecord != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentAcademicRecord.getBody().get(STUDENT_ID), entity)); } } return edOrgs; }
CourseTranscriptContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs(studentId, entity)); } String studentAcademicRecordId = (String) entity.getBody().get(STUDENT_ACADEMIC_RECORD_ID); if (studentAcademicRecordId != null) { Entity studentAcademicRecord = repo.findById(EntityNames.STUDENT_ACADEMIC_RECORD, studentAcademicRecordId); if (studentAcademicRecord != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentAcademicRecord.getBody().get(STUDENT_ID), entity)); } } return edOrgs; } }
CourseTranscriptContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs(studentId, entity)); } String studentAcademicRecordId = (String) entity.getBody().get(STUDENT_ACADEMIC_RECORD_ID); if (studentAcademicRecordId != null) { Entity studentAcademicRecord = repo.findById(EntityNames.STUDENT_ACADEMIC_RECORD, studentAcademicRecordId); if (studentAcademicRecord != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentAcademicRecord.getBody().get(STUDENT_ID), entity)); } } return edOrgs; }  }
CourseTranscriptContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs(studentId, entity)); } String studentAcademicRecordId = (String) entity.getBody().get(STUDENT_ACADEMIC_RECORD_ID); if (studentAcademicRecordId != null) { Entity studentAcademicRecord = repo.findById(EntityNames.STUDENT_ACADEMIC_RECORD, studentAcademicRecordId); if (studentAcademicRecord != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentAcademicRecord.getBody().get(STUDENT_ID), entity)); } } return edOrgs; }  @Override Set<String> findGoverningEdOrgs(Entity entity); }
CourseTranscriptContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs(studentId, entity)); } String studentAcademicRecordId = (String) entity.getBody().get(STUDENT_ACADEMIC_RECORD_ID); if (studentAcademicRecordId != null) { Entity studentAcademicRecord = repo.findById(EntityNames.STUDENT_ACADEMIC_RECORD, studentAcademicRecordId); if (studentAcademicRecord != null) { edOrgs.addAll(studentResolver.findGoverningEdOrgs((String) studentAcademicRecord.getBody().get(STUDENT_ID), entity)); } } return edOrgs; }  @Override Set<String> findGoverningEdOrgs(Entity entity); static final String ED_ORG_REFERENCE; static final String STUDENT_ACADEMIC_RECORD_ID; static final String STUDENT_ID; }