Add property for multitenancy

This commit is contained in:
jamesagnew
2020-06-15 17:54:11 -04:00
parent 0430a539ff
commit 1badb96db8
5 changed files with 169 additions and 1 deletions

View File

@@ -135,7 +135,14 @@ public class FhirServerConfigCommon {
@Bean
public PartitionSettings partitionSettings() {
return new PartitionSettings();
PartitionSettings retVal = new PartitionSettings();
// Partitioning
if (HapiProperties.getPartitioningMultitenancyEnabled()) {
retVal.setPartitioningEnabled(true);
}
return retVal;
}

View File

@@ -73,6 +73,8 @@ public class HapiProperties {
static final String BULK_EXPORT_ENABLED = "bulk.export.enabled";
static final String EXPIRE_SEARCH_RESULTS_AFTER_MINS = "retain_cached_searches_mins";
static final String MAX_BINARY_SIZE = "max_binary_size";
static final String PARTITIONING_MULTITENANCY_ENABLED = "partitioning.multitenancy.enabled";
private static Properties ourProperties;
public static boolean isElasticSearchEnabled() {
@@ -489,5 +491,9 @@ public class HapiProperties {
public static boolean isFhirPathFilterInterceptorEnabled() {
return HapiProperties.getBooleanProperty("fhirpath_interceptor.enabled", false);
}
public static boolean getPartitioningMultitenancyEnabled() {
return HapiProperties.getBooleanProperty(PARTITIONING_MULTITENANCY_ENABLED, false);
}
}

View File

@@ -11,6 +11,7 @@ import ca.uhn.fhir.jpa.api.rp.ResourceProviderFactory;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
@@ -35,6 +36,8 @@ import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy;
import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import org.hl7.fhir.dstu3.model.Bundle;
@@ -318,6 +321,13 @@ public class JpaRestfulServer extends RestfulServer {
registerProvider(appCtx.getBean(BulkDataExportProvider.class));
}
// Partitioning
if (HapiProperties.getPartitioningMultitenancyEnabled()) {
registerInterceptor(new RequestTenantPartitionInterceptor());
setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
registerProviders(appCtx.getBean(PartitionManagementProvider.class));
}
}
}