@Test public void testTeacher3LocateSEOAs() { NeutralQuery staffQuery = new NeutralQuery(); staffQuery.addCriteria(new NeutralCriteria(ParameterConstants.STAFF_UNIQUE_STATE_ID, NeutralCriteria.OPERATOR_EQUAL, teacher3.getEntityId())); repo.deleteAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, staffQuery); Date now = new Date(); setupSEOAs(repo, now.getTime(), teacher3, school3.getEntityId()); Set<Entity> associations = helper.locateNonExpiredSEOAs(teacher3.getEntityId()); assertTrue("teacher3 should have 3 valid associations", associations.size() == 3); }
public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo.findAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, basicQuery); for (Entity association : associations) { if (!dateHelper.isFieldExpired(association.getBody(), ParameterConstants.END_DATE, false)) { validAssociations.add(association); } } return validAssociations; }
EdOrgHelper { public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo.findAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, basicQuery); for (Entity association : associations) { if (!dateHelper.isFieldExpired(association.getBody(), ParameterConstants.END_DATE, false)) { validAssociations.add(association); } } return validAssociations; } }
EdOrgHelper { public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo.findAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, basicQuery); for (Entity association : associations) { if (!dateHelper.isFieldExpired(association.getBody(), ParameterConstants.END_DATE, false)) { validAssociations.add(association); } } return validAssociations; }  }
EdOrgHelper { public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo.findAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, basicQuery); for (Entity association : associations) { if (!dateHelper.isFieldExpired(association.getBody(), ParameterConstants.END_DATE, false)) { validAssociations.add(association); } } return validAssociations; }  @PostConstruct void init(); List<String> getDistricts(Entity user); List<String> getDistricts(Set<String> edOrgs); List<String> getDirectChildLEAsOfEdOrg(Entity edOrgEntity); Set<String> getAllChildLEAsOfEdOrg(Entity edOrgEntity); List<String> getParentEdOrgs(Entity edOrgEntity); Entity byId(String edOrgId); boolean isSEA(Entity entity); String getSEAOfEdOrg(Entity entity); List<String> getDirectSchools(Entity principal); List<String> getDirectSchoolsLineage(Entity principal, boolean getLineage); Set<String> getChildEdOrgs(Collection<String> edOrgs); Set<String> getChildEdOrgs(String edOrg); Set<String> getChildEdOrgs(final Set<String> visitedEdOrgs, Collection<String> edOrgs); Set<String> getChildEdOrgsName(Collection<String> parentEdOrgIds); Set<String> getChildEdOrgsName(Collection<String> parentEdOrgIds, boolean includeParents); Collection<String> getUserEdOrgs(Entity principal); Set<String> getStaffEdOrgsAndChildren(); Set<String> getEdorgDescendents(Set<String> edOrgLineage); Set<String> getDelegatedEdorgDescendents(); boolean isFieldExpired(Map<String, Object> body, String fieldName, boolean useGracePeriod); @SuppressWarnings("unchecked") boolean isLEA(Entity entity); @SuppressWarnings("unchecked") boolean isSchool(Entity entity); Set<String> getDirectEdorgs(); Set<String> getDirectEdorgs(Entity principal); List<String> getUserEdorgs(Entity principal); Set<String> locateDirectEdorgs(Entity principal); Set<Entity> locateValidSEOAs(String staffId, boolean filterByOwnership); Set<Entity> locateNonExpiredSEOAs(String staffId); Set<String> getEdOrgStateOrganizationIds(Set<String> edOrgIds); }
EdOrgHelper { public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo.findAll(EntityNames.STAFF_ED_ORG_ASSOCIATION, basicQuery); for (Entity association : associations) { if (!dateHelper.isFieldExpired(association.getBody(), ParameterConstants.END_DATE, false)) { validAssociations.add(association); } } return validAssociations; }  @PostConstruct void init(); List<String> getDistricts(Entity user); List<String> getDistricts(Set<String> edOrgs); List<String> getDirectChildLEAsOfEdOrg(Entity edOrgEntity); Set<String> getAllChildLEAsOfEdOrg(Entity edOrgEntity); List<String> getParentEdOrgs(Entity edOrgEntity); Entity byId(String edOrgId); boolean isSEA(Entity entity); String getSEAOfEdOrg(Entity entity); List<String> getDirectSchools(Entity principal); List<String> getDirectSchoolsLineage(Entity principal, boolean getLineage); Set<String> getChildEdOrgs(Collection<String> edOrgs); Set<String> getChildEdOrgs(String edOrg); Set<String> getChildEdOrgs(final Set<String> visitedEdOrgs, Collection<String> edOrgs); Set<String> getChildEdOrgsName(Collection<String> parentEdOrgIds); Set<String> getChildEdOrgsName(Collection<String> parentEdOrgIds, boolean includeParents); Collection<String> getUserEdOrgs(Entity principal); Set<String> getStaffEdOrgsAndChildren(); Set<String> getEdorgDescendents(Set<String> edOrgLineage); Set<String> getDelegatedEdorgDescendents(); boolean isFieldExpired(Map<String, Object> body, String fieldName, boolean useGracePeriod); @SuppressWarnings("unchecked") boolean isLEA(Entity entity); @SuppressWarnings("unchecked") boolean isSchool(Entity entity); Set<String> getDirectEdorgs(); Set<String> getDirectEdorgs(Entity principal); List<String> getUserEdorgs(Entity principal); Set<String> locateDirectEdorgs(Entity principal); Set<Entity> locateValidSEOAs(String staffId, boolean filterByOwnership); Set<Entity> locateNonExpiredSEOAs(String staffId); Set<String> getEdOrgStateOrganizationIds(Set<String> edOrgIds);  }