Search in sources :

Example 1 with ADL14SymbolExtractor

use of com.nedap.openehr.lsp.symbolextractor.adl14.ADL14SymbolExtractor in project archetype-languageserver by nedap.

the class BroadcastingArchetypeRepository method extractADL14Info.

private void extractADL14Info(TextDocumentItem textDocumentItem) {
    adl14Storage.addFile(textDocumentItem);
    // make sure any ADL 2 things get removed here!
    ADL14SymbolExtractor adlSymbolExtractor = new ADL14SymbolExtractor();
    try {
        DocumentInformation documentInformation = adlSymbolExtractor.extractSymbols(textDocumentItem.getUri(), textDocumentItem.getText());
        symbolsByUri.put(textDocumentItem.getUri(), documentInformation);
        if (documentInformation.getArchetypeId() != null) {
            documentsByArchetypeId.put(documentInformation.getArchetypeId(), textDocumentItem);
        }
        resolveDocumentLinks();
        Archetype archetype = adl14Storage.getArchetype(new TextDocumentIdentifier(textDocumentItem.getUri()));
        if (archetype != null) {
            String language = archetype.getOriginalLanguage() != null ? archetype.getOriginalLanguage().getCodeString() : null;
            if (language == null) {
                language = "en";
            }
            SymbolNameFromTerminologyHelper.giveNames(documentInformation.getSymbols(), archetype, language);
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return;
}
Also used : ADL14SymbolExtractor(com.nedap.openehr.lsp.symbolextractor.adl14.ADL14SymbolExtractor) Archetype(com.nedap.archie.aom.Archetype) DocumentInformation(com.nedap.openehr.lsp.document.DocumentInformation) IOException(java.io.IOException)

Aggregations

Archetype (com.nedap.archie.aom.Archetype)1 DocumentInformation (com.nedap.openehr.lsp.document.DocumentInformation)1 ADL14SymbolExtractor (com.nedap.openehr.lsp.symbolextractor.adl14.ADL14SymbolExtractor)1 IOException (java.io.IOException)1