software/browser-util/src/gov/nih/nci/evs/browser/utils/SearchByAssociationIteratorDecorator.java
// IMPORTANT: Apply restrictions to associations for supporting advanced search (to be implemented later)
Apply restrictions to associations for supporting advanced search (to be implemented later)
Apply restrictions to associations for supporting advanced search ( to be implemented later )
protected List<? extends ResolvedConceptReference> resolveOneHit(ResolvedConceptReference hit) throws LBException{
			List<ResolvedConceptReference> returnList = new ArrayList<ResolvedConceptReference>();
			CodingSchemeVersionOrTag tagOrVersion = new CodingSchemeVersionOrTag();
			if (hit.getCodingSchemeVersion() != null) tagOrVersion.setVersion(hit.getCodingSchemeVersion());
            CodedNodeGraph cng = null;
            if (lbSvc == null) {
				return null;
			}
 			cng = lbSvc.getNodeGraph(
					hit.getCodingSchemeName(),
					tagOrVersion,
					null);
            Boolean restrictToAnonymous = Boolean.FALSE;
            cng = cng.restrictToAnonymous(restrictToAnonymous);
            LocalNameList localNameList = new LocalNameList();
            localNameList.addEntry("concept");
            cng = cng.restrictToEntityTypes(localNameList);
			if (_associationNameAndValueList != null) {
				cng =
					cng.restrictToAssociations(
						_associationNameAndValueList,
						_associationQualifierNameAndValueList);
			}
			else {
				String scheme = hit.getCodingSchemeName();
				SimpleDataUtils simpleDataUtils = new SimpleDataUtils(lbSvc);
				boolean isMapping = simpleDataUtils.isMapping(scheme, null);
				if (isMapping) {
					NameAndValueList navl = simpleDataUtils.getMappingAssociationNames(scheme, null);
					if (navl != null) {
						cng = cng.restrictToAssociations(navl, null);
					}
				}
			}
			ConceptReference focus = new ConceptReference();
			focus.setCode(hit.getCode());
			focus.setCodingSchemeName(hit.getCodingSchemeName());
			focus.setCodeNamespace(hit.getCodeNamespace());
			LocalNameList propertyNames = new LocalNameList();
			CodedNodeSet.PropertyType[] propertyTypes = null;
			SortOptionList sortCriteria = null;
			ResolvedConceptReferenceList list =
				cng.resolveAsList(focus,
					_resolveForward, _resolveBackward, 0,
					_resolveAssociationDepth, propertyNames, propertyTypes, sortCriteria,
					_maxToReturn);
			for(ResolvedConceptReference ref : list.getResolvedConceptReference()){
				if (ref.getSourceOf() != null && this.getAssociations(ref.getSourceOf()).size() > 0) {
					returnList.addAll(this.getAssociations(ref.getSourceOf()));
				}
				if (ref.getTargetOf() != null && this.getAssociations(ref.getTargetOf()).size() > 0) {
					returnList.addAll(this.getAssociations(ref.getTargetOf()));
				}
			}
			return returnList;
		}
protected List < ? extends ResolvedConceptReference > resolveOneHit ( ResolvedConceptReference hit ) throws LBException { List < ResolvedConceptReference > returnList = new ArrayList < ResolvedConceptReference > ( ) ; CodingSchemeVersionOrTag tagOrVersion = new CodingSchemeVersionOrTag ( ) ; if ( hit . getCodingSchemeVersion ( ) != null ) tagOrVersion . setVersion ( hit . getCodingSchemeVersion ( ) ) ; CodedNodeGraph cng = null ; if ( lbSvc == null ) { return null ; } cng = lbSvc . getNodeGraph ( hit . getCodingSchemeName ( ) , tagOrVersion , null ) ; Boolean restrictToAnonymous = Boolean . FALSE ; cng = cng . restrictToAnonymous ( restrictToAnonymous ) ; LocalNameList localNameList = new LocalNameList ( ) ; localNameList . addEntry ( "concept" ) ; cng = cng . restrictToEntityTypes ( localNameList ) ; if ( _associationNameAndValueList != null ) { cng = cng . restrictToAssociations ( _associationNameAndValueList , _associationQualifierNameAndValueList ) ; } else { String scheme = hit . getCodingSchemeName ( ) ; SimpleDataUtils simpleDataUtils = new SimpleDataUtils ( lbSvc ) ; boolean isMapping = simpleDataUtils . isMapping ( scheme , null ) ; if ( isMapping ) { NameAndValueList navl = simpleDataUtils . getMappingAssociationNames ( scheme , null ) ; if ( navl != null ) { cng = cng . restrictToAssociations ( navl , null ) ; } } } ConceptReference focus = new ConceptReference ( ) ; focus . setCode ( hit . getCode ( ) ) ; focus . setCodingSchemeName ( hit . getCodingSchemeName ( ) ) ; focus . setCodeNamespace ( hit . getCodeNamespace ( ) ) ; LocalNameList propertyNames = new LocalNameList ( ) ; CodedNodeSet . PropertyType [ ] propertyTypes = null ; SortOptionList sortCriteria = null ; ResolvedConceptReferenceList list = cng . resolveAsList ( focus , _resolveForward , _resolveBackward , 0 , _resolveAssociationDepth , propertyNames , propertyTypes , sortCriteria , _maxToReturn ) ; for ( ResolvedConceptReference ref : list . getResolvedConceptReference ( ) ) { if ( ref . getSourceOf ( ) != null && this . getAssociations ( ref . getSourceOf ( ) ) . size ( ) > 0 ) { returnList . addAll ( this . getAssociations ( ref . getSourceOf ( ) ) ) ; } if ( ref . getTargetOf ( ) != null && this . getAssociations ( ref . getTargetOf ( ) ) . size ( ) > 0 ) { returnList . addAll ( this . getAssociations ( ref . getTargetOf ( ) ) ) ; } } return returnList ; }
IMPORTANT: Apply restrictions to associations for supporting advanced search (to be implemented later)
IMPORTANT : Apply restrictions to associations for supporting advanced search ( to be implemented later )
//if(ref.getSourceOf() != null){ //	returnList.addAll(this.getAssociations(ref.getSourceOf())); //} //if(ref.getTargetOf() != null){ //returnList.addAll(this.getAssociations(ref.getTargetOf())); //}