예제 #1
0
 public boolean hasSubOrgPermission(String contentOrganizationId) {
   String[] subOrgUids = UserGroupSupport.getUserOrganizationUids();
   if (subOrgUids != null && subOrgUids.length > 0) {
     for (String userSuborganizationId : subOrgUids) {
       if (contentOrganizationId.equals(userSuborganizationId)) {
         return true;
       }
     }
   }
   return false;
 }
예제 #2
0
 public Set<StandardFo> getContentStandards(Set<Code> taxonomySet, String contentGooruOid) {
   Set<StandardFo> standards = new HashSet<StandardFo>();
   if (taxonomySet != null) {
     for (Code code : taxonomySet) {
       if (code.getRootNodeId() != null
           && UserGroupSupport.getTaxonomyPreference() != null
           && UserGroupSupport.getTaxonomyPreference().contains(code.getRootNodeId().toString())) {
         StandardFo standardFo = new StandardFo();
         if (code.getLabel() != null && !code.getLabel().equals("")) {
           standardFo.setDescription(code.getLabel());
         }
         if (code.getCommonCoreDotNotation() != null
             && !code.getCommonCoreDotNotation().equals("")) {
           standardFo.setCode(code.getCommonCoreDotNotation().replace(".--", " "));
         } else if (code.getCode() != null && !code.getCode().equals("")) {
           standardFo.setCode(code.getCode().replace(".--", " "));
         }
         standards.add(standardFo);
       }
     }
   }
   return standards;
 }
예제 #3
0
  public JSONObject getContentTaxonomyData(Set<Code> taxonomySet, String contentGooruOid) {
    JSONObject collectionTaxonomy = new JSONObject();
    try {
      Iterator<Code> iter = taxonomySet.iterator();
      Set<String> subject = new HashSet<String>();
      Set<String> course = new HashSet<String>();
      Set<String> unit = new HashSet<String>();
      Set<String> topic = new HashSet<String>();
      Set<String> lesson = new HashSet<String>();
      List<String> curriculumCode = new ArrayList<String>();
      List<String> curriculumDesc = new ArrayList<String>();
      List<String> curriculumName = new ArrayList<String>();
      while (iter.hasNext()) {
        Code code = iter.next();
        try {
          this.getProcedureExecutor().setCode(code);
          Map codeMap = this.getProcedureExecutor().execute();

          String codeLabel = (String) codeMap.get(CODE_LABEL);
          String[] taxonomy = codeLabel.split("\\$\\@");

          int length = taxonomy.length;
          if (length > 1) {
            subject.add(taxonomy[length - 2]);
          }
          if (length > 2) {
            course.add(taxonomy[length - 3]);
          }
          if (length > 3) {
            unit.add(taxonomy[length - 4]);
          }
          if (length > 4) {
            topic.add(taxonomy[length - 5]);
          }
          if (length > 5) {
            lesson.add(taxonomy[length - 6]);
          }
        } catch (Exception e) {
          logger.debug(e.getMessage());
        }
      }

      if (taxonomySet != null) {
        for (Code code : taxonomySet) {
          if (code.getRootNodeId() != null
              && UserGroupSupport.getTaxonomyPreference() != null
              && UserGroupSupport.getTaxonomyPreference()
                  .contains(code.getRootNodeId().toString())) {
            String codeOrDisplayCode = "";
            if (code.getCommonCoreDotNotation() != null
                && !code.getCommonCoreDotNotation().equals("")) {
              codeOrDisplayCode = code.getCommonCoreDotNotation().replace(".--", " ");
            } else if (code.getCode() != null && !code.getCode().equals("")) {
              codeOrDisplayCode = code.getCode().replace(".--", " ");
            }
            if (!curriculumCode.contains(codeOrDisplayCode)) {
              // string replace has been added to fix the ".--" issue
              // code
              // in USCCM (US Common Core Math - Curriculum)
              curriculumCode.add(codeOrDisplayCode);
              if (code.getLabel() != null && !code.getLabel().equals("")) {
                curriculumDesc.add(code.getLabel());
              } else {
                curriculumDesc.add(BLANK + codeOrDisplayCode);
              }
              Code rootNode = this.getTaxonomyRepository().findCodeByCodeId(code.getRootNodeId());
              if (rootNode == null) {
                logger.error(
                    "FIXME: Taxonomy root was found null for code id" + code.getRootNodeId());
                continue;
              }
              String curriculumLabel = this.getTaxonomyRepository().findRootLevelTaxonomy(rootNode);
              curriculumName.add(curriculumLabel);
            }
          }
        }
      }
      JSONObject curriculumTaxonomy = new JSONObject();
      curriculumTaxonomy
          .put(CURRICULUM_CODE, curriculumCode)
          .put(CURRICULUM_DESC, curriculumDesc)
          .put(CURRICULUM_NAME, curriculumName);
      collectionTaxonomy.put(SUBJECT, subject);
      collectionTaxonomy.put(COURSE, course);
      collectionTaxonomy.put(TOPIC, topic);
      collectionTaxonomy.put(UNIT, unit);
      collectionTaxonomy.put(LESSON, lesson);
      collectionTaxonomy.put(CURRICULUM, curriculumTaxonomy);
    } catch (Exception e) {
      logger.error("failed to fetch ");
    }
    return collectionTaxonomy;
  }