From 0fb0419a67c078780487136d92555e6babaaf2b5 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 4 May 2021 16:22:01 -0400 Subject: [PATCH] If null, return default partition during create --- .../uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java | 4 ++-- .../ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java index 9b2c134df11..54aa3e2b483 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java @@ -29,8 +29,8 @@ import javax.annotation.Nullable; public interface IRequestPartitionHelperSvc { @Nonnull - RequestPartitionId determineReadPartitionForRequest(RequestDetails theRequest, String theResourceType); + RequestPartitionId determineReadPartitionForRequest(@Nullable RequestDetails theRequest, String theResourceType); @Nonnull - RequestPartitionId determineCreatePartitionForRequest(RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType); + RequestPartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java index 326111da44f..3b47294645d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java @@ -180,6 +180,11 @@ public class RequestPartitionHelperSvc implements IRequestPartitionHelperSvc { if (myPartitionSettings.isPartitioningEnabled()) { boolean nonPartitionableResource = myNonPartitionableResourceNames.contains(theResourceType); + //TODO GGG eventually, theRequest will not be allowed to be null here, and we will pass through SystemRequestDetails instead. + if (theRequest == null && nonPartitionableResource) { + return RequestPartitionId.defaultPartition(); + } + if (theRequest instanceof SystemRequestDetails) { requestPartitionId = getSystemRequestPartitionId(theRequest, nonPartitionableResource); } else {