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

@@ -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));
}
}
}