Exemplo n.º 1
0
 public NameAndValueList getMappingAssociationNames(String scheme, String version) {
   CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
   if (version != null) {
     csvt.setVersion(version);
   }
   NameAndValueList navList = new NameAndValueList();
   try {
     CodingScheme cs = lbSvc.resolveCodingScheme(scheme, csvt);
     Relations[] relations = cs.getRelations();
     for (int i = 0; i < relations.length; i++) {
       Relations relation = relations[i];
       Boolean isMapping = relation.isIsMapping();
       if (isMapping != null && isMapping.equals(Boolean.TRUE)) {
         AssociationPredicate[] associationPredicates = relation.getAssociationPredicate();
         for (int j = 0; j < associationPredicates.length; j++) {
           AssociationPredicate associationPredicate = associationPredicates[j];
           String name = associationPredicate.getAssociationName();
           NameAndValue vNameAndValue = new NameAndValue();
           vNameAndValue.setName(name);
           navList.addNameAndValue(vNameAndValue);
         }
         return navList;
       } else {
         return null;
       }
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   }
   return null;
 }
Exemplo n.º 2
0
  public ResolvedConceptReferencesIterator getMappingDataIterator(
      String scheme, String version, List<MappingSortOption> sortOptionList) {
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    if (version != null) {
      versionOrTag.setVersion(version);
    }
    String relationsContainerName = null;
    try {

      CodingScheme cs = lbSvc.resolveCodingScheme(scheme, versionOrTag);
      if (cs == null) return null;

      java.util.Enumeration<? extends Relations> relations = cs.enumerateRelations();
      while (relations.hasMoreElements()) {
        Relations relation = (Relations) relations.nextElement();
        Boolean isMapping = relation.getIsMapping();
        if (isMapping != null && isMapping.equals(Boolean.TRUE)) {
          relationsContainerName = relation.getContainerName();
          break;
        }
      }
      if (relationsContainerName == null) {
        return null;
      }

      MappingExtension mappingExtension =
          (MappingExtension) lbSvc.getGenericExtension("MappingExtension");

      ResolvedConceptReferencesIterator itr =
          mappingExtension.resolveMapping(
              scheme, versionOrTag, relationsContainerName, sortOptionList);

      return itr;

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }