@Test public void testHeirarchicalEdorgs() { RequestUtil.setCurrentRequestId(); List<String> edorgs = helper.getParentEdOrgs(school1); assertEquals(2, edorgs.size()); assertFalse("school1 should not see lea3", edorgs.contains(lea3.getEntityId())); assertFalse("school1 should not see lea2", edorgs.contains(lea2.getEntityId())); assertTrue("school1 should see lea1", edorgs.contains(lea1.getEntityId())); assertTrue("school1 should see sea1", edorgs.contains(sea1.getEntityId())); }
public List<String> getParentEdOrgs(Entity edOrgEntity) { List<String> toReturn = new ArrayList<String>(); Map<String, Entity> edOrgCache = loadEdOrgCache(); Set<String> visitedEdOrgs = new HashSet<String>(); if (edOrgEntity != null) { String myId = edOrgEntity.getEntityId(); if (myId != null) { visitedEdOrgs.add(myId); toReturn = getParentEdOrgs(edOrgEntity, edOrgCache, visitedEdOrgs, toReturn); } } return toReturn; }
EdOrgHelper { public List<String> getParentEdOrgs(Entity edOrgEntity) { List<String> toReturn = new ArrayList<String>(); Map<String, Entity> edOrgCache = loadEdOrgCache(); Set<String> visitedEdOrgs = new HashSet<String>(); if (edOrgEntity != null) { String myId = edOrgEntity.getEntityId(); if (myId != null) { visitedEdOrgs.add(myId); toReturn = getParentEdOrgs(edOrgEntity, edOrgCache, visitedEdOrgs, toReturn); } } return toReturn; } }
EdOrgHelper { public List<String> getParentEdOrgs(Entity edOrgEntity) { List<String> toReturn = new ArrayList<String>(); Map<String, Entity> edOrgCache = loadEdOrgCache(); Set<String> visitedEdOrgs = new HashSet<String>(); if (edOrgEntity != null) { String myId = edOrgEntity.getEntityId(); if (myId != null) { visitedEdOrgs.add(myId); toReturn = getParentEdOrgs(edOrgEntity, edOrgCache, visitedEdOrgs, toReturn); } } return toReturn; }  }
EdOrgHelper { public List<String> getParentEdOrgs(Entity edOrgEntity) { List<String> toReturn = new ArrayList<String>(); Map<String, Entity> edOrgCache = loadEdOrgCache(); Set<String> visitedEdOrgs = new HashSet<String>(); if (edOrgEntity != null) { String myId = edOrgEntity.getEntityId(); if (myId != null) { visitedEdOrgs.add(myId); toReturn = getParentEdOrgs(edOrgEntity, edOrgCache, visitedEdOrgs, toReturn); } } return toReturn; }  @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 List<String> getParentEdOrgs(Entity edOrgEntity) { List<String> toReturn = new ArrayList<String>(); Map<String, Entity> edOrgCache = loadEdOrgCache(); Set<String> visitedEdOrgs = new HashSet<String>(); if (edOrgEntity != null) { String myId = edOrgEntity.getEntityId(); if (myId != null) { visitedEdOrgs.add(myId); toReturn = getParentEdOrgs(edOrgEntity, edOrgCache, visitedEdOrgs, toReturn); } } return toReturn; }  @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);  }