@Test public void testCanValidateTeacherAtSchool() { setTeacherContext(school.getEntityId()); schoolIds.add(school.getEntityId()); helper.generateTeacherSchool(teacher.getEntityId(), school.getEntityId()); Assert.assertEquals(schoolIds, validator.validate(EntityNames.SCHOOL, schoolIds)); Assert.assertEquals(schoolIds, validator.validate(EntityNames.EDUCATION_ORGANIZATION, schoolIds)); }
@Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { LOG.trace(">>>GenericToEdOrgValidator.validate()"); LOG.trace(" entityType: " + entityType); LOG.trace(" ids: " + ids); if (!areParametersValid(Arrays.asList(EntityNames.SCHOOL, EntityNames.EDUCATION_ORGANIZATION), entityType, ids)) { LOG.trace(" ...return empty set - areParametersValid"); return Collections.emptySet(); } Set<String> edOrgs = getDirectEdorgs(); LOG.trace(" ...count after adding DirectEdorgs: " + edOrgs.size()); edOrgs.addAll(getEdorgDescendents(edOrgs)); LOG.trace(" ...count after adding getEdorgDescendents: " + edOrgs.size()); edOrgs.retainAll(ids); LOG.trace(" ...count after adding providedIds: " + edOrgs.size()); LOG.trace(" edOrgs: " + edOrgs.toString()); return edOrgs; }
GenericToEdOrgValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { LOG.trace(">>>GenericToEdOrgValidator.validate()"); LOG.trace(" entityType: " + entityType); LOG.trace(" ids: " + ids); if (!areParametersValid(Arrays.asList(EntityNames.SCHOOL, EntityNames.EDUCATION_ORGANIZATION), entityType, ids)) { LOG.trace(" ...return empty set - areParametersValid"); return Collections.emptySet(); } Set<String> edOrgs = getDirectEdorgs(); LOG.trace(" ...count after adding DirectEdorgs: " + edOrgs.size()); edOrgs.addAll(getEdorgDescendents(edOrgs)); LOG.trace(" ...count after adding getEdorgDescendents: " + edOrgs.size()); edOrgs.retainAll(ids); LOG.trace(" ...count after adding providedIds: " + edOrgs.size()); LOG.trace(" edOrgs: " + edOrgs.toString()); return edOrgs; } }
GenericToEdOrgValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { LOG.trace(">>>GenericToEdOrgValidator.validate()"); LOG.trace(" entityType: " + entityType); LOG.trace(" ids: " + ids); if (!areParametersValid(Arrays.asList(EntityNames.SCHOOL, EntityNames.EDUCATION_ORGANIZATION), entityType, ids)) { LOG.trace(" ...return empty set - areParametersValid"); return Collections.emptySet(); } Set<String> edOrgs = getDirectEdorgs(); LOG.trace(" ...count after adding DirectEdorgs: " + edOrgs.size()); edOrgs.addAll(getEdorgDescendents(edOrgs)); LOG.trace(" ...count after adding getEdorgDescendents: " + edOrgs.size()); edOrgs.retainAll(ids); LOG.trace(" ...count after adding providedIds: " + edOrgs.size()); LOG.trace(" edOrgs: " + edOrgs.toString()); return edOrgs; }  }
GenericToEdOrgValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { LOG.trace(">>>GenericToEdOrgValidator.validate()"); LOG.trace(" entityType: " + entityType); LOG.trace(" ids: " + ids); if (!areParametersValid(Arrays.asList(EntityNames.SCHOOL, EntityNames.EDUCATION_ORGANIZATION), entityType, ids)) { LOG.trace(" ...return empty set - areParametersValid"); return Collections.emptySet(); } Set<String> edOrgs = getDirectEdorgs(); LOG.trace(" ...count after adding DirectEdorgs: " + edOrgs.size()); edOrgs.addAll(getEdorgDescendents(edOrgs)); LOG.trace(" ...count after adding getEdorgDescendents: " + edOrgs.size()); edOrgs.retainAll(ids); LOG.trace(" ...count after adding providedIds: " + edOrgs.size()); LOG.trace(" edOrgs: " + edOrgs.toString()); return edOrgs; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext(); }
GenericToEdOrgValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { LOG.trace(">>>GenericToEdOrgValidator.validate()"); LOG.trace(" entityType: " + entityType); LOG.trace(" ids: " + ids); if (!areParametersValid(Arrays.asList(EntityNames.SCHOOL, EntityNames.EDUCATION_ORGANIZATION), entityType, ids)) { LOG.trace(" ...return empty set - areParametersValid"); return Collections.emptySet(); } Set<String> edOrgs = getDirectEdorgs(); LOG.trace(" ...count after adding DirectEdorgs: " + edOrgs.size()); edOrgs.addAll(getEdorgDescendents(edOrgs)); LOG.trace(" ...count after adding getEdorgDescendents: " + edOrgs.size()); edOrgs.retainAll(ids); LOG.trace(" ...count after adding providedIds: " + edOrgs.size()); LOG.trace(" edOrgs: " + edOrgs.toString()); return edOrgs; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext();  }