Search in sources :

Example 1 with ArchetypeTerminology

use of com.nedap.archie.aom.terminology.ArchetypeTerminology in project archetype-languageserver by nedap.

the class ArchetypeHoverInfo method getTerms.

private List<TerminologyCodeWithArchetypeTerm> getTerms(CTerminologyCode cTermCode, DocumentSymbol terminologyCode, Archetype archetypeForTerms) {
    List<TerminologyCodeWithArchetypeTerm> result = new ArrayList();
    ArchetypeTerminology terminology = archetypeForTerms.getTerminology(cTermCode);
    String language = ArchieLanguageConfiguration.getMeaningAndDescriptionLanguage();
    String defaultLanguage = ArchieLanguageConfiguration.getDefaultMeaningAndDescriptionLanguage();
    String constraint = terminologyCode.getName();
    if (constraint.startsWith("at")) {
        ArchetypeTerm termDefinition = terminology.getTermDefinition(language, constraint);
        if (termDefinition == null) {
            termDefinition = terminology.getTermDefinition(defaultLanguage, constraint);
        }
        if (termDefinition != null) {
            result.add(new TerminologyCodeWithArchetypeTerm(constraint, termDefinition));
        }
    } else if (constraint.startsWith("ac")) {
        ValueSet acValueSet = terminology.getValueSets().get(constraint);
        if (acValueSet != null) {
            for (String atCode : acValueSet.getMembers()) {
                ArchetypeTerm termDefinition = terminology.getTermDefinition(language, atCode);
                if (termDefinition == null) {
                    termDefinition = terminology.getTermDefinition(defaultLanguage, atCode);
                }
                if (termDefinition != null) {
                    result.add(new TerminologyCodeWithArchetypeTerm(atCode, termDefinition));
                }
            }
        }
    }
    return result;
}
Also used : TerminologyCodeWithArchetypeTerm(com.nedap.archie.aom.terminology.TerminologyCodeWithArchetypeTerm) ArchetypeTerm(com.nedap.archie.aom.terminology.ArchetypeTerm) ArchetypeTerminology(com.nedap.archie.aom.terminology.ArchetypeTerminology) ArrayList(java.util.ArrayList) TerminologyCodeWithArchetypeTerm(com.nedap.archie.aom.terminology.TerminologyCodeWithArchetypeTerm) ValueSet(com.nedap.archie.aom.terminology.ValueSet)

Aggregations

ArchetypeTerm (com.nedap.archie.aom.terminology.ArchetypeTerm)1 ArchetypeTerminology (com.nedap.archie.aom.terminology.ArchetypeTerminology)1 TerminologyCodeWithArchetypeTerm (com.nedap.archie.aom.terminology.TerminologyCodeWithArchetypeTerm)1 ValueSet (com.nedap.archie.aom.terminology.ValueSet)1 ArrayList (java.util.ArrayList)1