Remove the now redundant PackageSystemRequestDetails class.

This commit is contained in:
ianmarshall 2021-01-07 10:18:39 -05:00
parent e23e3c660c
commit 14270e8aa4
4 changed files with 32 additions and 40 deletions

View File

@ -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 {

View File

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

View File

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

View File

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