Feature/using package installer spec (#577)

* Adjusting to HAPI core classes

* Added example as default

* Commented the example IG out again
This commit is contained in:
Jens Kristian Villadsen
2023-08-22 20:14:43 +02:00
committed by GitHub
parent d6e9abad8c
commit 37a9317355
4 changed files with 20 additions and 46 deletions

View File

@@ -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<String, ImplementationGuide> implementationGuides = null;
private Map<String, PackageInstallationSpec> 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<String, ImplementationGuide> getImplementationGuides() {
public Map<String, PackageInstallationSpec> getImplementationGuides() {
return implementationGuides;
}
public void setImplementationGuides(Map<String, ImplementationGuide> implementationGuides) {
public void setImplementationGuides(Map<String, PackageInstallationSpec> 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 {

View File

@@ -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<String, AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides();
for (Map.Entry<String, AppProperties.ImplementationGuide> 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<String, PackageInstallationSpec> guides = appProperties.getImplementationGuides();
for (Map.Entry<String, PackageInstallationSpec> 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);
}

View File

@@ -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:

View File

@@ -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: