Package ca.uhn.fhir.jpa.interceptor
Class CascadingDeleteInterceptor
java.lang.Object
ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor
Interceptor that allows for cascading deletes (deletes that resolve constraint issues).
For example, if DiagnosticReport/A
has a reference to Observation/B
it is not normally possible to delete Observation/B
without first deleting
DiagnosticReport/A
. With this interceptor in place, it is.
When using this interceptor, client requests must include the parameter
_cascade=delete
on the DELETE URL in order to activate
cascading delete, or include the request header X-Cascade-Delete: delete
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
-
Constructor Summary
ConstructorDescriptionCascadingDeleteInterceptor
(ca.uhn.fhir.context.FhirContext theFhirContext, DaoRegistry theDaoRegistry, ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc) Constructor -
Method Summary
Modifier and TypeMethodDescriptiongetCascadedDeletesList
(ca.uhn.fhir.rest.api.server.RequestDetails theRequest, boolean theCreate) handleDeleteConflicts
(DeleteConflictList theConflictList, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails) void
outgoingFailureOperationOutcome
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseOperationOutcome theResponse) void
outgoingResponse
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.ResponseDetails theResponseDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponse) protected ca.uhn.fhir.rest.api.DeleteCascadeModeEnum
shouldCascade
(ca.uhn.fhir.rest.api.server.RequestDetails theRequest) Subclasses may override
-
Field Details
-
OVERRIDE_PATH_BASED_REF_INTEGRITY_INTERCEPTOR_ORDER
- See Also:
-
CASCADING_DELETE_INTERCEPTOR_ORDER
- See Also:
-
-
Constructor Details
-
CascadingDeleteInterceptor
public CascadingDeleteInterceptor(@Nonnull ca.uhn.fhir.context.FhirContext theFhirContext, @Nonnull DaoRegistry theDaoRegistry, @Nonnull ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster, @Nonnull ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc) Constructor- Parameters:
theDaoRegistry
- The DAO registry (must not be null)
-
-
Method Details
-
handleDeleteConflicts
public DeleteConflictOutcome handleDeleteConflicts(DeleteConflictList theConflictList, ca.uhn.fhir.rest.api.server.RequestDetails theRequest, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails) -
getCascadedDeletesList
public static List<String> getCascadedDeletesList(ca.uhn.fhir.rest.api.server.RequestDetails theRequest, boolean theCreate) -
outgoingFailureOperationOutcome
public void outgoingFailureOperationOutcome(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseOperationOutcome theResponse) -
outgoingResponse
public void outgoingResponse(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.ResponseDetails theResponseDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponse) -
shouldCascade
@Nonnull protected ca.uhn.fhir.rest.api.DeleteCascadeModeEnum shouldCascade(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequest) Subclasses may override- Parameters:
theRequest
- The REST request (may be null)- Returns:
- Returns true if cascading delete should be allowed
-