From 1d82c9cd40c91c1c84dee9e62a9c71f0f288381b Mon Sep 17 00:00:00 2001 From: jvi Date: Thu, 24 Jun 2021 11:14:30 +0200 Subject: [PATCH] Added option for installing transitive IG's - default is true --- pom.xml | 2 +- .../java/ca/uhn/fhir/jpa/starter/AppProperties.java | 13 +++++++++++-- .../uhn/fhir/jpa/starter/BaseJpaRestfulServer.java | 13 +++++++++---- src/main/resources/application.yaml | 1 + 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 765966f..4fc7a67 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.4.0 + 5.4.1 hapi-fhir-jpaserver-starter 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 6cb73d7..4c69373 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -62,6 +62,7 @@ public class AppProperties { private Subscription subscription = new Subscription(); private Cors cors = null; private Partitioning partitioning = null; + private Boolean install_transitive_ig_dependencies = true; private Map implementationGuides = null; private Boolean lastn_enabled = false; @@ -73,7 +74,7 @@ public class AppProperties { private Boolean use_apache_address_strategy = false; private Boolean use_apache_address_strategy_https = false; - public Boolean getUse_apache_address_strategy() { + public Boolean getUse_apache_address_strategy() { return use_apache_address_strategy; } @@ -462,7 +463,15 @@ public class AppProperties { this.search_coord_queue_capacity = search_coord_queue_capacity; } -public static class Cors { + public boolean getInstall_transitive_ig_dependencies() { + return install_transitive_ig_dependencies; + } + + public void setInstall_transitive_ig_dependencies(boolean install_transitive_ig_dependencies) { + this.install_transitive_ig_dependencies = install_transitive_ig_dependencies; + } + + public static class Cors { private Boolean allow_Credentials = true; private List allowed_origin = ImmutableList.of("*"); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java index 6af8085..cf4c16c 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/BaseJpaRestfulServer.java @@ -45,6 +45,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.ResultSeverityEnum; import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; import org.hl7.fhir.r4.model.Bundle.BundleType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -365,12 +366,16 @@ public class BaseJpaRestfulServer extends RestfulServer { if (appProperties.getImplementationGuides() != null) { Map guides = appProperties.getImplementationGuides(); for (Map.Entry guide : guides.entrySet()) { - packageInstallerSvc.install(new PackageInstallationSpec() + PackageInstallationSpec packageInstallationSpec = new PackageInstallationSpec() .setPackageUrl(guide.getValue().getUrl()) .setName(guide.getValue().getName()) - .setVersion(guide.getValue().getVersion()) - .setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL)); - + .setVersion(guide.getValue().getVersion()); + if(appProperties.getInstall_transitive_ig_dependencies()) { + packageInstallationSpec.setFetchDependencies(true) + .setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL); + packageInstallationSpec.setDependencyExcludes(ImmutableList.of("hl7.fhir.r2.core", "hl7.fhir.r3.core", "hl7.fhir.r4.core", "hl7.fhir.r5.core")); + } + packageInstallerSvc.install(packageInstallationSpec); } } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index a6e23f4..005ccb9 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -44,6 +44,7 @@ hapi: ### enable to set the Server URL # server_address: http://hapi.fhir.org/baseR4 # defer_indexing_for_codesystems_of_size: 101 +# install_transitive_ig_dependencies: true # implementationguides: ### example from registry (packages.fhir.org) # swiss: