@Test public void testSuccessOne() { Entity tsa = this.vth.generateTeacherSchool(USER_ID, "Myrran"); Set<String> ids = Collections.singleton(tsa.getEntityId()); Assert.assertTrue(val.validate(CORRECT_ENTITY_TYPE, ids).equals(ids)); }
@Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery nq = new NeutralQuery(new NeutralCriteria(ParameterConstants.TEACHER_ID, NeutralCriteria.OPERATOR_EQUAL, SecurityUtil.getSLIPrincipal().getEntity().getEntityId())); Iterable<String> it = this.repo.findAllIds(EntityNames.TEACHER_SCHOOL_ASSOCIATION, nq); Set<String> fin = Sets.newHashSet(it); fin.retainAll(ids); return fin; }
TeacherToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery nq = new NeutralQuery(new NeutralCriteria(ParameterConstants.TEACHER_ID, NeutralCriteria.OPERATOR_EQUAL, SecurityUtil.getSLIPrincipal().getEntity().getEntityId())); Iterable<String> it = this.repo.findAllIds(EntityNames.TEACHER_SCHOOL_ASSOCIATION, nq); Set<String> fin = Sets.newHashSet(it); fin.retainAll(ids); return fin; } }
TeacherToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery nq = new NeutralQuery(new NeutralCriteria(ParameterConstants.TEACHER_ID, NeutralCriteria.OPERATOR_EQUAL, SecurityUtil.getSLIPrincipal().getEntity().getEntityId())); Iterable<String> it = this.repo.findAllIds(EntityNames.TEACHER_SCHOOL_ASSOCIATION, nq); Set<String> fin = Sets.newHashSet(it); fin.retainAll(ids); return fin; }  }
TeacherToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery nq = new NeutralQuery(new NeutralCriteria(ParameterConstants.TEACHER_ID, NeutralCriteria.OPERATOR_EQUAL, SecurityUtil.getSLIPrincipal().getEntity().getEntityId())); Iterable<String> it = this.repo.findAllIds(EntityNames.TEACHER_SCHOOL_ASSOCIATION, nq); Set<String> fin = Sets.newHashSet(it); fin.retainAll(ids); return fin; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext(); }
TeacherToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery nq = new NeutralQuery(new NeutralCriteria(ParameterConstants.TEACHER_ID, NeutralCriteria.OPERATOR_EQUAL, SecurityUtil.getSLIPrincipal().getEntity().getEntityId())); Iterable<String> it = this.repo.findAllIds(EntityNames.TEACHER_SCHOOL_ASSOCIATION, nq); Set<String> fin = Sets.newHashSet(it); fin.retainAll(ids); return fin; }  @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(String entityType, Set<String> ids); @Override SecurityUtil.UserContext getContext();  }