software/test/performance/src/org/LexGrid/LexBIG/example/remote2/BuildTreeForCode2.java
/**
     * Populate child nodes for a single branch of the tree,
     * and indicates whether further expansion (to grandchildren)
     * is possible.
     */
Populate child nodes for a single branch of the tree,
and indicates whether further expansion (to grandchildren)
is possible.
Populate child nodes for a single branch of the tree and indicates whether further expansion ( to grandchildren ) is possible .
protected void addChildren(TreeItem ti,
            LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
            String scheme, CodingSchemeVersionOrTag csvt,
            String branchRootCode, Set<String> codesToExclude, String[] associationsToNavigate,
            boolean associationsNavigatedFwd)
        throws LBException {
        CodedNodeGraph cng = lbsvc.getNodeGraph(scheme, csvt, null);
        ConceptReference focus = Constructors.createConceptReference(branchRootCode, scheme);
        cng = cng.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null);
        ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
                !associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
        for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
            ResolvedConceptReference node = nodes.next();
            AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
            for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
                Association child = pathsToChildren.next();
                String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
                AssociatedConceptList branchItemList = child.getAssociatedConcepts();
                for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
                        .hasNext();) {
                    AssociatedConcept branchItemNode = branchNodes.next();
                    String branchItemCode = branchItemNode.getConceptCode();
                    if (!codesToExclude.contains(branchItemCode)) {
                        TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
                        AssociationList grandchildBranch =
                            associationsNavigatedFwd
                                ? branchItemNode.getSourceOf()
                                : branchItemNode.getTargetOf();
                        if (grandchildBranch != null)
                            childItem.expandable = true;
                        ti.addChild(childNavText, childItem);
                    }
                }
            }
        }
    }
protected void addChildren ( TreeItem ti , LexBIGService lbsvc , LexBIGServiceConvenienceMethods lbscm , String scheme , CodingSchemeVersionOrTag csvt , String branchRootCode , Set < String > codesToExclude , String [ ] associationsToNavigate , boolean associationsNavigatedFwd ) throws LBException { CodedNodeGraph cng = lbsvc . getNodeGraph ( scheme , csvt , null ) ; ConceptReference focus = Constructors . createConceptReference ( branchRootCode , scheme ) ; cng = cng . restrictToAssociations ( Constructors . createNameAndValueList ( associationsToNavigate ) , null ) ; ResolvedConceptReferenceList branch = cng . resolveAsList ( focus , associationsNavigatedFwd , ! associationsNavigatedFwd , - 1 , 2 , noopList_ , null , null , null , - 1 , true ) ; for ( Iterator < ResolvedConceptReference > nodes = branch . iterateResolvedConceptReference ( ) ; nodes . hasNext ( ) ; ) { ResolvedConceptReference node = nodes . next ( ) ; AssociationList childAssociationList = associationsNavigatedFwd ? node . getSourceOf ( ) : node . getTargetOf ( ) ; for ( Iterator < Association > pathsToChildren = childAssociationList . iterateAssociation ( ) ; pathsToChildren . hasNext ( ) ; ) { Association child = pathsToChildren . next ( ) ; String childNavText = getDirectionalLabel ( lbscm , scheme , csvt , child , associationsNavigatedFwd ) ; AssociatedConceptList branchItemList = child . getAssociatedConcepts ( ) ; for ( Iterator < AssociatedConcept > branchNodes = branchItemList . iterateAssociatedConcept ( ) ; branchNodes . hasNext ( ) ; ) { AssociatedConcept branchItemNode = branchNodes . next ( ) ; String branchItemCode = branchItemNode . getConceptCode ( ) ; if ( ! codesToExclude . contains ( branchItemCode ) ) { TreeItem childItem = new TreeItem ( branchItemCode , getCodeDescription ( branchItemNode ) ) ; AssociationList grandchildBranch = associationsNavigatedFwd ? branchItemNode . getSourceOf ( ) : branchItemNode . getTargetOf ( ) ; if ( grandchildBranch != null ) childItem . expandable = true ; ti . addChild ( childNavText , childItem ) ; } } } } }
Populate child nodes for a single branch of the tree,
 and indicates whether further expansion (to grandchildren)
 is possible.
Populate child nodes for a single branch of the tree and indicates whether further expansion ( to grandchildren ) is possible .
// Resolve the next branch, representing children of the given
 // code, navigated according to the provided relationship and
 // direction.  Resolve the children as a code graph, looking 2
 // levels deep but leaving the final level unresolved.
 // The resolved branch will be represented by the first node in
 // the resolved list.  The node will be subdivided by source or
 // target associations (depending on direction). The associated
 // nodes define the children.
 // Process each association defining children ...
 // Each association may have multiple children ...
 // Add here if not in the list of excluded codes.
 // This is also where we look to see if another level
 // was indicated to be available.  If so, mark the
 // entry with a '+' to indicate it can be expanded.
