From b9579313ef3780a4f193c5a41373aeedd8c17cdb Mon Sep 17 00:00:00 2001
From: JasonRoberts-smile
<85363818+JasonRoberts-smile@users.noreply.github.com>
Date: Mon, 23 May 2022 18:55:42 -0400
Subject: [PATCH] Jr 20220519 expunge config params (#3627)
* fix config settings for system-level expunge
* clean up expunge everything interface
* extract common system provider
* changelog
* version bump
* touch changelog to force a fresh pipeline
* re-enable publishing of checkstyle
* back out Gary's Sonatype change entirely
---
hapi-deployable-pom/pom.xml | 2 +-
hapi-fhir-android/pom.xml | 2 +-
hapi-fhir-base/pom.xml | 2 +-
.../src/main/java/ca/uhn/fhir/i18n/Msg.java | 2 +-
hapi-fhir-batch/pom.xml | 2 +-
hapi-fhir-bom/pom.xml | 4 +-
hapi-fhir-checkstyle/pom.xml | 9 +--
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +-
hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +-
hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +-
hapi-fhir-cli/pom.xml | 2 +-
hapi-fhir-client-okhttp/pom.xml | 2 +-
hapi-fhir-client/pom.xml | 2 +-
hapi-fhir-converter/pom.xml | 2 +-
hapi-fhir-dist/pom.xml | 2 +-
hapi-fhir-docs/pom.xml | 2 +-
.../6_1_0/3627-expunge-config-params.yaml | 7 +++
hapi-fhir-jacoco/pom.xml | 2 +-
hapi-fhir-jaxrsserver-base/pom.xml | 2 +-
hapi-fhir-jpa/pom.xml | 2 +-
hapi-fhir-jpaserver-base/pom.xml | 2 +-
.../fhir/jpa/dao/BaseHapiFhirSystemDao.java | 13 +++++
.../dao/expunge/ExpungeEverythingService.java | 1 -
.../jpa/provider/BaseJpaSystemProvider.java | 33 +----------
hapi-fhir-jpaserver-cql/pom.xml | 2 +-
hapi-fhir-jpaserver-mdm/pom.xml | 2 +-
.../interceptor/MdmStorageInterceptor.java | 3 +-
.../uhn/fhir/jpa/mdm/svc/MdmLinkSvcTest.java | 3 +-
hapi-fhir-jpaserver-model/pom.xml | 2 +-
hapi-fhir-jpaserver-searchparam/pom.xml | 2 +-
hapi-fhir-jpaserver-subscription/pom.xml | 2 +-
hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +-
.../ca/uhn/fhir/jpa/test/BaseJpaTest.java | 3 +
.../r5/StorageInterceptorEventsR5Test.java | 6 +-
...rtitionedSubscriptionTriggeringR4Test.java | 4 ++
.../ResourceProviderExpungeDstu2Test.java | 2 +
.../ResourceProviderExpungeDstu3Test.java | 2 +
.../fhir/jpa/provider/r4/ExpungeR4Test.java | 57 +++++++++++++++++++
hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +-
hapi-fhir-server-mdm/pom.xml | 2 +-
hapi-fhir-server-openapi/pom.xml | 2 +-
hapi-fhir-server/pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../hapi-fhir-spring-boot-samples/pom.xml | 2 +-
.../hapi-fhir-spring-boot-starter/pom.xml | 2 +-
hapi-fhir-spring-boot/pom.xml | 2 +-
hapi-fhir-sql-migrate/pom.xml | 2 +-
hapi-fhir-storage-batch2-jobs/pom.xml | 2 +-
hapi-fhir-storage-batch2/pom.xml | 2 +-
hapi-fhir-storage-test-utilities/pom.xml | 2 +-
hapi-fhir-storage/pom.xml | 2 +-
.../expunge/IExpungeEverythingService.java | 2 -
.../provider/BaseStorageSystemProvider.java | 45 +++++++++++++++
hapi-fhir-structures-dstu2.1/pom.xml | 2 +-
hapi-fhir-structures-dstu2/pom.xml | 2 +-
hapi-fhir-structures-dstu3/pom.xml | 2 +-
hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +-
hapi-fhir-structures-r4/pom.xml | 2 +-
hapi-fhir-structures-r5/pom.xml | 2 +-
hapi-fhir-test-utilities/pom.xml | 2 +-
hapi-fhir-testpage-overlay/pom.xml | 2 +-
.../pom.xml | 2 +-
hapi-fhir-validation-resources-dstu2/pom.xml | 2 +-
hapi-fhir-validation-resources-dstu3/pom.xml | 2 +-
hapi-fhir-validation-resources-r4/pom.xml | 2 +-
hapi-fhir-validation-resources-r5/pom.xml | 2 +-
hapi-fhir-validation/pom.xml | 2 +-
hapi-tinder-plugin/pom.xml | 16 +++---
hapi-tinder-test/pom.xml | 2 +-
pom.xml | 4 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
76 files changed, 214 insertions(+), 116 deletions(-)
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3627-expunge-config-params.yaml
create mode 100644 hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseStorageSystemProvider.java
diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index 592ec9548d2..0c2a24b13cc 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index e0cf4a88370..d5ab846bc65 100644
--- a/hapi-fhir-android/pom.xml
+++ b/hapi-fhir-android/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index bbaa597d838..33540e18ba7 100644
--- a/hapi-fhir-base/pom.xml
+++ b/hapi-fhir-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
index ca725d39928..54c46c6535b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java
@@ -25,7 +25,7 @@ public final class Msg {
/**
* IMPORTANT: Please update the following comment after you add a new code
- * Last code value: 2079
+ * Last code value: 2081
*/
private Msg() {}
diff --git a/hapi-fhir-batch/pom.xml b/hapi-fhir-batch/pom.xml
index 47da3d567c3..16fac4d58d3 100644
--- a/hapi-fhir-batch/pom.xml
+++ b/hapi-fhir-batch/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml
index 8688a5c6c6f..c4b3a9ba3e4 100644
--- a/hapi-fhir-bom/pom.xml
+++ b/hapi-fhir-bom/pom.xml
@@ -3,14 +3,14 @@
4.0.0
ca.uhn.hapi.fhir
hapi-fhir-bom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
pom
HAPI FHIR BOM
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml
index d19bdeaefbf..c14cb1a9adb 100644
--- a/hapi-fhir-checkstyle/pom.xml
+++ b/hapi-fhir-checkstyle/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
@@ -38,13 +38,6 @@
-
- org.apache.maven.plugins
- maven-deploy-plugin
-
- true
-
-
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index e7babd874aa..be1c2c922a4 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
index a41a2785860..8efddaf2c67 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir-cli
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
index f8dc3688c90..bfa481aed2f 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../hapi-deployable-pom
diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml
index 894fadb6bca..bae516acb27 100644
--- a/hapi-fhir-cli/pom.xml
+++ b/hapi-fhir-cli/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index cc9dfae5e23..84518073e2a 100644
--- a/hapi-fhir-client-okhttp/pom.xml
+++ b/hapi-fhir-client-okhttp/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml
index d1fd439a416..1d1b416bcd4 100644
--- a/hapi-fhir-client/pom.xml
+++ b/hapi-fhir-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml
index 026a790b549..58cb8ed82cf 100644
--- a/hapi-fhir-converter/pom.xml
+++ b/hapi-fhir-converter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml
index 800c32a8c61..22c4f28e8b9 100644
--- a/hapi-fhir-dist/pom.xml
+++ b/hapi-fhir-dist/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml
index c4acc984514..3ae5f9ab642 100644
--- a/hapi-fhir-docs/pom.xml
+++ b/hapi-fhir-docs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3627-expunge-config-params.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3627-expunge-config-params.yaml
new file mode 100644
index 00000000000..1963584de32
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3627-expunge-config-params.yaml
@@ -0,0 +1,7 @@
+---
+type: fix
+issue: 3627
+title: "Previously, the `$expunge` operation at the system level was always available, regardless of
+configuration parameter settings. Now, the system-level `$expunge` operation requires that the `Expunge Enabled`
+parameter is enabled. Additionally, the `expungeEverything` option of the operation requires that the
+`Allow Multiple Delete Enabled` parameter is enabled."
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 010bdfc1972..b0fde5194a5 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -11,7 +11,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index 91b1ec8c886..52262909039 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml
index d85de58a2b0..de9a859adf6 100644
--- a/hapi-fhir-jpa/pom.xml
+++ b/hapi-fhir-jpa/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 4cf5084d188..a294979a3e1 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java
index 5ec1396e7e1..29a22be18a9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java
@@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.dao;
+import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
@@ -13,6 +14,7 @@ import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
+import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
@@ -83,9 +85,20 @@ public abstract class BaseHapiFhirSystemDao extends B
@Override
@Transactional(propagation = Propagation.NEVER)
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
+ validateExpungeEnabled(theExpungeOptions);
return myExpungeService.expunge(null, null, theExpungeOptions, theRequestDetails);
}
+ private void validateExpungeEnabled(ExpungeOptions theExpungeOptions) {
+ if (!getConfig().isExpungeEnabled()) {
+ throw new MethodNotAllowedException(Msg.code(2080) + "$expunge is not enabled on this server");
+ }
+
+ if (theExpungeOptions.isExpungeEverything() && !getConfig().isAllowMultipleDelete()) {
+ throw new MethodNotAllowedException(Msg.code(2081) + "Multiple delete is not enabled on this server");
+ }
+ }
+
@Transactional(propagation = Propagation.REQUIRED)
@Override
public Map getResourceCounts() {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
index 73d89c88325..9ee30533fe9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
@@ -225,7 +225,6 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
return outcome;
}
- @Override
public int expungeEverythingByType(Class> theEntityType) {
int result = expungeEverythingByTypeWithoutPurging(theEntityType);
purgeAllCaches();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
index ff2ce315b85..ba91f774b09 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
@@ -52,7 +52,7 @@ import org.springframework.beans.factory.annotation.Required;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
-public class BaseJpaSystemProvider extends BaseJpaProvider implements IJpaSystemProvider {
+public class BaseJpaSystemProvider extends BaseStorageSystemProvider implements IJpaSystemProvider {
private static final Logger ourLog = LoggerFactory.getLogger(BaseJpaSystemProvider.class);
public static final String RESP_PARAM_SUCCESS = "success";
@@ -70,7 +70,6 @@ public class BaseJpaSystemProvider extends BaseJpaProvider implements IJp
@Deprecated
public static final String PERFORM_REINDEXING_PASS = ProviderConstants.PERFORM_REINDEXING_PASS;
- private IFhirSystemDao myDao;
@Autowired
private IResourceReindexingSvc myResourceReindexingSvc;
@@ -86,36 +85,6 @@ public class BaseJpaSystemProvider extends BaseJpaProvider implements IJp
return myResourceReindexingSvc;
}
- @Operation(name = ProviderConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
- @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, typeName = "integer")
- })
- public IBaseParameters expunge(
- @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_LIMIT, typeName = "integer") IPrimitiveType theLimit,
- @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES, typeName = "boolean") IPrimitiveType theExpungeDeletedResources,
- @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS, typeName = "boolean") IPrimitiveType theExpungeOldVersions,
- @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING, typeName = "boolean") IPrimitiveType theExpungeEverything,
- RequestDetails theRequestDetails
- ) {
- ExpungeOptions options = createExpungeOptions(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything);
- ExpungeOutcome outcome = getDao().expunge(options, theRequestDetails);
- return createExpungeResponse(outcome);
- }
-
- protected IBaseParameters 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);
- ExpungeOutcome outcome = getDao().expunge(options, theRequestDetails);
- return createExpungeResponse(outcome);
- }
-
- protected IFhirSystemDao getDao() {
- return myDao;
- }
-
- @Required
- public void setDao(IFhirSystemDao theDao) {
- myDao = theDao;
- }
-
@History
public IBundleProvider historyServer(
HttpServletRequest theRequest,
diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml
index 1cab30e5f14..720846bc3ab 100644
--- a/hapi-fhir-jpaserver-cql/pom.xml
+++ b/hapi-fhir-jpaserver-cql/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml
index bfea37f93c2..4073bd9a99b 100644
--- a/hapi-fhir-jpaserver-mdm/pom.xml
+++ b/hapi-fhir-jpaserver-mdm/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptor.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptor.java
index 1cfac44c5dc..d84735ce5da 100644
--- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptor.java
+++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptor.java
@@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.mdm.interceptor;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jpa.dao.expunge.ExpungeEverythingService;
import ca.uhn.fhir.jpa.dao.expunge.IExpungeEverythingService;
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
import ca.uhn.fhir.mdm.api.MdmConstants;
@@ -215,7 +216,7 @@ public class MdmStorageInterceptor implements IMdmStorageInterceptor {
@Hook(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING)
public void expungeAllMdmLinks(AtomicInteger theCounter) {
ourLog.debug("Expunging all MdmLink records");
- theCounter.addAndGet(myExpungeEverythingService.expungeEverythingByType(MdmLink.class));
+ theCounter.addAndGet(((ExpungeEverythingService)myExpungeEverythingService).expungeEverythingByType(MdmLink.class));
}
@Hook(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE)
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcTest.java
index 7412526d951..6899fcc3bcb 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcTest.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcTest.java
@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.mdm.svc;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.i18n.Msg;
+import ca.uhn.fhir.jpa.dao.expunge.ExpungeEverythingService;
import ca.uhn.fhir.jpa.dao.expunge.IExpungeEverythingService;
import ca.uhn.fhir.jpa.entity.MdmLink;
import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test;
@@ -35,7 +36,7 @@ public class MdmLinkSvcTest extends BaseMdmR4Test {
@Autowired
IMdmLinkSvc myMdmLinkSvc;
@Autowired
- IExpungeEverythingService myExpungeEverythingService;
+ ExpungeEverythingService myExpungeEverythingService;
@Override
@AfterEach
diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml
index 4d4d6a6595e..40da9904b77 100644
--- a/hapi-fhir-jpaserver-model/pom.xml
+++ b/hapi-fhir-jpaserver-model/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml
index 3e8b7994aa4..a85c3082881 100755
--- a/hapi-fhir-jpaserver-searchparam/pom.xml
+++ b/hapi-fhir-jpaserver-searchparam/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml
index 0e81f805d27..b66e0ee5acb 100644
--- a/hapi-fhir-jpaserver-subscription/pom.xml
+++ b/hapi-fhir-jpaserver-subscription/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml
index 146df6b038f..93b314b545d 100644
--- a/hapi-fhir-jpaserver-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java
index 5b3d19c96bf..1b62bba7c4f 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java
@@ -767,7 +767,9 @@ public abstract class BaseJpaTest extends BaseTest {
theBulkDataJobActivator.cancelAndPurgeAllJobs();
boolean expungeEnabled = theDaoConfig.isExpungeEnabled();
+ boolean multiDeleteEnabled = theDaoConfig.isAllowMultipleDelete();
theDaoConfig.setExpungeEnabled(true);
+ theDaoConfig.setAllowMultipleDelete(true);
for (int count = 0; ; count++) {
try {
@@ -787,6 +789,7 @@ public abstract class BaseJpaTest extends BaseTest {
}
}
theDaoConfig.setExpungeEnabled(expungeEnabled);
+ theDaoConfig.setAllowMultipleDelete(multiDeleteEnabled);
theSearchParamRegistry.forceRefresh();
}
diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java
index e80d6244fab..84a4273e3fb 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.dao.r5;
import ca.uhn.fhir.interceptor.api.Pointcut;
+import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
@@ -14,6 +15,7 @@ import org.hl7.fhir.r5.model.IdType;
import org.hl7.fhir.r5.model.Patient;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.List;
@@ -27,8 +29,9 @@ import static org.mockito.Mockito.when;
public class StorageInterceptorEventsR5Test extends BaseJpaR5Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StorageInterceptorEventsR5Test.class);
- @Test
+ @BeforeEach
public void before() {
+ myDaoConfig.setExpungeEnabled(true);
}
@Test
@@ -123,6 +126,7 @@ public class StorageInterceptorEventsR5Test extends BaseJpaR5Test {
@AfterEach
public void after() {
myInterceptorRegistry.unregisterAllInterceptors();
+ myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
}
diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java
index fdebd7c87c1..eb025492cf8 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java
@@ -89,7 +89,11 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4
myStoppableSubscriptionDeliveringRestHookSubscriber.unPause();
myDaoConfig.setTriggerSubscriptionsForNonVersioningChanges(new DaoConfig().isTriggerSubscriptionsForNonVersioningChanges());
+ myDaoConfig.setExpungeEnabled(true);
+ myDaoConfig.setAllowMultipleDelete(true);
myDaoRegistry.getSystemDao().expunge(new ExpungeOptions().setExpungeEverything(true), null);
+ myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
+ myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
myPartitionSettings.setUnnamedPartitionMode(false);
diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java
index 39b00185e08..8e56373c552 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java
@@ -31,6 +31,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
@AfterEach
public void afterDisableExpunge() {
myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
+ myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
}
private void assertExpunged(IIdType theId) {
@@ -108,6 +109,7 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T
@BeforeEach
public void beforeEnableExpunge() {
myDaoConfig.setExpungeEnabled(true);
+ myDaoConfig.setAllowMultipleDelete(true);
}
private IFhirResourceDao> getDao(IIdType theId) {
diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java
index 52aa2d8a5c7..40cade818bd 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java
@@ -38,6 +38,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
@AfterEach
public void afterDisableExpunge() {
myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
+ myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
}
private void assertExpunged(IIdType theId) {
@@ -115,6 +116,7 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T
@BeforeEach
public void beforeEnableExpunge() {
myDaoConfig.setExpungeEnabled(true);
+ myDaoConfig.setAllowMultipleDelete(true);
}
private IFhirResourceDao> getDao(IIdType theId) {
diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
index 2db43fad5e4..7bf79fdc63b 100644
--- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
+++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java
@@ -18,6 +18,7 @@ import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.ReferenceParam;
import ca.uhn.fhir.rest.param.TokenParam;
+import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
@@ -29,6 +30,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.CodeableConcept;
+import org.hl7.fhir.r4.model.ContactPoint;
import org.hl7.fhir.r4.model.DateType;
import org.hl7.fhir.r4.model.DecimalType;
import org.hl7.fhir.r4.model.Enumerations;
@@ -48,6 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.time.Instant;
+import java.util.Date;
import java.util.List;
import static org.awaitility.Awaitility.await;
@@ -77,6 +81,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
@AfterEach
public void afterDisableExpunge() {
myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled());
+ myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
ourRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof CascadingDeleteInterceptor);
@@ -85,6 +90,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
@BeforeEach
public void beforeEnableExpunge() {
myDaoConfig.setExpungeEnabled(true);
+ myDaoConfig.setAllowMultipleDelete(true);
}
private void assertExpunged(IIdType theId) {
@@ -680,4 +686,55 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
}
+ @Test
+ public void testExpungeOperationRespectsConfiguration() {
+ // set up
+ myDaoConfig.setExpungeEnabled(false);
+ myDaoConfig.setAllowMultipleDelete(false);
+
+ createStandardPatients();
+
+ // execute
+ try {
+ myPatientDao.expunge(myOneVersionPatientId,
+ new ExpungeOptions().setExpungeOldVersions(true), null);
+ fail();
+ } catch (MethodNotAllowedException e) {
+ assertEquals("HAPI-0968: $expunge is not enabled on this server", e.getMessage());
+ }
+
+ try {
+ myPatientDao.expunge(myOneVersionPatientId.toVersionless(),
+ new ExpungeOptions().setExpungeOldVersions(true), null);
+ fail();
+ } catch (MethodNotAllowedException e) {
+ assertEquals("HAPI-0968: $expunge is not enabled on this server", e.getMessage());
+ }
+
+ try {
+ myPatientDao.expunge(null,
+ new ExpungeOptions().setExpungeOldVersions(true), null);
+ fail();
+ } catch (MethodNotAllowedException e) {
+ assertEquals("HAPI-0968: $expunge is not enabled on this server", e.getMessage());
+ }
+
+ try {
+ mySystemDao.expunge(new ExpungeOptions().setExpungeEverything(true), null);
+ fail();
+ } catch (MethodNotAllowedException e) {
+ assertEquals("HAPI-2080: $expunge is not enabled on this server", e.getMessage());
+ }
+
+ myDaoConfig.setExpungeEnabled(true);
+ try {
+ mySystemDao.expunge(new ExpungeOptions().setExpungeEverything(true), null);
+ fail();
+ } catch (MethodNotAllowedException e) {
+ assertEquals("HAPI-2081: Multiple delete is not enabled on this server", e.getMessage());
+ }
+
+ // re-enable multi-delete for clean-up
+ myDaoConfig.setAllowMultipleDelete(true);
+ }
}
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
index 07960b6ed4a..65bcd20e138 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
+++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml
index cf066043baa..f152851aca9 100644
--- a/hapi-fhir-server-mdm/pom.xml
+++ b/hapi-fhir-server-mdm/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml
index 0fb5d76646d..97024cb0c65 100644
--- a/hapi-fhir-server-openapi/pom.xml
+++ b/hapi-fhir-server-openapi/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml
index 22b73c28e4b..2ade51bf7fb 100644
--- a/hapi-fhir-server/pom.xml
+++ b/hapi-fhir-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
index c428ee8a0b7..1cff3544877 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
index 519986a1af0..e3e4bcd9c22 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
hapi-fhir-spring-boot-sample-client-apache
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
index b5136faedc4..96783acb934 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
hapi-fhir-spring-boot-sample-client-okhttp
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
index 86a291ac1a9..0e579c275e1 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
hapi-fhir-spring-boot-sample-server-jersey
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
index df8853ea2b2..bdf4dfd66c9 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
hapi-fhir-spring-boot-samples
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
index c9caf950100..7a47055dadd 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml
index dd881551057..1b27c6fef53 100644
--- a/hapi-fhir-spring-boot/pom.xml
+++ b/hapi-fhir-spring-boot/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml
index ff22fd47c0b..43788ed2bf2 100644
--- a/hapi-fhir-sql-migrate/pom.xml
+++ b/hapi-fhir-sql-migrate/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml
index f6f9aa396d1..c076bba42fc 100644
--- a/hapi-fhir-storage-batch2-jobs/pom.xml
+++ b/hapi-fhir-storage-batch2-jobs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml
index 85aaa3baf95..f03cdcf51b3 100644
--- a/hapi-fhir-storage-batch2/pom.xml
+++ b/hapi-fhir-storage-batch2/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml
index 8f287dc2082..25215b0cd02 100644
--- a/hapi-fhir-storage-test-utilities/pom.xml
+++ b/hapi-fhir-storage-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml
index 017dca6faf5..70eb124586b 100644
--- a/hapi-fhir-storage/pom.xml
+++ b/hapi-fhir-storage/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IExpungeEverythingService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IExpungeEverythingService.java
index 8defd01ec5e..16a6850fb45 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IExpungeEverythingService.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IExpungeEverythingService.java
@@ -26,6 +26,4 @@ import javax.annotation.Nullable;
public interface IExpungeEverythingService {
void expungeEverything(@Nullable RequestDetails theRequest);
-
- int expungeEverythingByType(Class> theEntityType);
}
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseStorageSystemProvider.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseStorageSystemProvider.java
new file mode 100644
index 00000000000..13e13d9dec6
--- /dev/null
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseStorageSystemProvider.java
@@ -0,0 +1,45 @@
+package ca.uhn.fhir.jpa.provider;
+
+import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
+import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
+import ca.uhn.fhir.jpa.api.model.ExpungeOutcome;
+import ca.uhn.fhir.jpa.model.util.JpaConstants;
+import ca.uhn.fhir.rest.annotation.Operation;
+import ca.uhn.fhir.rest.annotation.OperationParam;
+import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.server.provider.ProviderConstants;
+import org.hl7.fhir.instance.model.api.IBaseParameters;
+import org.hl7.fhir.instance.model.api.IPrimitiveType;
+import org.springframework.beans.factory.annotation.Required;
+
+public class BaseStorageSystemProvider extends BaseJpaProvider {
+ protected IFhirSystemDao myDao;
+
+ @Operation(name = ProviderConstants.OPERATION_EXPUNGE, idempotent = false, returnParameters = {
+ @OperationParam(name = JpaConstants.OPERATION_EXPUNGE_OUT_PARAM_EXPUNGE_COUNT, typeName = "integer")
+ })
+ public IBaseParameters expunge(
+ @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_LIMIT, typeName = "integer") IPrimitiveType theLimit,
+ @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_DELETED_RESOURCES, typeName = "boolean") IPrimitiveType theExpungeDeletedResources,
+ @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_PREVIOUS_VERSIONS, typeName = "boolean") IPrimitiveType theExpungeOldVersions,
+ @OperationParam(name = ProviderConstants.OPERATION_EXPUNGE_PARAM_EXPUNGE_EVERYTHING, typeName = "boolean") IPrimitiveType theExpungeEverything,
+ RequestDetails theRequestDetails
+ ) {
+ return doExpunge(theLimit, theExpungeDeletedResources, theExpungeOldVersions, theExpungeEverything, theRequestDetails);
+ }
+
+ protected IBaseParameters 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);
+ ExpungeOutcome outcome = getDao().expunge(options, theRequestDetails);
+ return createExpungeResponse(outcome);
+ }
+
+ protected IFhirSystemDao getDao() {
+ return myDao;
+ }
+
+ @Required
+ public void setDao(IFhirSystemDao theDao) {
+ myDao = theDao;
+ }
+}
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index 578cdb665c2..574953887dd 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index e2eef7afa86..8fbac653105 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index a4a8fffa9cb..e9f966c9d6f 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml
index 7895675715a..8c04771e5a2 100644
--- a/hapi-fhir-structures-hl7org-dstu2/pom.xml
+++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml
index 4b52e42b6b0..288beaafc0c 100644
--- a/hapi-fhir-structures-r4/pom.xml
+++ b/hapi-fhir-structures-r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml
index 6a569de0fef..992d6fe4cd6 100644
--- a/hapi-fhir-structures-r5/pom.xml
+++ b/hapi-fhir-structures-r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml
index b80c5b95e4d..0da1d6bcbfa 100644
--- a/hapi-fhir-test-utilities/pom.xml
+++ b/hapi-fhir-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml
index e3bbe17d5f2..0e4eb6a1e56 100644
--- a/hapi-fhir-testpage-overlay/pom.xml
+++ b/hapi-fhir-testpage-overlay/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml
index a91aa688404..558b65867b7 100644
--- a/hapi-fhir-validation-resources-dstu2.1/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml
index d039b9838f6..daed3731489 100644
--- a/hapi-fhir-validation-resources-dstu2/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml
index 4b859e90f06..851e439e407 100644
--- a/hapi-fhir-validation-resources-dstu3/pom.xml
+++ b/hapi-fhir-validation-resources-dstu3/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml
index cb5bac64229..1c870ba89bf 100644
--- a/hapi-fhir-validation-resources-r4/pom.xml
+++ b/hapi-fhir-validation-resources-r4/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml
index 42c3fa67df9..e4bdcc49335 100644
--- a/hapi-fhir-validation-resources-r5/pom.xml
+++ b/hapi-fhir-validation-resources-r5/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml
index 5280764fd78..1bec678fa94 100644
--- a/hapi-fhir-validation/pom.xml
+++ b/hapi-fhir-validation/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml
index 8dedce2f23f..b79e69d8592 100644
--- a/hapi-tinder-plugin/pom.xml
+++ b/hapi-tinder-plugin/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
@@ -58,37 +58,37 @@
ca.uhn.hapi.fhir
hapi-fhir-structures-dstu3
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-hl7org-dstu2
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r4
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r5
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu2
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu3
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-r4
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
org.apache.velocity
diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml
index ee4e353531d..88e3ea88b66 100644
--- a/hapi-tinder-test/pom.xml
+++ b/hapi-tinder-test/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index 04afcdded61..a1923e84ca1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
pom
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
HAPI-FHIR
An open-source implementation of the FHIR specification in Java.
https://hapifhir.io
@@ -2006,7 +2006,7 @@
ca.uhn.hapi.fhir
hapi-fhir-checkstyle
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
index 13ad0e48583..142c93e7ebb 100644
--- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
+++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
index 34333a605b8..5bdc6ff6882 100644
--- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
index 73772e5e9c4..79d2c5d672b 100644
--- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.1.0-PRE1-SNAPSHOT
+ 6.1.0-PRE2-SNAPSHOT
../../pom.xml