@Test public void testNegativeHeterogeneousValidate() { Set<String> idsToValidate = new HashSet<String>(Arrays.asList(competency1.getEntityId(),competency2.getEntityId())); assertFalse(validator.validate(EntityNames.STUDENT_COMPETENCY, idsToValidate).containsAll(idsToValidate)); }
@Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> ssaToSC = getIdsContainedInFieldOnEntities(entityType, new ArrayList<String>( ids), ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); if (ssaToSC.isEmpty()) { return Collections.emptySet(); } Map<String, Set<String>> studentIdsToSSA = getIdsContainedInFieldOnEntities(EntityNames.STUDENT_SECTION_ASSOCIATION, new ArrayList<String>(ssaToSC.keySet()), ParameterConstants.STUDENT_ID); if (studentIdsToSSA.isEmpty()) { return Collections.emptySet(); } Set<String> studentIds = studentIdsToSSA.keySet(); studentIds.retainAll(getDirectStudentIds()); Set<String> validSSAIds = getValidIds(studentIds, studentIdsToSSA); Set<String> validSCIds = getValidIds(validSSAIds, ssaToSC); return validSCIds; }
StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> ssaToSC = getIdsContainedInFieldOnEntities(entityType, new ArrayList<String>( ids), ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); if (ssaToSC.isEmpty()) { return Collections.emptySet(); } Map<String, Set<String>> studentIdsToSSA = getIdsContainedInFieldOnEntities(EntityNames.STUDENT_SECTION_ASSOCIATION, new ArrayList<String>(ssaToSC.keySet()), ParameterConstants.STUDENT_ID); if (studentIdsToSSA.isEmpty()) { return Collections.emptySet(); } Set<String> studentIds = studentIdsToSSA.keySet(); studentIds.retainAll(getDirectStudentIds()); Set<String> validSSAIds = getValidIds(studentIds, studentIdsToSSA); Set<String> validSCIds = getValidIds(validSSAIds, ssaToSC); return validSCIds; } }
StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> ssaToSC = getIdsContainedInFieldOnEntities(entityType, new ArrayList<String>( ids), ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); if (ssaToSC.isEmpty()) { return Collections.emptySet(); } Map<String, Set<String>> studentIdsToSSA = getIdsContainedInFieldOnEntities(EntityNames.STUDENT_SECTION_ASSOCIATION, new ArrayList<String>(ssaToSC.keySet()), ParameterConstants.STUDENT_ID); if (studentIdsToSSA.isEmpty()) { return Collections.emptySet(); } Set<String> studentIds = studentIdsToSSA.keySet(); studentIds.retainAll(getDirectStudentIds()); Set<String> validSSAIds = getValidIds(studentIds, studentIdsToSSA); Set<String> validSCIds = getValidIds(validSSAIds, ssaToSC); return validSCIds; }  }
StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> ssaToSC = getIdsContainedInFieldOnEntities(entityType, new ArrayList<String>( ids), ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); if (ssaToSC.isEmpty()) { return Collections.emptySet(); } Map<String, Set<String>> studentIdsToSSA = getIdsContainedInFieldOnEntities(EntityNames.STUDENT_SECTION_ASSOCIATION, new ArrayList<String>(ssaToSC.keySet()), ParameterConstants.STUDENT_ID); if (studentIdsToSSA.isEmpty()) { return Collections.emptySet(); } Set<String> studentIds = studentIdsToSSA.keySet(); studentIds.retainAll(getDirectStudentIds()); Set<String> validSSAIds = getValidIds(studentIds, studentIdsToSSA); Set<String> validSCIds = getValidIds(validSSAIds, ssaToSC); return validSCIds; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); }
StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> ssaToSC = getIdsContainedInFieldOnEntities(entityType, new ArrayList<String>( ids), ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); if (ssaToSC.isEmpty()) { return Collections.emptySet(); } Map<String, Set<String>> studentIdsToSSA = getIdsContainedInFieldOnEntities(EntityNames.STUDENT_SECTION_ASSOCIATION, new ArrayList<String>(ssaToSC.keySet()), ParameterConstants.STUDENT_ID); if (studentIdsToSSA.isEmpty()) { return Collections.emptySet(); } Set<String> studentIds = studentIdsToSSA.keySet(); studentIds.retainAll(getDirectStudentIds()); Set<String> validSSAIds = getValidIds(studentIds, studentIdsToSSA); Set<String> validSCIds = getValidIds(validSSAIds, ssaToSC); return validSCIds; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids);  }