Add expunge-everything hook. Also add RequestDetails to all expunge operations
This commit is contained in:
parent
e50caaa899
commit
5e05703c1a
|
@ -1124,6 +1124,15 @@ public enum Pointcut {
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
||||||
),
|
),
|
||||||
|
|
||||||
|
STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING(
|
||||||
|
// Return type
|
||||||
|
Void.class,
|
||||||
|
// Params
|
||||||
|
"java.util.concurrent.atomic.AtomicInteger",
|
||||||
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
||||||
|
),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that this is a performance tracing hook. Use with caution in production
|
* Note that this is a performance tracing hook. Use with caution in production
|
||||||
* systems, since calling it may (or may not) carry a cost.
|
* systems, since calling it may (or may not) carry a cost.
|
||||||
|
|
|
@ -555,18 +555,18 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
throw new PreconditionFailedException("Can not perform version-specific expunge of resource " + theId.toUnqualified().getValue() + " as this is the current version");
|
throw new PreconditionFailedException("Can not perform version-specific expunge of resource " + theId.toUnqualified().getValue() + " as this is the current version");
|
||||||
}
|
}
|
||||||
|
|
||||||
return myExpungeService.expunge(getResourceName(), entity.getResourceId(), entity.getVersion(), theExpungeOptions);
|
return myExpungeService.expunge(getResourceName(), entity.getResourceId(), entity.getVersion(), theExpungeOptions, theRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myExpungeService.expunge(getResourceName(), entity.getResourceId(), null, theExpungeOptions);
|
return myExpungeService.expunge(getResourceName(), entity.getResourceId(), null, theExpungeOptions ,theRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.NEVER)
|
@Transactional(propagation = Propagation.NEVER)
|
||||||
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions) {
|
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
|
||||||
ourLog.info("Beginning TYPE[{}] expunge operation", getResourceName());
|
ourLog.info("Beginning TYPE[{}] expunge operation", getResourceName());
|
||||||
|
|
||||||
return myExpungeService.expunge(getResourceName(), null, null, theExpungeOptions);
|
return myExpungeService.expunge(getResourceName(), null, null, theExpungeOptions, theRequestDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResourceName() {
|
public String getResourceName() {
|
||||||
|
|
|
@ -49,8 +49,8 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.NEVER)
|
@Transactional(propagation = Propagation.NEVER)
|
||||||
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions) {
|
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
|
||||||
return myExpungeService.expunge(null, null, null, theExpungeOptions);
|
return myExpungeService.expunge(null, null, null, theExpungeOptions, theRequestDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
|
|
|
@ -29,7 +29,6 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
||||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
import ca.uhn.fhir.rest.api.PatchTypeEnum;
|
import ca.uhn.fhir.rest.api.PatchTypeEnum;
|
||||||
|
@ -105,7 +104,7 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
|
||||||
*/
|
*/
|
||||||
DeleteMethodOutcome deleteByUrl(String theString, RequestDetails theRequestDetails);
|
DeleteMethodOutcome deleteByUrl(String theString, RequestDetails theRequestDetails);
|
||||||
|
|
||||||
ExpungeOutcome expunge(ExpungeOptions theExpungeOptions);
|
ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails);
|
||||||
|
|
||||||
ExpungeOutcome expunge(IIdType theIIdType, ExpungeOptions theExpungeOptions, RequestDetails theRequest);
|
ExpungeOutcome expunge(IIdType theIIdType, ExpungeOptions theExpungeOptions, RequestDetails theRequest);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface IFhirSystemDao<T, MT> extends IDao {
|
public interface IFhirSystemDao<T, MT> extends IDao {
|
||||||
|
|
||||||
ExpungeOutcome expunge(ExpungeOptions theExpungeOptions);
|
ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
<R extends IBaseResource> IFhirResourceDao<R> getDao(Class<R> theType);
|
<R extends IBaseResource> IFhirResourceDao<R> getDao(Class<R> theType);
|
||||||
|
|
|
@ -20,8 +20,16 @@ package ca.uhn.fhir.jpa.dao.expunge;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
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.delete.DeleteConflictList;
|
||||||
|
import ca.uhn.fhir.jpa.delete.DeleteConflictOutcome;
|
||||||
import ca.uhn.fhir.jpa.entity.*;
|
import ca.uhn.fhir.jpa.entity.*;
|
||||||
import ca.uhn.fhir.jpa.model.entity.*;
|
import ca.uhn.fhir.jpa.model.entity.*;
|
||||||
|
import ca.uhn.fhir.jpa.util.JpaInterceptorBroadcaster;
|
||||||
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
|
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||||
import ca.uhn.fhir.util.StopWatch;
|
import ca.uhn.fhir.util.StopWatch;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -45,13 +53,24 @@ public class ExpungeEverythingService {
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(ExpungeEverythingService.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(ExpungeEverythingService.class);
|
||||||
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
|
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
|
||||||
protected EntityManager myEntityManager;
|
protected EntityManager myEntityManager;
|
||||||
|
// FIXME KHS remove?
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformTransactionManager myPlatformTransactionManager;
|
private PlatformTransactionManager myPlatformTransactionManager;
|
||||||
|
@Autowired
|
||||||
|
protected IInterceptorBroadcaster myInterceptorBroadcaster;
|
||||||
|
|
||||||
void expungeEverything() {
|
void expungeEverything(RequestDetails theRequest) {
|
||||||
|
|
||||||
final AtomicInteger counter = new AtomicInteger();
|
final AtomicInteger counter = new AtomicInteger();
|
||||||
|
|
||||||
|
// Notify Interceptors about pre-action call
|
||||||
|
HookParams hooks = new HookParams()
|
||||||
|
.add(AtomicInteger.class, counter)
|
||||||
|
.add(RequestDetails.class, theRequest)
|
||||||
|
.addIfMatchesType(ServletRequestDetails.class, theRequest);
|
||||||
|
JpaInterceptorBroadcaster.doCallHooksAndReturnObject(myInterceptorBroadcaster, theRequest, Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING, hooks);
|
||||||
|
|
||||||
|
|
||||||
ourLog.info("BEGINNING GLOBAL $expunge");
|
ourLog.info("BEGINNING GLOBAL $expunge");
|
||||||
TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager);
|
TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager);
|
||||||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||||
|
|
|
@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.dao.expunge;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
||||||
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -49,13 +50,15 @@ public class ExpungeRun implements Callable<ExpungeOutcome> {
|
||||||
private final Long myResourceId;
|
private final Long myResourceId;
|
||||||
private final Long myVersion;
|
private final Long myVersion;
|
||||||
private final ExpungeOptions myExpungeOptions;
|
private final ExpungeOptions myExpungeOptions;
|
||||||
|
private final RequestDetails myRequestDetails;
|
||||||
private final AtomicInteger myRemainingCount;
|
private final AtomicInteger myRemainingCount;
|
||||||
|
|
||||||
public ExpungeRun(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions) {
|
public ExpungeRun(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
|
||||||
myResourceName = theResourceName;
|
myResourceName = theResourceName;
|
||||||
myResourceId = theResourceId;
|
myResourceId = theResourceId;
|
||||||
myVersion = theVersion;
|
myVersion = theVersion;
|
||||||
myExpungeOptions = theExpungeOptions;
|
myExpungeOptions = theExpungeOptions;
|
||||||
|
myRequestDetails = theRequestDetails;
|
||||||
myRemainingCount = new AtomicInteger(myExpungeOptions.getLimit());
|
myRemainingCount = new AtomicInteger(myExpungeOptions.getLimit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.dao.expunge;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
import ca.uhn.fhir.jpa.util.ExpungeOptions;
|
||||||
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
import ca.uhn.fhir.jpa.util.ExpungeOutcome;
|
||||||
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -43,9 +44,9 @@ public abstract class ExpungeService {
|
||||||
private IResourceExpungeService myExpungeDaoService;
|
private IResourceExpungeService myExpungeDaoService;
|
||||||
|
|
||||||
@Lookup
|
@Lookup
|
||||||
protected abstract ExpungeRun getExpungeRun(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions);
|
protected abstract ExpungeRun getExpungeRun(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails);
|
||||||
|
|
||||||
public ExpungeOutcome expunge(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions) {
|
public ExpungeOutcome expunge(String theResourceName, Long theResourceId, Long theVersion, ExpungeOptions theExpungeOptions, RequestDetails theRequest) {
|
||||||
ourLog.info("Expunge: ResourceName[{}] Id[{}] Version[{}] Options[{}]", theResourceName, theResourceId, theVersion, theExpungeOptions);
|
ourLog.info("Expunge: ResourceName[{}] Id[{}] Version[{}] Options[{}]", theResourceName, theResourceId, theVersion, theExpungeOptions);
|
||||||
|
|
||||||
if (!myConfig.isExpungeEnabled()) {
|
if (!myConfig.isExpungeEnabled()) {
|
||||||
|
@ -58,11 +59,11 @@ public abstract class ExpungeService {
|
||||||
|
|
||||||
if (theResourceName == null && theResourceId == null && theVersion == null) {
|
if (theResourceName == null && theResourceId == null && theVersion == null) {
|
||||||
if (theExpungeOptions.isExpungeEverything()) {
|
if (theExpungeOptions.isExpungeEverything()) {
|
||||||
myExpungeEverythingService.expungeEverything();
|
myExpungeEverythingService.expungeEverything(theRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpungeRun expungeRun = getExpungeRun(theResourceName, theResourceId, theVersion, theExpungeOptions);
|
ExpungeRun expungeRun = getExpungeRun(theResourceName, theResourceId, theVersion, theExpungeOptions, theRequest);
|
||||||
return expungeRun.call();
|
return expungeRun.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public abstract class BaseJpaResourceProvider<T extends IBaseResource> extends B
|
||||||
if (theIdParam != null) {
|
if (theIdParam != null) {
|
||||||
outcome = getDao().expunge(theIdParam, options, theRequest);
|
outcome = getDao().expunge(theIdParam, options, theRequest);
|
||||||
} else {
|
} else {
|
||||||
outcome = getDao().expunge(options);
|
outcome = getDao().expunge(options, theRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createExpungeResponse(outcome);
|
return createExpungeResponse(outcome);
|
||||||
|
|
|
@ -55,9 +55,9 @@ public class BaseJpaSystemProvider<T, MT> extends BaseJpaProvider implements IJp
|
||||||
return myResourceReindexingSvc;
|
return myResourceReindexingSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Parameters doExpunge(IPrimitiveType<? extends Integer> theLimit, IPrimitiveType<? extends Boolean> theExpungeDeletedResources, IPrimitiveType<? extends Boolean> theExpungeOldVersions, IPrimitiveType<? extends Boolean> theExpungeEverything) {
|
protected Parameters doExpunge(IPrimitiveType<? extends Integer> theLimit, IPrimitiveType<? extends Boolean> theExpungeDeletedResources, IPrimitiveType<? extends Boolean> theExpungeOldVersions, IPrimitiveType<? extends Boolean> theExpungeEverything, RequestDetails theRequestDetails) {
|
||||||
ExpungeOptions options = createExpungeOptions(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
ExpungeOptions options = createExpungeOptions(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
||||||
ExpungeOutcome outcome = getDao().expunge(options);
|
ExpungeOutcome outcome = getDao().expunge(options, theRequestDetails);
|
||||||
return createExpungeResponse(outcome);
|
return createExpungeResponse(outcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,10 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerDt theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerDt theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanDt theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanDt theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanDt theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanDt theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanDt theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanDt theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
return toExpungeResponse(retVal);
|
return toExpungeResponse(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +85,10 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerDt theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerDt theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanDt theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanDt theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanDt theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanDt theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanDt theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanDt theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
return toExpungeResponse(retVal);
|
return toExpungeResponse(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,10 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
try {
|
try {
|
||||||
return VersionConvertor_30_40.convertParameters(retVal);
|
return VersionConvertor_30_40.convertParameters(retVal);
|
||||||
} catch (FHIRException e) {
|
} catch (FHIRException e) {
|
||||||
|
@ -84,9 +85,10 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus<Bundl
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
org.hl7.fhir.r4.model.Parameters retVal = super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
try {
|
try {
|
||||||
return VersionConvertor_30_40.convertParameters(retVal);
|
return VersionConvertor_30_40.convertParameters(retVal);
|
||||||
} catch (FHIRException e) {
|
} catch (FHIRException e) {
|
||||||
|
|
|
@ -64,9 +64,10 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
|
@Operation(name = JpaConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
|
||||||
|
@ -76,9 +77,10 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus<Bundle,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_LIMIT) IntegerType theLimit,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES) BooleanType theExpungeDeletedResources,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS) BooleanType theExpungeOldVersions,
|
||||||
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything
|
@OperationParam(name = JpaConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING) BooleanType theExpungeEverything,
|
||||||
|
RequestDetails theRequestDetails
|
||||||
) {
|
) {
|
||||||
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
|
return super.doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is generated by hand:
|
// This is generated by hand:
|
||||||
|
|
|
@ -391,7 +391,7 @@ public abstract class BaseJpaTest {
|
||||||
|
|
||||||
for (int count = 0; ; count++) {
|
for (int count = 0; ; count++) {
|
||||||
try {
|
try {
|
||||||
theSystemDao.expunge(new ExpungeOptions().setExpungeEverything(true));
|
theSystemDao.expunge(new ExpungeOptions().setExpungeEverything(true), null);
|
||||||
break;
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (count >= 3) {
|
if (count >= 3) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
|
||||||
@Test
|
@Test
|
||||||
public void testExpungeSystemEverything() {
|
public void testExpungeSystemEverything() {
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeEverything(true));
|
.setExpungeEverything(true), null);
|
||||||
|
|
||||||
// Everything deleted
|
// Everything deleted
|
||||||
assertExpunged(myOneVersionPatientId);
|
assertExpunged(myOneVersionPatientId);
|
||||||
|
@ -214,7 +214,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
|
||||||
public void testExpungeSystemOldVersionsAndDeleted() {
|
public void testExpungeSystemOldVersionsAndDeleted() {
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -233,7 +233,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
|
||||||
public void testExpungeTypeDeletedResources() {
|
public void testExpungeTypeDeletedResources() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(false));
|
.setExpungeOldVersions(false), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -252,7 +252,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
|
||||||
public void testExpungeTypeOldVersions() {
|
public void testExpungeTypeOldVersions() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(false)
|
.setExpungeDeletedResources(false)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -272,7 +272,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
|
||||||
public void testExpungeTypeOldVersionsAndDeleted() {
|
public void testExpungeTypeOldVersionsAndDeleted() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
@Test
|
@Test
|
||||||
public void testExpungeSystemEverything() {
|
public void testExpungeSystemEverything() {
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeEverything(true));
|
.setExpungeEverything(true), null);
|
||||||
|
|
||||||
// Everything deleted
|
// Everything deleted
|
||||||
assertExpunged(myOneVersionPatientId);
|
assertExpunged(myOneVersionPatientId);
|
||||||
|
@ -219,7 +219,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
public void testExpungeSystemOldVersionsAndDeleted() {
|
public void testExpungeSystemOldVersionsAndDeleted() {
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -238,7 +238,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
public void testExpungeTypeDeletedResources() {
|
public void testExpungeTypeDeletedResources() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(false));
|
.setExpungeOldVersions(false), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -257,7 +257,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
public void testExpungeTypeOldVersions() {
|
public void testExpungeTypeOldVersions() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(false)
|
.setExpungeDeletedResources(false)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -277,7 +277,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
public void testExpungeTypeOldVersionsAndDeleted() {
|
public void testExpungeTypeOldVersionsAndDeleted() {
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -298,7 +298,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true)
|
.setExpungeOldVersions(true)
|
||||||
.setLimit(0));
|
.setLimit(0), null);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals("Expunge limit may not be less than 1. Received expunge limit 0.", e.getMessage());
|
assertEquals("Expunge limit may not be less than 1. Received expunge limit 0.", e.getMessage());
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
runInTransaction(() -> assertThat(myResourceTableDao.findAll(), empty()));
|
runInTransaction(() -> assertThat(myResourceTableDao.findAll(), empty()));
|
||||||
runInTransaction(() -> assertThat(myResourceHistoryTableDao.findAll(), empty()));
|
runInTransaction(() -> assertThat(myResourceHistoryTableDao.findAll(), empty()));
|
||||||
|
@ -234,7 +234,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -255,7 +255,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(false));
|
.setExpungeOldVersions(false), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -276,7 +276,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(false)
|
.setExpungeDeletedResources(false)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -297,7 +297,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
createStandardPatients();
|
createStandardPatients();
|
||||||
|
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeEverything(true));
|
.setExpungeEverything(true), null);
|
||||||
|
|
||||||
// Everything deleted
|
// Everything deleted
|
||||||
assertExpunged(myOneVersionPatientId);
|
assertExpunged(myOneVersionPatientId);
|
||||||
|
@ -319,7 +319,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
myPatientDao.expunge(new ExpungeOptions()
|
myPatientDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true)
|
.setExpungeDeletedResources(true)
|
||||||
.setExpungeOldVersions(true));
|
.setExpungeOldVersions(true), null);
|
||||||
|
|
||||||
// Only deleted and prior patients
|
// Only deleted and prior patients
|
||||||
assertStillThere(myOneVersionPatientId);
|
assertStillThere(myOneVersionPatientId);
|
||||||
|
@ -349,7 +349,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
});
|
});
|
||||||
|
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeEverything(true));
|
.setExpungeEverything(true), null);
|
||||||
|
|
||||||
// Everything deleted
|
// Everything deleted
|
||||||
assertExpunged(myOneVersionPatientId);
|
assertExpunged(myOneVersionPatientId);
|
||||||
|
@ -380,7 +380,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
|
|
||||||
mySystemDao.expunge(new ExpungeOptions()
|
mySystemDao.expunge(new ExpungeOptions()
|
||||||
.setExpungeDeletedResources(true));
|
.setExpungeDeletedResources(true), null);
|
||||||
|
|
||||||
// Everything deleted
|
// Everything deleted
|
||||||
assertExpunged(myOneVersionPatientId);
|
assertExpunged(myOneVersionPatientId);
|
||||||
|
|
Loading…
Reference in New Issue