From 14270e8aa4a647c9f7ff2fea98d2a273a32be3ca Mon Sep 17 00:00:00 2001 From: ianmarshall Date: Thu, 7 Jan 2021 10:18:39 -0500 Subject: [PATCH] Remove the now redundant PackageSystemRequestDetails class. --- .../fhir/jpa/packages/JpaPackageCache.java | 5 +-- .../jpa/packages/PackageInstallerSvcImpl.java | 7 ++-- .../packages/PackageSystemRequestDetails.java | 35 ------------------- .../jpa/partition/SystemRequestDetails.java | 25 +++++++++++++ 4 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageSystemRequestDetails.java diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java index dea200b7618..01b22acbf6d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java @@ -34,6 +34,7 @@ import ca.uhn.fhir.jpa.model.entity.NpmPackageEntity; import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity; import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionResourceEntity; import ca.uhn.fhir.jpa.model.entity.ResourceTable; +import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; @@ -326,7 +327,7 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac private ResourceTable createResourceBinary(IBaseBinary theResourceBinary) { if (myPartitionSettings.isPartitioningEnabled()) { - PackageSystemRequestDetails myRequestDetails = new PackageSystemRequestDetails(); + SystemRequestDetails myRequestDetails = new SystemRequestDetails(); return (ResourceTable) getBinaryDao().create(theResourceBinary, myRequestDetails).getEntity(); } else { return (ResourceTable) getBinaryDao().create(theResourceBinary).getEntity(); @@ -637,7 +638,7 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac private void deleteAndExpungeResourceBinary(IIdType theResourceBinaryId, ExpungeOptions theOptions) { if (myPartitionSettings.isPartitioningEnabled()) { - PackageSystemRequestDetails myRequestDetails = new PackageSystemRequestDetails(); + SystemRequestDetails myRequestDetails = new SystemRequestDetails(); getBinaryDao().delete(theResourceBinaryId, myRequestDetails).getEntity(); getBinaryDao().forceExpungeInExistingTransaction(theResourceBinaryId, theOptions, myRequestDetails); } else { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java index b969c766099..2ddcb53e9c0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java @@ -33,6 +33,7 @@ import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity; +import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.rest.api.server.IBundleProvider; @@ -341,7 +342,7 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc { private IBundleProvider searchResource(IFhirResourceDao theDao, SearchParameterMap theMap) { if (myPartitionSettings.isPartitioningEnabled()) { - PackageSystemRequestDetails myRequestDetails = new PackageSystemRequestDetails(); + SystemRequestDetails myRequestDetails = new SystemRequestDetails(); return theDao.search(theMap, myRequestDetails); } else { return theDao.search(theMap); @@ -350,7 +351,7 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc { private void createResource(IFhirResourceDao theDao, IBaseResource theResource) { if (myPartitionSettings.isPartitioningEnabled()) { - PackageSystemRequestDetails myRequestDetails = new PackageSystemRequestDetails(); + SystemRequestDetails myRequestDetails = new SystemRequestDetails(); theDao.create(theResource, myRequestDetails); } else { theDao.create(theResource); @@ -359,7 +360,7 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc { private DaoMethodOutcome updateResource(IFhirResourceDao theDao, IBaseResource theResource) { if (myPartitionSettings.isPartitioningEnabled()) { - PackageSystemRequestDetails myRequestDetails = new PackageSystemRequestDetails(); + SystemRequestDetails myRequestDetails = new SystemRequestDetails(); return theDao.update(theResource, myRequestDetails); } else { return theDao.update(theResource); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageSystemRequestDetails.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageSystemRequestDetails.java deleted file mode 100644 index 33b7d70a185..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageSystemRequestDetails.java +++ /dev/null @@ -1,35 +0,0 @@ -package ca.uhn.fhir.jpa.packages; - -import ca.uhn.fhir.interceptor.api.HookParams; -import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.partition.SystemRequestDetails; - -/** - * A RequestDetails implementation to be used when processing resources defined in a package to ensure - * that they are always queried or updated in the DEFAULT partition if partitioning is enabled. - */ -public class PackageSystemRequestDetails extends SystemRequestDetails { - public PackageSystemRequestDetails() { - super(new MyInterceptorBroadcaster()); - } - - private static class MyInterceptorBroadcaster implements IInterceptorBroadcaster { - - @Override - public boolean callHooks(Pointcut thePointcut, HookParams theParams) { - return true; - } - - @Override - public Object callHooksAndReturnObject(Pointcut thePointcut, HookParams theParams) { - return null; - } - - @Override - public boolean hasHooks(Pointcut thePointcut) { - return false; - } - } - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/SystemRequestDetails.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/SystemRequestDetails.java index ecbdead4c30..7158cfab12c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/SystemRequestDetails.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/SystemRequestDetails.java @@ -2,8 +2,10 @@ package ca.uhn.fhir.jpa.partition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.api.AddProfileTagEnum; +import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorService; +import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.ETagSupportEnum; @@ -25,6 +27,10 @@ import java.util.List; * use the DEFAULT partition when partitioning is enabled. */ public class SystemRequestDetails extends RequestDetails { + public SystemRequestDetails() { + super(new MyInterceptorBroadcaster()); + } + public SystemRequestDetails(IInterceptorBroadcaster theInterceptorBroadcaster) { super(theInterceptorBroadcaster); } @@ -131,4 +137,23 @@ public class SystemRequestDetails extends RequestDetails { return null; } } + + private static class MyInterceptorBroadcaster implements IInterceptorBroadcaster { + + @Override + public boolean callHooks(Pointcut thePointcut, HookParams theParams) { + return true; + } + + @Override + public Object callHooksAndReturnObject(Pointcut thePointcut, HookParams theParams) { + return null; + } + + @Override + public boolean hasHooks(Pointcut thePointcut) { + return false; + } + } + }