@Override public boolean validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.PROGRAM, entityType, ids)) { return false; } NeutralQuery nq = new NeutralQuery( new NeutralCriteria( "body.staffId", "=", SecurityUtil.getSLIPrincipal().getEntity().getEntityId(), false)); if (SecurityUtil.getSLIPrincipal().isStudentAccessFlag()) { nq.addCriteria( new NeutralCriteria( ParameterConstants.STUDENT_RECORD_ACCESS, NeutralCriteria.OPERATOR_EQUAL, true)); } // Fetch associations addEndDateToQuery(nq, false); Set<String> programsToValidate = new HashSet<String>(ids); Iterable<Entity> assocs = getRepo().findAll(EntityNames.STAFF_PROGRAM_ASSOCIATION, nq); for (Entity assoc : assocs) { programsToValidate.remove((String) assoc.getBody().get("programId")); } return programsToValidate.isEmpty(); }
/** Get directly associated education organizations for the authenticated principal. */ public Set<String> getDirectEdorgs() { return getDirectEdorgs(SecurityUtil.getSLIPrincipal().getEntity()); }