software/test/performance/src/org/LexGrid/LexBIG/example/remote2/BuildTreeForCode2.java
/**
     * Recursive call to reverse order of the given association list, adding
     * results to the given list. In context of this program we use this
     * technique to determine the path from root, starting from the path to root
     * provided by the standard convenience method.
     */
Recursive call to reverse order of the given association list, adding
results to the given list. In context of this program we use this
technique to determine the path from root, starting from the path to root
provided by the standard convenience method.
Recursive call to reverse order of the given association list adding results to the given list . In context of this program we use this technique to determine the path from root starting from the path to root provided by the standard convenience method .
protected AssociationList reverseAssoc(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, String scheme,
            CodingSchemeVersionOrTag csvt, Association assoc, AssociationList addTo,
            Map<String, EntityDescription> codeToEntityDescriptionMap) throws LBException {
        ConceptReference acRef = assoc.getAssociationReference();
        AssociatedConcept acFromRef = new AssociatedConcept();
        acFromRef.setCodingScheme(acRef.getCodingScheme());
        acFromRef.setConceptCode(acRef.getConceptCode());
        AssociationList acSources = new AssociationList();
        acFromRef.setIsNavigable(Boolean.TRUE);
        acFromRef.setSourceOf(acSources);
        if (codeToEntityDescriptionMap.containsKey(acRef.getConceptCode()))
            acFromRef.setEntityDescription(codeToEntityDescriptionMap.get(acRef.getConceptCode()));
        else
            acFromRef.setEntityDescription(Constructors.createEntityDescription(getCodeDescription(lbsvc, scheme, csvt,
                    acRef.getConceptCode())));
        AssociatedConceptList acl = assoc.getAssociatedConcepts();
        for (AssociatedConcept ac : acl.getAssociatedConcept()) {
            Association rAssoc = new Association();
            rAssoc.setAssociationName(assoc.getAssociationName());
            ConceptReference ref = new ConceptReference();
            ref.setCodingScheme(ac.getCodingScheme());
            ref.setConceptCode(ac.getConceptCode());
            rAssoc.setAssociationReference(ref);
            AssociatedConceptList rAcl = new AssociatedConceptList();
            rAcl.addAssociatedConcept(acFromRef);
            rAssoc.setAssociatedConcepts(rAcl);
            String dirName = assoc.getDirectionalName();
            if (dirName != null)
                try {
                    rAssoc.setDirectionalName(lbscm.isForwardName(scheme, csvt, dirName) ? lbscm
                            .getAssociationReverseName(assoc.getAssociationName(), scheme, csvt) : lbscm
                            .getAssociationReverseName(assoc.getAssociationName(), scheme, csvt));
                } catch (LBException e) {
                }
            codeToEntityDescriptionMap.put(ac.getConceptCode(), ac.getEntityDescription());
            AssociationList sourceOf = ac.getSourceOf();
            if (sourceOf != null)
                for (Association sourceAssoc : sourceOf.getAssociation()) {
                    AssociationList pos = reverseAssoc(lbsvc, lbscm, scheme, csvt, sourceAssoc, addTo,
                            codeToEntityDescriptionMap);
                    pos.addAssociation(rAssoc);
                }
            else
                addTo.addAssociation(rAssoc);
        }
        return acSources;
    }
protected AssociationList reverseAssoc ( LexBIGService lbsvc , LexBIGServiceConvenienceMethods lbscm , String scheme , CodingSchemeVersionOrTag csvt , Association assoc , AssociationList addTo , Map < String , EntityDescription > codeToEntityDescriptionMap ) throws LBException { ConceptReference acRef = assoc . getAssociationReference ( ) ; AssociatedConcept acFromRef = new AssociatedConcept ( ) ; acFromRef . setCodingScheme ( acRef . getCodingScheme ( ) ) ; acFromRef . setConceptCode ( acRef . getConceptCode ( ) ) ; AssociationList acSources = new AssociationList ( ) ; acFromRef . setIsNavigable ( Boolean . TRUE ) ; acFromRef . setSourceOf ( acSources ) ; if ( codeToEntityDescriptionMap . containsKey ( acRef . getConceptCode ( ) ) ) acFromRef . setEntityDescription ( codeToEntityDescriptionMap . get ( acRef . getConceptCode ( ) ) ) ; else acFromRef . setEntityDescription ( Constructors . createEntityDescription ( getCodeDescription ( lbsvc , scheme , csvt , acRef . getConceptCode ( ) ) ) ) ; AssociatedConceptList acl = assoc . getAssociatedConcepts ( ) ; for ( AssociatedConcept ac : acl . getAssociatedConcept ( ) ) { Association rAssoc = new Association ( ) ; rAssoc . setAssociationName ( assoc . getAssociationName ( ) ) ; ConceptReference ref = new ConceptReference ( ) ; ref . setCodingScheme ( ac . getCodingScheme ( ) ) ; ref . setConceptCode ( ac . getConceptCode ( ) ) ; rAssoc . setAssociationReference ( ref ) ; AssociatedConceptList rAcl = new AssociatedConceptList ( ) ; rAcl . addAssociatedConcept ( acFromRef ) ; rAssoc . setAssociatedConcepts ( rAcl ) ; String dirName = assoc . getDirectionalName ( ) ; if ( dirName != null ) try { rAssoc . setDirectionalName ( lbscm . isForwardName ( scheme , csvt , dirName ) ? lbscm . getAssociationReverseName ( assoc . getAssociationName ( ) , scheme , csvt ) : lbscm . getAssociationReverseName ( assoc . getAssociationName ( ) , scheme , csvt ) ) ; } catch ( LBException e ) { } codeToEntityDescriptionMap . put ( ac . getConceptCode ( ) , ac . getEntityDescription ( ) ) ; AssociationList sourceOf = ac . getSourceOf ( ) ; if ( sourceOf != null ) for ( Association sourceAssoc : sourceOf . getAssociation ( ) ) { AssociationList pos = reverseAssoc ( lbsvc , lbscm , scheme , csvt , sourceAssoc , addTo , codeToEntityDescriptionMap ) ; pos . addAssociation ( rAssoc ) ; } else addTo . addAssociation ( rAssoc ) ; } return acSources ; }
Recursive call to reverse order of the given association list, adding
 results to the given list.
Recursive call to reverse order of the given association list adding results to the given list .
// Use cached description if available (should be cached
 // for all but original root) ...
 // Otherwise retrieve on demand ...
 // Create reverse association (same non-directional name)
 // On reverse, old associated concept is new reference point.
 // And old reference is new associated concept.
 // Set reverse directional name, if available.
 // Save code desc for future reference when setting up
 // concept references in recursive calls ...
