Allow Enabling IPS via config
This commit is contained in:
committed by
Jens Kristian Villadsen
parent
7c89addbef
commit
c7ee984b30
@@ -21,7 +21,8 @@ import java.util.Objects;
|
|||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
public class AppProperties {
|
public class AppProperties {
|
||||||
|
|
||||||
private Boolean cql_enabled = false;
|
private Boolean cr_enabled = false;
|
||||||
|
private Boolean ips_enabled = false;
|
||||||
private Boolean openapi_enabled = false;
|
private Boolean openapi_enabled = false;
|
||||||
private Boolean mdm_enabled = false;
|
private Boolean mdm_enabled = false;
|
||||||
private boolean advanced_lucene_indexing = false;
|
private boolean advanced_lucene_indexing = false;
|
||||||
@@ -149,14 +150,23 @@ public class AppProperties {
|
|||||||
this.partitioning = partitioning;
|
this.partitioning = partitioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getCql_enabled() {
|
public Boolean getCr_enabled() {
|
||||||
return cql_enabled;
|
return cr_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCql_enabled(Boolean cql_enabled) {
|
public void setCr_enabled(Boolean cr_enabled) {
|
||||||
this.cql_enabled = cql_enabled;
|
this.cr_enabled = cr_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIps_enabled() {
|
||||||
|
return ips_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIps_enabled(Boolean ips_enabled) {
|
||||||
|
this.ips_enabled = ips_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Boolean getMdm_enabled() {
|
public Boolean getMdm_enabled() {
|
||||||
return mdm_enabled;
|
return mdm_enabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package ca.uhn.fhir.jpa.starter.common;
|
|||||||
import ca.uhn.fhir.jpa.config.r4.JpaR4Config;
|
import ca.uhn.fhir.jpa.config.r4.JpaR4Config;
|
||||||
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
|
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
|
||||||
import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config;
|
import ca.uhn.fhir.jpa.starter.cr.StarterCrR4Config;
|
||||||
|
import ca.uhn.fhir.jpa.starter.ips.StarterIpsConfig;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
@@ -13,7 +15,8 @@ import org.springframework.context.annotation.Import;
|
|||||||
JpaR4Config.class,
|
JpaR4Config.class,
|
||||||
StarterJpaConfig.class,
|
StarterJpaConfig.class,
|
||||||
StarterCrR4Config.class,
|
StarterCrR4Config.class,
|
||||||
ElasticsearchConfig.class
|
ElasticsearchConfig.class,
|
||||||
|
StarterIpsConfig.class
|
||||||
})
|
})
|
||||||
public class FhirServerConfigR4 {
|
public class FhirServerConfigR4 {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,6 @@ import ca.uhn.fhir.jpa.delete.ThreadSafeResourceDeleterSvc;
|
|||||||
import ca.uhn.fhir.jpa.graphql.GraphQLProvider;
|
import ca.uhn.fhir.jpa.graphql.GraphQLProvider;
|
||||||
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
|
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
|
||||||
import ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingInterceptor;
|
import ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingInterceptor;
|
||||||
import ca.uhn.fhir.jpa.ips.api.IIpsGenerationStrategy;
|
|
||||||
import ca.uhn.fhir.jpa.ips.generator.DefaultIpsGenerationStrategy;
|
|
||||||
import ca.uhn.fhir.jpa.ips.generator.IIpsGeneratorSvc;
|
|
||||||
import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl;
|
|
||||||
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider;
|
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider;
|
||||||
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
|
import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc;
|
||||||
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
|
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
|
||||||
@@ -47,6 +43,7 @@ import ca.uhn.fhir.jpa.starter.AppProperties;
|
|||||||
import ca.uhn.fhir.jpa.starter.annotations.OnCorsPresent;
|
import ca.uhn.fhir.jpa.starter.annotations.OnCorsPresent;
|
||||||
import ca.uhn.fhir.jpa.starter.annotations.OnImplementationGuidesPresent;
|
import ca.uhn.fhir.jpa.starter.annotations.OnImplementationGuidesPresent;
|
||||||
import ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory;
|
import ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory;
|
||||||
|
import ca.uhn.fhir.jpa.starter.ips.IpsConfigCondition;
|
||||||
import ca.uhn.fhir.jpa.starter.util.EnvironmentHelper;
|
import ca.uhn.fhir.jpa.starter.util.EnvironmentHelper;
|
||||||
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
|
||||||
import ca.uhn.fhir.jpa.util.ResourceCountCache;
|
import ca.uhn.fhir.jpa.util.ResourceCountCache;
|
||||||
@@ -243,7 +240,7 @@ public class StarterJpaConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional<TerminologyUploaderProvider> terminologyUploaderProvider, Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider, Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, IpsOperationProvider theIpsOperationProvider) {
|
public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional<TerminologyUploaderProvider> terminologyUploaderProvider, Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider, Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, Optional<IpsOperationProvider> theIpsOperationProvider) {
|
||||||
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
|
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
|
||||||
|
|
||||||
List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
|
List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
|
||||||
@@ -415,27 +412,13 @@ public class StarterJpaConfig {
|
|||||||
|
|
||||||
|
|
||||||
//register the IPS Provider
|
//register the IPS Provider
|
||||||
fhirServer.registerProvider(theIpsOperationProvider);
|
if (!theIpsOperationProvider.isEmpty()) {
|
||||||
|
fhirServer.registerProvider(theIpsOperationProvider.get());
|
||||||
|
}
|
||||||
|
|
||||||
return fhirServer;
|
return fhirServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public IIpsGeneratorSvc IpsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry)
|
|
||||||
{
|
|
||||||
return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public IpsOperationProvider IpsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){
|
|
||||||
return new IpsOperationProvider(theIpsGeneratorSvc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean IIpsGenerationStrategy IpsGenerationStrategy()
|
|
||||||
{
|
|
||||||
return new DefaultIpsGenerationStrategy();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check the properties for custom interceptor classes and registers them.
|
* check the properties for custom interceptor classes and registers them.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class CrConfigCondition implements Condition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
||||||
String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cr_enabled");
|
String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.cql_enabled");
|
||||||
return Boolean.parseBoolean(property);
|
return Boolean.parseBoolean(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package ca.uhn.fhir.jpa.starter.ips;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Condition;
|
||||||
|
import org.springframework.context.annotation.ConditionContext;
|
||||||
|
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||||
|
|
||||||
|
public class IpsConfigCondition implements Condition {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
||||||
|
String property = theConditionContext.getEnvironment().getProperty("hapi.fhir.ips_enabled");
|
||||||
|
return Boolean.parseBoolean(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package ca.uhn.fhir.jpa.starter.ips;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
|
import ca.uhn.fhir.jpa.ips.api.IIpsGenerationStrategy;
|
||||||
|
import ca.uhn.fhir.jpa.ips.generator.DefaultIpsGenerationStrategy;
|
||||||
|
import ca.uhn.fhir.jpa.ips.generator.IIpsGeneratorSvc;
|
||||||
|
import org.springframework.context.annotation.Conditional;
|
||||||
|
import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider;
|
||||||
|
import ca.uhn.fhir.jpa.ips.generator.IpsGeneratorSvcImpl;
|
||||||
|
|
||||||
|
|
||||||
|
@Conditional(IpsConfigCondition.class)
|
||||||
|
public class StarterIpsConfig {
|
||||||
|
@Bean
|
||||||
|
IIpsGenerationStrategy IpsGenerationStrategy()
|
||||||
|
{
|
||||||
|
return new DefaultIpsGenerationStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public IpsOperationProvider IpsOperationProvider(IIpsGeneratorSvc theIpsGeneratorSvc){
|
||||||
|
return new IpsOperationProvider(theIpsGeneratorSvc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public IIpsGeneratorSvc IpsGeneratorSvcImpl(FhirContext theFhirContext, IIpsGenerationStrategy theGenerationStrategy, DaoRegistry theDaoRegistry)
|
||||||
|
{
|
||||||
|
return new IpsGeneratorSvcImpl(theFhirContext, theGenerationStrategy, theDaoRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -94,6 +94,7 @@ hapi:
|
|||||||
# allow_override_default_search_params: true
|
# allow_override_default_search_params: true
|
||||||
# auto_create_placeholder_reference_targets: false
|
# auto_create_placeholder_reference_targets: false
|
||||||
# cr_enabled: true
|
# cr_enabled: true
|
||||||
|
# ips_enabled: false
|
||||||
# default_encoding: JSON
|
# default_encoding: JSON
|
||||||
# default_pretty_print: true
|
# default_pretty_print: true
|
||||||
# default_page_size: 20
|
# default_page_size: 20
|
||||||
|
|||||||
Reference in New Issue
Block a user