Adding support for '*' cornercase
This commit is contained in:
@@ -928,6 +928,7 @@ public class AppProperties {
|
||||
request_tenant_partitioning_mode = theRequest_tenant_partitioning_mode;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoteSystem {
|
||||
private String system;
|
||||
private String url;
|
||||
|
||||
@@ -30,20 +30,60 @@ public class FhirServerConfigR4 {
|
||||
|
||||
@Bean(name = "myHybridRemoteValidationSupportChain")
|
||||
@Conditional({OnR4Condition.class, OnRemoteTerminologyPresent.class})
|
||||
public IValidationSupport addRemoteValidation(ValidationSupportChain theValidationSupport, FhirContext theFhirContext, AppProperties theAppProperties)
|
||||
{
|
||||
theAppProperties.getRemoteTerminologyServicesMap().forEach((key, remoteSystem) -> {
|
||||
theValidationSupport.addValidationSupport(0 , new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()){
|
||||
public IValidationSupport addRemoteValidation(
|
||||
ValidationSupportChain theValidationSupport, FhirContext theFhirContext, AppProperties theAppProperties) {
|
||||
var values = theAppProperties.getRemoteTerminologyServicesMap().values();
|
||||
|
||||
// If the remote terminology service is "*" and is the only one then forward all requests to the remote
|
||||
// terminology service
|
||||
if (values.size() == 1 && "*".equalsIgnoreCase(values.iterator().next().getSystem())) {
|
||||
var remoteSystem = values.iterator().next();
|
||||
theValidationSupport.addValidationSupport(
|
||||
0, new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()) {
|
||||
@Override
|
||||
public CodeValidationResult validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) {
|
||||
public CodeValidationResult validateCode(
|
||||
ValidationSupportContext theValidationSupportContext,
|
||||
ConceptValidationOptions theOptions,
|
||||
String theCodeSystem,
|
||||
String theCode,
|
||||
String theDisplay,
|
||||
String theValueSetUrl) {
|
||||
return super.validateCode(
|
||||
theValidationSupportContext,
|
||||
theOptions,
|
||||
theCodeSystem,
|
||||
theCode,
|
||||
theDisplay,
|
||||
theValueSetUrl);
|
||||
}
|
||||
});
|
||||
return theValidationSupport;
|
||||
|
||||
// If there are multiple remote terminology services, then add each one to the validation chain
|
||||
} else {
|
||||
values.forEach((remoteSystem) -> theValidationSupport.addValidationSupport(
|
||||
0, new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()) {
|
||||
@Override
|
||||
public CodeValidationResult validateCode(
|
||||
ValidationSupportContext theValidationSupportContext,
|
||||
ConceptValidationOptions theOptions,
|
||||
String theCodeSystem,
|
||||
String theCode,
|
||||
String theDisplay,
|
||||
String theValueSetUrl) {
|
||||
if (remoteSystem.getSystem().equalsIgnoreCase(theCodeSystem)) {
|
||||
return super.validateCode(theValidationSupportContext, theOptions, theCodeSystem, theCode, theDisplay, theValueSetUrl);
|
||||
return super.validateCode(
|
||||
theValidationSupportContext,
|
||||
theOptions,
|
||||
theCodeSystem,
|
||||
theCode,
|
||||
theDisplay,
|
||||
theValueSetUrl);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}));
|
||||
}
|
||||
return theValidationSupport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,12 +290,15 @@ hapi:
|
||||
# retain_cached_searches_mins: 60
|
||||
# reuse_cached_search_results_millis: 60000
|
||||
remote_terminology_service:
|
||||
# all:
|
||||
# system: '*'
|
||||
# url: 'https://tx.fhir.org/r4/'
|
||||
snomed:
|
||||
system: 'http://snomed.info/sct'
|
||||
url: 'https://tx.fhir.org/r4/'
|
||||
loinc:
|
||||
system: 'http://loinc.org'
|
||||
url: 'https://fhir.loinc.org/'
|
||||
url: 'https://hapi.fhir.org/baseR4/'
|
||||
tester:
|
||||
home:
|
||||
name: Local Tester
|
||||
|
||||
Reference in New Issue
Block a user