Search in sources :

Example 1 with TerminologyCapabilitiesCodeSystemComponent

use of org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method supportsSystem.

@Override
public boolean supportsSystem(String system) throws TerminologyServiceException {
    synchronized (lock) {
        if (codeSystems.containsKey(system) && codeSystems.get(system).getContent() != CodeSystemContentMode.NOTPRESENT)
            return true;
        else if (supportedCodeSystems.contains(system))
            return true;
        else if (system.startsWith("http://example.org") || system.startsWith("http://acme.com") || system.startsWith("http://hl7.org/fhir/valueset-") || system.startsWith("urn:oid:"))
            return false;
        else {
            if (noTerminologyServer)
                return false;
            if (txcaps == null) {
                try {
                    log("Terminology server: Check for supported code systems for " + system);
                    txcaps = txClient.getTerminologyCapabilities();
                } catch (Exception e) {
                    if (canRunWithoutTerminology) {
                        noTerminologyServer = true;
                        log("==============!! Running without terminology server !! ==============");
                        if (txClient != null) {
                            log("txServer = " + txClient.getAddress());
                            log("Error = " + e.getMessage() + "");
                        }
                        log("=====================================================================");
                        return false;
                    } else
                        throw new TerminologyServiceException(e);
                }
                if (txcaps != null) {
                    for (TerminologyCapabilitiesCodeSystemComponent tccs : txcaps.getCodeSystem()) {
                        supportedCodeSystems.add(tccs.getUri());
                    }
                }
                if (supportedCodeSystems.contains(system))
                    return true;
            }
        }
        return false;
    }
}
Also used : TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) TerminologyCapabilitiesCodeSystemComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) FileNotFoundException(java.io.FileNotFoundException) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)1 TerminologyCapabilitiesCodeSystemComponent (org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent)1