Now with example of wiring up installed IG's

This commit is contained in:
jvi
2021-02-10 16:57:14 +01:00
parent 4bfafc9be5
commit 5aec4b7e18
5 changed files with 237 additions and 50 deletions

View File

@@ -11,6 +11,7 @@ import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.provider.BulkDataExportProvider;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
import ca.uhn.fhir.jpa.packages.PackageInstallOutcomeJson;
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
import ca.uhn.fhir.jpa.provider.*;
@@ -96,6 +97,9 @@ public class BaseJpaRestfulServer extends RestfulServer {
@Autowired
ApplicationContext myApplicationContext;
@Autowired(required = false)
RepositoryValidationInterceptorFactoryR4 factory;
public BaseJpaRestfulServer() {
}
@@ -350,14 +354,20 @@ public class BaseJpaRestfulServer extends RestfulServer {
if (appProperties.getImplementationGuides() != null) {
Map<String, AppProperties.ImplementationGuide> guides = appProperties.getImplementationGuides();
for (Map.Entry<String, AppProperties.ImplementationGuide> guide : guides.entrySet()) {
packageInstallerSvc.install(new PackageInstallationSpec()
.setPackageUrl(guide.getValue().getUrl())
.setName(guide.getValue().getName())
.setVersion(guide.getValue().getVersion())
.setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL));
PackageInstallOutcomeJson outcome = packageInstallerSvc.install(new PackageInstallationSpec()
.setPackageUrl(guide.getValue().getUrl())
.setName(guide.getValue().getName())
.setVersion(guide.getValue().getVersion())
.setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL));
}
}
if(factory != null)
interceptorService.registerInterceptor(factory.buildUsingStoredStructureDefinitions());
if (appProperties.getLastn_enabled()) {
daoConfig.setLastNEnabled(true);
}