software/browser-util/src/gov/nih/nci/evs/browser/utils/ConceptEntity.java
/**
     * Display properties for the given code.
     *
     * @param code
     * @param lbSvc
     * @param scheme
     * @param csvt
     * @return
     * @throws LBException
     */
Display properties for the given code.


Display properties for the given code .
protected boolean printProps(String code, String scheme, CodingSchemeVersionOrTag csvt)
            throws LBException {
        System.out.println("======================================================================");
        System.out.println("Coding scheme: " + scheme);
        System.out.println("Coding scheme version: " + csvt.getVersion());
        System.out.println("code: " + code);
        System.out.println("======================================================================");
        ConceptReferenceList crefs = ConvenienceMethods.createConceptReferenceList(new String[] { code }, scheme);
        CodedNodeSet cns = lbSvc.getCodingSchemeConcepts(scheme, csvt);
if (cns == null) {
System.out.println("CNS == NULL???");
return false;
}
        cns = cns.restrictToStatus(ActiveOption.ALL, null);
        cns = cns.restrictToCodes(crefs);
        ResolvedConceptReferenceList matches = cns.resolveToList(null, null, null, 1);
        if (matches.getResolvedConceptReferenceCount() > 0) {
            ResolvedConceptReference ref = (ResolvedConceptReference) matches.enumerateResolvedConceptReference()
                    .nextElement();
            Entity node = ref.getEntity();
            Presentation[] prsentations = node.getPresentation();
            if (prsentations == null) return false;
            for (int i = 0; i < prsentations.length; i++) {
                 Presentation presentation = prsentations[i];
                 if (presentation == null) return false;
                 displayMessage(new StringBuffer().append("\tPresentation name: ").append(presentation.getPropertyName())
                         .append(" text: ").append(presentation.getValue().getContent()).toString());
                 PropertyQualifier[] qualifiers = presentation.getPropertyQualifier();
                 if (qualifiers == null) return false;
                 for (int k=0; k<qualifiers.length; k++) {
                      PropertyQualifier qualifier = qualifiers[k];
						 if (qualifier == null) return false;
						 displayMessage(new StringBuffer().append("\t\tQualifier name: ").append(qualifier.getPropertyQualifierName())
								 .append(" text: ").append(qualifier.getValue().getContent()).toString());
				 }
                 Source[] sources = presentation.getSource();
                 if (sources == null) return false;
                 for (int k=0; k<sources.length; k++) {
                      Source source = sources[k];
						 displayMessage(new StringBuffer().append("\t\tSource: ").append(source.getContent()).toString());
				 }
            }
            System.out.println("\n");
            Definition[] definitions = node.getDefinition();
            if (definitions == null) return false;
            for (int i = 0; i < definitions.length; i++) {
                Definition definition = definitions[i];
                if (definition == null) return false;
                displayMessage(new StringBuffer().append("\tDefinition name: ").append(definition.getPropertyName())
                        .append(" text: ").append(definition.getValue().getContent()).toString());
            }
            System.out.println("\n");
            Comment[] comments = node.getComment();
            if (comments == null) return false;
            for (int i = 0; i < comments.length; i++) {
                Comment comment = comments[i];
                if (comment == null) return false;
                displayMessage(new StringBuffer().append("\tComment name: ").append(comment.getPropertyName())
                        .append(" text: ").append(comment.getValue().getContent()).toString());
            }
            System.out.println("\n");
            Property[] props = node.getProperty();
            if (props == null) return false;
            for (int i = 0; i < props.length; i++) {
                Property prop = props[i];
                if (prop == null) return false;
                displayMessage(new StringBuffer().append("\tProperty name: ").append(prop.getPropertyName())
                        .append(" text: ").append(prop.getValue().getContent()).toString());
            }
            System.out.println("\n");
            System.out.println("\n=========================================================================");
            props = node.getAllProperties();
            for (int i = 0; i < props.length; i++) {
                Property prop = props[i];
                if (prop == null) return false;
                displayMessage(new StringBuffer().append("\tProperty name: ").append(prop.getPropertyName())
                        .append(" text: ").append(prop.getValue().getContent()).toString());
            }
            System.out.println("\n");
        } else {
            displayMessage("No match found!");
            return false;
        }
        return true;
    }
protected boolean printProps ( String code , String scheme , CodingSchemeVersionOrTag csvt ) throws LBException { System . out . println ( "======================================================================" ) ; System . out . println ( "Coding scheme: " + scheme ) ; System . out . println ( "Coding scheme version: " + csvt . getVersion ( ) ) ; System . out . println ( "code: " + code ) ; System . out . println ( "======================================================================" ) ; ConceptReferenceList crefs = ConvenienceMethods . createConceptReferenceList ( new String [ ] { code } , scheme ) ; CodedNodeSet cns = lbSvc . getCodingSchemeConcepts ( scheme , csvt ) ; if ( cns == null ) { System . out . println ( "CNS == NULL???" ) ; return false ; } cns = cns . restrictToStatus ( ActiveOption . ALL , null ) ; cns = cns . restrictToCodes ( crefs ) ; ResolvedConceptReferenceList matches = cns . resolveToList ( null , null , null , 1 ) ; if ( matches . getResolvedConceptReferenceCount ( ) > 0 ) { ResolvedConceptReference ref = ( ResolvedConceptReference ) matches . enumerateResolvedConceptReference ( ) . nextElement ( ) ; Entity node = ref . getEntity ( ) ; Presentation [ ] prsentations = node . getPresentation ( ) ; if ( prsentations == null ) return false ; for ( int i = 0 ; i < prsentations . length ; i ++ ) { Presentation presentation = prsentations [ i ] ; if ( presentation == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\tPresentation name: " ) . append ( presentation . getPropertyName ( ) ) . append ( " text: " ) . append ( presentation . getValue ( ) . getContent ( ) ) . toString ( ) ) ; PropertyQualifier [ ] qualifiers = presentation . getPropertyQualifier ( ) ; if ( qualifiers == null ) return false ; for ( int k = 0 ; k < qualifiers . length ; k ++ ) { PropertyQualifier qualifier = qualifiers [ k ] ; if ( qualifier == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\t\tQualifier name: " ) . append ( qualifier . getPropertyQualifierName ( ) ) . append ( " text: " ) . append ( qualifier . getValue ( ) . getContent ( ) ) . toString ( ) ) ; } Source [ ] sources = presentation . getSource ( ) ; if ( sources == null ) return false ; for ( int k = 0 ; k < sources . length ; k ++ ) { Source source = sources [ k ] ; displayMessage ( new StringBuffer ( ) . append ( "\t\tSource: " ) . append ( source . getContent ( ) ) . toString ( ) ) ; } } System . out . println ( "\n" ) ; Definition [ ] definitions = node . getDefinition ( ) ; if ( definitions == null ) return false ; for ( int i = 0 ; i < definitions . length ; i ++ ) { Definition definition = definitions [ i ] ; if ( definition == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\tDefinition name: " ) . append ( definition . getPropertyName ( ) ) . append ( " text: " ) . append ( definition . getValue ( ) . getContent ( ) ) . toString ( ) ) ; } System . out . println ( "\n" ) ; Comment [ ] comments = node . getComment ( ) ; if ( comments == null ) return false ; for ( int i = 0 ; i < comments . length ; i ++ ) { Comment comment = comments [ i ] ; if ( comment == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\tComment name: " ) . append ( comment . getPropertyName ( ) ) . append ( " text: " ) . append ( comment . getValue ( ) . getContent ( ) ) . toString ( ) ) ; } System . out . println ( "\n" ) ; Property [ ] props = node . getProperty ( ) ; if ( props == null ) return false ; for ( int i = 0 ; i < props . length ; i ++ ) { Property prop = props [ i ] ; if ( prop == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\tProperty name: " ) . append ( prop . getPropertyName ( ) ) . append ( " text: " ) . append ( prop . getValue ( ) . getContent ( ) ) . toString ( ) ) ; } System . out . println ( "\n" ) ; System . out . println ( "\n=========================================================================" ) ; props = node . getAllProperties ( ) ; for ( int i = 0 ; i < props . length ; i ++ ) { Property prop = props [ i ] ; if ( prop == null ) return false ; displayMessage ( new StringBuffer ( ) . append ( "\tProperty name: " ) . append ( prop . getPropertyName ( ) ) . append ( " text: " ) . append ( prop . getValue ( ) . getContent ( ) ) . toString ( ) ) ; } System . out . println ( "\n" ) ; } else { displayMessage ( "No match found!" ) ; return false ; } return true ; }
Display properties for the given code.
Display properties for the given code .
// Perform the query ...
 // Analyze the result ...
