コード例 #1
0
 /**
  * Determine the districts based upon the EdOrgs supplied.
  *
  * <p>If an SEA is encountered, this is any LEA directly below the SEA. If an LEA or school is
  * encountered, this is the top-most LEA, i.e. the LEA directly associated with the SEA.
  *
  * @param edOrgs - EdOrgs to search
  * @return - List of district entity IDs
  */
 public List<String> getDistricts(Set<String> edOrgs) {
   NeutralQuery query =
       new NeutralQuery(
           new NeutralCriteria(ParameterConstants.ID, NeutralCriteria.CRITERIA_IN, edOrgs, false));
   Set<String> entities = new HashSet<String>();
   for (Entity entity : repo.findAll(EntityNames.EDUCATION_ORGANIZATION, query)) {
     if (helper.isLEA(entity)) {
       List<Entity> topLEAs = helper.getTopLEAOfEdOrg(entity);
       if (topLEAs != null) {
         for (Entity topLEA : topLEAs) {
           entities.add(topLEA.getEntityId());
         }
       }
     } else if (helper.isSchool(entity)) {
       List<Entity> topLEAs = helper.getTopLEAOfEdOrg(entity);
       if (topLEAs != null) {
         for (Entity topLEA : topLEAs) {
           entities.add(topLEA.getEntityId());
         }
       }
     } else { // isSEA
       entities.addAll(getDirectChildLEAsOfEdOrg(entity));
     }
   }
   return new ArrayList<String>(entities);
 }
コード例 #2
0
  public List<String> getDirectSchoolsLineage(Entity principal, boolean getLineage) {
    Set<String> ids = getDirectEdorgs(principal);
    Iterable<Entity> edorgs =
        repo.findAll(
            EntityNames.EDUCATION_ORGANIZATION,
            new NeutralQuery(
                new NeutralCriteria(
                    ParameterConstants.ID, NeutralCriteria.CRITERIA_IN, ids, false)));

    List<String> schools = new ArrayList<String>();
    for (Entity e : edorgs) {
      if (helper.isSchool(e)) {
        schools.add(e.getEntityId());
        if (getLineage) {
          schools.addAll(extractEdorgFromMeta(e));
        }
      }
    }

    return schools;
  }
コード例 #3
0
 @SuppressWarnings("unchecked")
 public boolean isSchool(Entity entity) {
   // passing through
   return helper.isSchool(entity);
 }