revise error message when can't connect to the terminology server

This commit is contained in:
Grahame Grieve 2020-10-08 20:59:39 +11:00
parent cb25ef1bd1
commit d20582ca9d
4 changed files with 21 additions and 3 deletions

View File

@ -148,6 +148,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
private boolean ignoreProfileErrors;
private boolean progress;
private List<String> loadedPackages = new ArrayList<String>();
private boolean canNoTS;
public SimpleWorkerContext() throws FileNotFoundException, IOException, FHIRException {
super();
@ -299,7 +300,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
setTxCaps(txClient.getTerminologyCapabilities());
return cps.getSoftware().getVersion();
} catch (Exception e) {
throw new FHIRException(formatMessage(I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__, e.getMessage()), e);
throw new FHIRException(formatMessage(canNoTS ? I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ : I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER, e.getMessage()), e);
}
}
@ -813,6 +814,15 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
public void setClock(TimeTracker tt) {
clock = tt;
}
public boolean isCanNoTS() {
return canNoTS;
}
public void setCanNoTS(boolean canNoTS) {
this.canNoTS = canNoTS;
}
}
}

View File

@ -478,6 +478,7 @@ public class I18nConstants {
public static final String TYPE_SPECIFIC_CHECKS_DT_URL_RESOLVE = "Type_Specific_Checks_DT_URL_Resolve";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_STRAT = "Type_Specific_Checks_DT_UUID_Strat";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_VAID = "Type_Specific_Checks_DT_UUID_Vaid";
public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER = "Unable_to_connect_to_terminology_server";
public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__";
public static final String UNABLE_TO_FIND_BASE_DEFINITION_FOR_LOGICAL_MODEL__FROM_ = "Unable_to_find_base_definition_for_logical_model__from_";
public static final String UNABLE_TO_FIND_BASE__FOR_ = "Unable_to_find_base__for_";

View File

@ -418,7 +418,7 @@ Parser_Type__not_supported = Parser Type {0} not supported
Version_mismatch_The_context_has_version__loaded_and_the_new_content_being_loaded_is_version_ = Version mismatch. The context has version {0} loaded, and the new content being loaded is version {1}
Error_reading__from_package__ = Error reading {0} from package {1}#{2}: {3}
Error_parsing_ = Error parsing {0}:{1}
Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__ = Unable to connect to terminology server. Use parameter ''-tx n/a'' tun run without using terminology services to validate LOINC, SNOMED, ICD-X etc. Error = {0}
Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__ = Unable to connect to terminology server. Use parameter ''-tx n/a'' to run without using terminology services to validate LOINC, SNOMED, ICD-X etc. Error = {0}
Display_Name_for__should_be_one_of__instead_of_ = Display Name for {0}#{1} should be one of ''{2}'' instead of ''{3}''
Unknown_Code__in_ = Unknown Code {0} in {1}
UNKNOWN_CODE__IN_FRAGMENT = Unknown Code {0} in {1} - note that the code system is labelled as a fragment, so the code may be valid in some other fragment
@ -611,4 +611,5 @@ UNSUPPORTED_IDENTIFIER_PATTERN_PROPERTY_NOT_SUPPORTED_FOR_DISCRIMINATOR_FOR_SLIC
UNSUPPORTED_IDENTIFIER_PATTERN_NO_PROPERTY_NOT_SUPPORTED_FOR_DISCRIMINATOR_FOR_SLICE = Unsupported: no properties with values found on type {2} for pattern for discriminator({0}) for slice {1}
SD_NESTED_MUST_SUPPORT_DIFF = The element {0} has types/profiles/targets that are marked as must support, but the element itself is not marked as must-support. The inner must-supports will be ignored unless the element inherits must-support = true
SD_NESTED_MUST_SUPPORT_SNAPSHOT = The element {0} has types/profiles/targets that are marked as must support, but the element itself is not marked as must-support
Unable_to_connect_to_terminology_server = Unable to connect to terminology server. Error = {0}

View File

@ -354,6 +354,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
public ValidationEngine() throws IOException {
pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
context = SimpleWorkerContext.fromNothing();
initContext(null);
}
public String setTerminologyServer(String src, String log, FhirPublication version) throws FHIRException, URISyntaxException {
@ -436,6 +437,11 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
context = SimpleWorkerContext.fromDefinitions(source, loaderForVersion(), new PackageVersion(src));
grabNatives(source, "http://hl7.org/fhir");
}
initContext(tt);
}
public void initContext(TimeTracker tt) throws IOException, FileNotFoundException {
context.setCanNoTS(true);
context.setCacheId(UUID.randomUUID().toString());
context.setAllowLoadingDuplicates(true); // because of Forge
context.setExpansionProfile(makeExpProfile());