diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index ec922de..c8a9f63 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -4,6 +4,7 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; +import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.rest.api.EncodingEnum; import org.hl7.fhir.r4.model.Bundle; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -74,7 +75,7 @@ public class AppProperties { private Partitioning partitioning = null; private Boolean install_transitive_ig_dependencies = true; private Boolean reload_existing_implementationguides = false; - private Map implementationGuides = null; + private Map implementationGuides = null; private String staticLocation = null; @@ -148,11 +149,11 @@ public class AppProperties { this.defer_indexing_for_codesystems_of_size = defer_indexing_for_codesystems_of_size; } - public Map getImplementationGuides() { + public Map getImplementationGuides() { return implementationGuides; } - public void setImplementationGuides(Map implementationGuides) { + public void setImplementationGuides(Map implementationGuides) { this.implementationGuides = implementationGuides; } @@ -696,36 +697,6 @@ public class AppProperties { } } - public static class ImplementationGuide - { - private String url; - private String name; - private String version; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - } public static class Validation { diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java index 7a1934f..7276777 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java @@ -76,7 +76,6 @@ import org.springframework.web.cors.CorsConfiguration; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; - import java.util.*; import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR; @@ -194,13 +193,15 @@ public class StarterJpaConfig { jobDefinitionRegistry.addJobDefinitionIfNotRegistered(reindexJobParametersJobDefinition); if (appProperties.getImplementationGuides() != null) { - Map guides = appProperties.getImplementationGuides(); - for (Map.Entry guide : guides.entrySet()) { - PackageInstallationSpec packageInstallationSpec = new PackageInstallationSpec().setPackageUrl(guide.getValue().getUrl()).setName(guide.getValue().getName()).setVersion(guide.getValue().getVersion()).setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL); - packageInstallationSpec.setReloadExisting(appProperties.getReload_existing_implementationguides()); + Map guides = appProperties.getImplementationGuides(); + for (Map.Entry guidesEntry : guides.entrySet()) { + PackageInstallationSpec packageInstallationSpec = guidesEntry.getValue(); if (appProperties.getInstall_transitive_ig_dependencies()) { - packageInstallationSpec.setFetchDependencies(true); - packageInstallationSpec.setDependencyExcludes(List.of("hl7.fhir.r2.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r5.core")); + + packageInstallationSpec.addDependencyExclude("hl7.fhir.r2.core") + .addDependencyExclude("hl7.fhir.r3.core") + .addDependencyExclude("hl7.fhir.r4.core") + .addDependencyExclude("hl7.fhir.r5.core"); } packageInstallerSvc.install(packageInstallationSpec); } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index a38c9c2..0180008 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -77,14 +77,15 @@ hapi: # install_transitive_ig_dependencies: true ### tells the server whether to attempt to load IG resources that are already present # reload_existing_implementationGuides : false - # implementationguides: + #implementationguides: ### example from registry (packages.fhir.org) - # swiss: - # name: swiss.mednet.fhir - # version: 0.8.0 + # swiss: + # name: swiss.mednet.fhir + # version: 0.8.0 + # reloadExisting : false # example not from registry # ips_1_0_0: - # url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz + # packageUrl: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz # name: hl7.fhir.uv.ips # version: 1.0.0 # supported_resource_types: diff --git a/src/test/resources/application.yaml b/src/test/resources/application.yaml index 89229c9..9f473c5 100644 --- a/src/test/resources/application.yaml +++ b/src/test/resources/application.yaml @@ -64,9 +64,10 @@ hapi: # swiss: # name: swiss.mednet.fhir # version: 0.8.0 + # reloadExisting : false # example not from registry # ips_1_0_0: - # url: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz + # packageUrl: https://build.fhir.org/ig/HL7/fhir-ips/package.tgz # name: hl7.fhir.uv.ips # version: 1.0.0 # supported_resource_types: