Converted to named indicies in order to support easier environment configuration for both tester and IG setup
This commit is contained in:
@@ -7,8 +7,10 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -54,12 +56,12 @@ public class AppProperties {
|
||||
private List<Bundle.BundleType> allowed_bundle_types = null;
|
||||
|
||||
private Validation validation = new Validation();
|
||||
private List<Tester> tester = ImmutableList.of(new Tester());
|
||||
private Map<String, Tester> tester = ImmutableMap.of("home", new Tester());
|
||||
private Logger logger = new Logger();
|
||||
private Subscription subscription = new Subscription();
|
||||
private Cors cors = null;
|
||||
private Partitioning partitioning = null;
|
||||
private List<ImplementationGuide> implementationGuides = null;
|
||||
private Map<String, ImplementationGuide> implementationGuides = null;
|
||||
|
||||
public Integer getDefer_indexing_for_codesystems_of_size() {
|
||||
return defer_indexing_for_codesystems_of_size;
|
||||
@@ -69,11 +71,11 @@ public class AppProperties {
|
||||
this.defer_indexing_for_codesystems_of_size = defer_indexing_for_codesystems_of_size;
|
||||
}
|
||||
|
||||
public List<ImplementationGuide> getImplementationGuides() {
|
||||
public Map<String, ImplementationGuide> getImplementationGuides() {
|
||||
return implementationGuides;
|
||||
}
|
||||
|
||||
public void setImplementationGuides(List<ImplementationGuide> implementationGuides) {
|
||||
public void setImplementationGuides(Map<String, ImplementationGuide> implementationGuides) {
|
||||
this.implementationGuides = implementationGuides;
|
||||
}
|
||||
|
||||
@@ -363,11 +365,11 @@ public class AppProperties {
|
||||
this.reuse_cached_search_results_millis = reuse_cached_search_results_millis;
|
||||
}
|
||||
|
||||
public List<Tester> getTester() {
|
||||
public Map<String, Tester> getTester() {
|
||||
return tester;
|
||||
}
|
||||
|
||||
public void setTester(List<Tester> tester) {
|
||||
public void setTester(Map<String, Tester> tester) {
|
||||
this.tester = tester;
|
||||
}
|
||||
|
||||
@@ -437,7 +439,7 @@ public class AppProperties {
|
||||
|
||||
public static class Tester {
|
||||
|
||||
private String id = "home";
|
||||
//private String id = "home";
|
||||
private String name = "Local Tester";
|
||||
private String server_address = "http://localhost:8080/fhir";
|
||||
private Boolean refuse_to_fetch_third_party_urls = true;
|
||||
@@ -451,14 +453,14 @@ public class AppProperties {
|
||||
this.fhir_version = fhir_version;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
/* public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -38,10 +38,7 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BaseJpaRestfulServer extends RestfulServer {
|
||||
@@ -345,12 +342,12 @@ public class BaseJpaRestfulServer extends RestfulServer {
|
||||
}
|
||||
|
||||
if (appProperties.getImplementationGuides() != null) {
|
||||
List<AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides();
|
||||
for (AppProperties.ImplementationGuide guide : guides) {
|
||||
Map<String, AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides();
|
||||
for (Map.Entry<String, AppProperties.ImplementationGuide> guide : guides.entrySet()) {
|
||||
packageInstallerSvc.install(new PackageInstallationSpec()
|
||||
.setPackageUrl(guide.getUrl())
|
||||
.setName(guide.getName())
|
||||
.setVersion(guide.getVersion())
|
||||
.setPackageUrl(guide.getValue().getUrl())
|
||||
.setName(guide.getValue().getName())
|
||||
.setVersion(guide.getValue().getVersion())
|
||||
.setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,15 @@ public class FhirTesterConfig {
|
||||
@Bean
|
||||
public TesterConfig testerConfig(AppProperties appProperties) {
|
||||
TesterConfig retVal = new TesterConfig();
|
||||
appProperties.getTester().stream().forEach(t -> {
|
||||
appProperties.getTester().entrySet().stream().forEach(t -> {
|
||||
retVal
|
||||
.addServer()
|
||||
.withId(t.getId())
|
||||
.withFhirVersion(t.getFhir_version())
|
||||
.withBaseUrl(t.getServer_address())
|
||||
.withName(t.getName());
|
||||
.withId(t.getKey())
|
||||
.withFhirVersion(t.getValue().getFhir_version())
|
||||
.withBaseUrl(t.getValue().getServer_address())
|
||||
.withName(t.getValue().getName());
|
||||
retVal.setRefuseToFetchThirdPartyUrls(
|
||||
t.getRefuse_to_fetch_third_party_urls());
|
||||
t.getValue().getRefuse_to_fetch_third_party_urls());
|
||||
|
||||
});
|
||||
return retVal;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: 'jdbc:h2:file:./target/database/h2'
|
||||
#url: 'jdbc:h2:file:./target/database/h2'
|
||||
url: jdbc:h2:mem:test_mem
|
||||
username: sa
|
||||
password: null
|
||||
driverClassName: org.h2.Driver
|
||||
@@ -30,14 +31,16 @@ hapi:
|
||||
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
|
||||
fhir_version: R4
|
||||
# defer_indexing_for_codesystems_of_size: 101
|
||||
# implementationguides:
|
||||
# -
|
||||
# url: https://build.fhir.org/ig/hl7dk/dk-medcom/branches/corrections/package.tgz
|
||||
# name: dk.fhir.ig.medcom-core
|
||||
# version: 0.8.0
|
||||
# -
|
||||
# name: hl7.fhir.uv.ips
|
||||
# version: 0.3.0
|
||||
implementationguides:
|
||||
#example from registry (packages.fhir.org)
|
||||
swiss:
|
||||
name: swiss.mednet.fhir
|
||||
version: 0.8.0
|
||||
#example not from registry
|
||||
ips_0_3_0:
|
||||
url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz
|
||||
name: hl7.fhir.uv.ips
|
||||
version: 1.0.0
|
||||
|
||||
#supported_resource_types:
|
||||
# - Patient
|
||||
@@ -86,14 +89,14 @@ hapi:
|
||||
# retain_cached_searches_mins: 60
|
||||
# reuse_cached_search_results_millis: 60000
|
||||
tester:
|
||||
-
|
||||
id: home
|
||||
|
||||
home:
|
||||
name: Local Tester
|
||||
server_address: 'http://localhost:8080/fhir'
|
||||
refuse_to_fetch_third_party_urls: false
|
||||
fhir_version: R4
|
||||
-
|
||||
id: global
|
||||
|
||||
global:
|
||||
name: Global Tester
|
||||
server_address: "http://hapi.fhir.org/baseR4"
|
||||
refuse_to_fetch_third_party_urls: false
|
||||
|
||||
Reference in New Issue
Block a user