From a3ae6c3813ce02478c2e36476b6e04919768bb65 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 2 Dec 2020 14:10:37 -0500
Subject: [PATCH 1/9] Add partition selector to id parameter (#2208)
* Add partition selector to id parameter
* Add changelog
---
...08-add-partition-selector-to-id-param.yaml | 6 +
.../fhir/jpa/search/builder/QueryStack.java | 2 +-
.../predicate/ResourceIdPredicateBuilder.java | 7 +-
.../jpa/dao/r4/PartitioningSqlR4Test.java | 225 ++++++++++++++++++
.../fhir/test/utilities/ITestDataBuilder.java | 2 +-
5 files changed, 238 insertions(+), 4 deletions(-)
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
new file mode 100644
index 00000000000..ab06b8460bd
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
@@ -0,0 +1,6 @@
+---
+type: bug
+issue: 2208
+title: "When performing a JPA server search on a partitioned server, searches with only the `_id` parameter and no other
+ parameters did not include the partition selector in the generated SQL, resulting in leakage across partitions. Thanks to
+ GitHub user @jtheory for reporting!"
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
index 200157210a3..6970081e753 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
@@ -739,7 +739,7 @@ public class QueryStack {
codePredicates.add(singleCode);
}
- return join.combineWithRequestPartitionIdPredicate(theRequestPartitionId, ComboCondition.or(codePredicates.toArray(new Condition[0])));
+ return join.combineWithRequestPartitionIdPredicate(theRequestPartitionId, toOrPredicate(codePredicates));
}
public Condition createPredicateTag(@Nullable DbColumn theSourceJoinColumn, List> theList, String theParamName, RequestPartitionId theRequestPartitionId) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceIdPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceIdPredicateBuilder.java
index 33e91dab8a4..158bb28ee0d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceIdPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceIdPredicateBuilder.java
@@ -115,12 +115,15 @@ public class ResourceIdPredicateBuilder extends BasePredicateBuilder {
List resourceIds = ResourcePersistentId.toLongList(allOrPids);
if (theSourceJoinColumn == null) {
BaseJoiningPredicateBuilder queryRootTable = super.getOrCreateQueryRootTable();
+ Condition predicate;
switch (operation) {
default:
case eq:
- return queryRootTable.createPredicateResourceIds(false, resourceIds);
+ predicate = queryRootTable.createPredicateResourceIds(false, resourceIds);
+ return queryRootTable.combineWithRequestPartitionIdPredicate(theRequestPartitionId, predicate);
case ne:
- return queryRootTable.createPredicateResourceIds(true, resourceIds);
+ predicate = queryRootTable.createPredicateResourceIds(true, resourceIds);
+ return queryRootTable.combineWithRequestPartitionIdPredicate(theRequestPartitionId, predicate);
}
} else {
return QueryStack.toEqualToOrInPredicate(theSourceJoinColumn, generatePlaceholders(resourceIds), operation == SearchFilterParser.CompareOperation.ne);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
index 731b91a5279..8045dc5206c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
@@ -1136,6 +1136,231 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
}
}
+ @Test
+ public void testSearch_IdParamOnly_PidId_SpecificPartition() {
+ IIdType patientIdNull = createPatient(withPartition(null), withActiveTrue());
+ IIdType patientId1 = createPatient(withPartition(1), withActiveTrue());
+ IIdType patientId2 = createPatient(withPartition(2), withActiveTrue());
+
+ /* *******************************
+ * _id param is only parameter
+ * *******************************/
+
+ // Read in correct Partition
+ {
+ myCaptureQueriesListener.clear();
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(1, searchOutcome.size());
+ IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId1, gotId1);
+
+ String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, false);
+ ourLog.info("Search SQL:\n{}", searchSql);
+
+ // Only the read columns should be used, no criteria use partition
+ assertThat(searchSql, searchSql, containsString("PARTITION_ID IN ('1')"));
+ assertEquals(1, StringUtils.countMatches(searchSql, "PARTITION_ID"), searchSql);
+ }
+
+ // Read in null Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ // Read in wrong Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ }
+
+
+ @Test
+ public void testSearch_IdParamSecond_PidId_SpecificPartition() {
+ IIdType patientIdNull = createPatient(withPartition(null), withActiveTrue());
+ IIdType patientId1 = createPatient(withPartition(1), withActiveTrue());
+ IIdType patientId2 = createPatient(withPartition(2), withActiveTrue());
+
+ /* *******************************
+ * _id param is second parameter
+ * *******************************/
+
+ // Read in correct Partition
+ {
+ myCaptureQueriesListener.clear();
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(1, searchOutcome.size());
+ IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId1, gotId1);
+
+ String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, false);
+ ourLog.info("Search SQL:\n{}", searchSql);
+
+ // Only the read columns should be used, no criteria use partition
+ assertThat(searchSql, searchSql, containsString("PARTITION_ID IN ('1')"));
+ assertEquals(2, StringUtils.countMatches(searchSql, "PARTITION_ID"), searchSql); // If this switches to 1 that would be fine
+ }
+
+ // Read in null Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ // Read in wrong Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ }
+
+
+ @Test
+ public void testSearch_IdParamOnly_ForcedId_SpecificPartition() {
+ addReadPartition(new Integer[]{null});
+ IIdType patientIdNull = createPatient(withPartition(null), withId("PT-NULL"), withActiveTrue());
+ addReadPartition(1);
+ IIdType patientId1 = createPatient(withPartition(1), withId("PT-1"), withActiveTrue());
+ addReadPartition(2);
+ IIdType patientId2 = createPatient(withPartition(2), withId("PT-2"), withActiveTrue());
+
+ /* *******************************
+ * _id param is only parameter
+ * *******************************/
+
+ // Read in correct Partition
+ {
+ myCaptureQueriesListener.clear();
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(1, searchOutcome.size());
+ IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId1, gotId1);
+
+ String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, false).toUpperCase();
+ ourLog.info("Search SQL:\n{}", searchSql);
+
+ // Only the read columns should be used, no criteria use partition
+ assertThat(searchSql, searchSql, containsString("PARTITION_ID IN ('1')"));
+ assertEquals(1, StringUtils.countMatches(searchSql, "PARTITION_ID"), searchSql);
+ }
+
+ // Read in null Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ // Read in wrong Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ }
+
+
+ @Test
+ public void testSearch_IdParamSecond_ForcedId_SpecificPartition() {
+ addReadPartition(new Integer[]{null});
+ IIdType patientIdNull = createPatient(withPartition(null), withId("PT-NULL"), withActiveTrue());
+ addReadPartition(1);
+ IIdType patientId1 = createPatient(withPartition(1), withId("PT-1"), withActiveTrue());
+ addReadPartition(2);
+ IIdType patientId2 = createPatient(withPartition(2), withId("PT-2"), withActiveTrue());
+
+ /* *******************************
+ * _id param is second parameter
+ * *******************************/
+
+ // Read in correct Partition
+ {
+ myCaptureQueriesListener.clear();
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(1, searchOutcome.size());
+ IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId1, gotId1);
+
+ // First SQL resolves the forced ID
+ String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, false).toUpperCase();
+ ourLog.info("Search SQL:\n{}", searchSql);
+ assertThat(searchSql, searchSql, containsString("PARTITION_ID IN ('1')"));
+ assertEquals(1, StringUtils.countMatches(searchSql, "PARTITION_ID"), searchSql);
+
+ // Second SQL performs the search
+ searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(1).getSql(true, false).toUpperCase();
+ ourLog.info("Search SQL:\n{}", searchSql);
+ assertThat(searchSql, searchSql, containsString("PARTITION_ID IN ('1')"));
+ assertEquals(2, StringUtils.countMatches(searchSql, "PARTITION_ID"), searchSql); // If this switches to 1 that would be fine
+ }
+
+ // Read in null Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ // Read in wrong Partition
+ {
+ addReadPartition(1);
+
+ SearchParameterMap map = SearchParameterMap.newSynchronous()
+ .add(Patient.SP_ACTIVE, new TokenParam("true"))
+ .add(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
+ IBundleProvider searchOutcome = myPatientDao.search(map);
+ assertEquals(0, searchOutcome.size());
+ }
+
+ }
+
+
+
+
@Test
public void testSearch_MissingParamString_SearchAllPartitions() {
myPartitionSettings.setIncludePartitionInSearchHashes(false);
diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java
index 6effc53d145..8869bf7dce4 100644
--- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java
+++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java
@@ -115,7 +115,7 @@ public interface ITestDataBuilder {
default Consumer withId(String theId) {
return t -> {
- assertThat(theId, matchesPattern("[a-zA-Z0-9]+"));
+ assertThat(theId, matchesPattern("[a-zA-Z0-9-]+"));
t.setId(theId);
};
}
From 1b263f1c32a8587c8225d1e5b398e58f79882e5f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 2 Dec 2020 14:47:10 -0500
Subject: [PATCH 2/9] Bump jetty_version from 9.4.34.v20201102 to
9.4.35.v20201120 (#2210)
Bumps `jetty_version` from 9.4.34.v20201102 to 9.4.35.v20201120.
Updates `jetty-http` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-servlets` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-io` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-continuation` from 9.4.34.v20201102 to 9.4.35.v20201120
Updates `jetty-security` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-servlet` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-server` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-util` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-webapp` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `jetty-xml` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Updates `websocket-api` from 9.4.34.v20201102 to 9.4.35.v20201120
Updates `websocket-client` from 9.4.34.v20201102 to 9.4.35.v20201120
Updates `websocket-server` from 9.4.34.v20201102 to 9.4.35.v20201120
Updates `jetty-maven-plugin` from 9.4.34.v20201102 to 9.4.35.v20201120
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.34.v20201102...jetty-9.4.35.v20201120)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5612420ee6a..4b6eb0759d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -738,7 +738,7 @@
3.16.0
2.25.1
- 9.4.34.v20201102
+ 9.4.35.v20201120
3.0.2
5.6.2
6.5.4
From 0f80c2adf98bea296c9e20825495f7b905eded94 Mon Sep 17 00:00:00 2001
From: jamesagnew
Date: Wed, 2 Dec 2020 14:48:14 -0500
Subject: [PATCH 3/9] Update changelog
---
.../resources/ca/uhn/hapi/fhir/changelog/5_3_0/changes.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/changes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/changes.yaml
index b01e3b90aee..c94ecf61318 100644
--- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/changes.yaml
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/changes.yaml
@@ -5,5 +5,5 @@
(dependent HAPI modules listed in brackets):
- Woodstox (XML FHIR Parser): 4.4.1 -> 6.2.3 (Note that the Maven groupId has changed from
org.codehaus.woodstox
to com.fasterxml.woodstox
and the Maven artifactId has changed from woodstox-core-asl
to woodstox-core
for this library)
- - Jetty (JPA Starter): 9.4.30.v20200611 -> 9.4.34.v20201102
+ - Jetty (JPA Starter): 9.4.30.v20200611 -> 9.4.35.v20201120
"
From 53bd2717174a415c5e0bf1ff0775406e7b26b8cc Mon Sep 17 00:00:00 2001
From: Bill Denton
Date: Wed, 2 Dec 2020 13:24:07 -0800
Subject: [PATCH 4/9] Split package: delete 'ca.uhn.fhir.rest.server' package
from hapi-fhir-server-empi
---
.../ca/uhn/fhir/interceptor/api/Pointcut.java | 2 +-
.../jpa/empi/broker/EmpiMessageHandler.java | 2 +-
.../fhir/jpa/empi/svc/EmpiMatchLinkSvc.java | 3 ++-
.../fhir/jpa/empi/helper/EmpiHelperR4.java | 3 ++-
.../interceptor/EmpiStorageInterceptorIT.java | 2 +-
.../jpa/empi/svc/EmpiPersonMergerSvcTest.java | 2 +-
.../empi/model/EmpiTransactionContext.java | 22 -------------------
.../model}/TransactionLogMessages.java | 2 +-
.../fhir/empi/provider/BaseEmpiProvider.java | 2 +-
9 files changed, 10 insertions(+), 30 deletions(-)
rename hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/{rest/server => empi/model}/TransactionLogMessages.java (98%)
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
index bd86c55a044..f9f147b0a9a 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
@@ -1717,7 +1717,7 @@ public enum Pointcut {
* Hooks should return void
.
*
*/
- EMPI_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage", "ca.uhn.fhir.rest.server.TransactionLogMessages"),
+ EMPI_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage", "ca.uhn.fhir.empi.model.TransactionLogMessages"),
/**
* Performance Tracing Hook:
diff --git a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
index d1bc6211d9c..771924692af 100644
--- a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
+++ b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
@@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.empi.broker;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.empi.log.Logs;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.util.EmpiUtil;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
@@ -31,7 +32,6 @@ import ca.uhn.fhir.jpa.empi.svc.EmpiMatchLinkSvc;
import ca.uhn.fhir.jpa.empi.svc.EmpiResourceFilteringSvc;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage;
import org.hl7.fhir.instance.model.api.IAnyResource;
diff --git a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
index 31d1bf6fbc8..5dc521d8145 100644
--- a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
+++ b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
@@ -25,12 +25,13 @@ import ca.uhn.fhir.empi.api.EmpiMatchOutcome;
import ca.uhn.fhir.empi.api.IEmpiLinkSvc;
import ca.uhn.fhir.empi.log.Logs;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.util.EmpiUtil;
import ca.uhn.fhir.empi.util.PersonHelper;
import ca.uhn.fhir.jpa.empi.svc.candidate.CandidateList;
import ca.uhn.fhir.jpa.empi.svc.candidate.EmpiPersonFindingSvc;
import ca.uhn.fhir.jpa.empi.svc.candidate.MatchedPersonCandidate;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
+
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
index 9e7a3f19c00..58e4bee84c1 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
@@ -1,10 +1,11 @@
package ca.uhn.fhir.jpa.empi.helper;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
+
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
index e3575c743a7..60726f25887 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.empi.interceptor;
import ca.uhn.fhir.empi.model.CanonicalEID;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
@@ -11,7 +12,6 @@ import ca.uhn.fhir.jpa.entity.EmpiLink;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
index c7cd05b2c9f..76c23ab4c27 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
@@ -5,12 +5,12 @@ import ca.uhn.fhir.empi.api.EmpiMatchOutcome;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.empi.api.IEmpiPersonMergerSvc;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.empi.BaseEmpiR4Test;
import ca.uhn.fhir.jpa.empi.helper.EmpiLinkHelper;
import ca.uhn.fhir.jpa.empi.interceptor.IEmpiStorageInterceptor;
import ca.uhn.fhir.jpa.entity.EmpiLink;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import org.hl7.fhir.r4.model.Address;
import org.hl7.fhir.r4.model.DateType;
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
index 6e659028105..f10296a226d 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
+++ b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
@@ -1,27 +1,5 @@
package ca.uhn.fhir.empi.model;
-/*-
- * #%L
- * HAPI FHIR - Enterprise Master Patient Index
- * %%
- * Copyright (C) 2014 - 2020 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
-
public class EmpiTransactionContext {
/**
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java
similarity index 98%
rename from hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java
rename to hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java
index b7ea82fe6a6..3ebe06b7656 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java
+++ b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java
@@ -1,4 +1,4 @@
-package ca.uhn.fhir.rest.server;
+package ca.uhn.fhir.empi.model;
/*-
* #%L
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
index 89c6d1281e8..98c735c69ac 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
+++ b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
@@ -24,8 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.empi.api.EmpiLinkJson;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
+import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.rest.api.server.RequestDetails;
-import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.util.ParametersUtil;
From b11f97d9ef2cb559bb0f9ec39d0c60322ae9569a Mon Sep 17 00:00:00 2001
From: Tadgh
Date: Wed, 2 Dec 2020 16:41:37 -0500
Subject: [PATCH 5/9] HOTFIX for invalid changelog type (#2212)
---
.../5_3_0/2208-add-partition-selector-to-id-param.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
index ab06b8460bd..7dbb3fb9bd6 100644
--- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2208-add-partition-selector-to-id-param.yaml
@@ -1,5 +1,5 @@
---
-type: bug
+type: fix
issue: 2208
title: "When performing a JPA server search on a partitioned server, searches with only the `_id` parameter and no other
parameters did not include the partition selector in the generated SQL, resulting in leakage across partitions. Thanks to
From 01ca7f3746f1bb999ad59e416e028ae5c6c25cb8 Mon Sep 17 00:00:00 2001
From: Bill Denton
Date: Wed, 2 Dec 2020 17:22:31 -0800
Subject: [PATCH 6/9] move TransactionLogMessage to hapi-fhir-rest-server
bundle (as per feedback)
---
.../src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java | 4 ++--
.../java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java | 2 +-
.../main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java | 2 +-
.../test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java | 2 +-
.../fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java | 2 +-
.../ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java | 2 +-
.../java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java | 2 ++
.../main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java | 2 +-
.../java/ca/uhn/fhir/rest/server}/TransactionLogMessages.java | 2 +-
9 files changed, 11 insertions(+), 9 deletions(-)
rename {hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model => hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server}/TransactionLogMessages.java (98%)
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
index f9f147b0a9a..d24e8cd0d70 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
@@ -1710,14 +1710,14 @@ public enum Pointcut {
* Hooks may accept the following parameters:
*
* - ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage - This parameter should not be modified as processing is complete when this hook is invoked.
- * - ca.uhn.fhir.empi.model.TransactionLogMessages - This parameter is for informational messages provided by the EMPI module during EMPI procesing. .
+ * - ca.uhn.fhir.rest.server.TransactionLogMessages - This parameter is for informational messages provided by the EMPI module during EMPI procesing. .
*
*
*
* Hooks should return void
.
*
*/
- EMPI_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage", "ca.uhn.fhir.empi.model.TransactionLogMessages"),
+ EMPI_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage", "ca.uhn.fhir.rest.server.TransactionLogMessages"),
/**
* Performance Tracing Hook:
diff --git a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
index 771924692af..d1bc6211d9c 100644
--- a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
+++ b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/broker/EmpiMessageHandler.java
@@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.empi.broker;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.empi.log.Logs;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.util.EmpiUtil;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
@@ -32,6 +31,7 @@ import ca.uhn.fhir.jpa.empi.svc.EmpiMatchLinkSvc;
import ca.uhn.fhir.jpa.empi.svc.EmpiResourceFilteringSvc;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage;
import org.hl7.fhir.instance.model.api.IAnyResource;
diff --git a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
index 5dc521d8145..35e8f228c83 100644
--- a/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
+++ b/hapi-fhir-jpaserver-empi/src/main/java/ca/uhn/fhir/jpa/empi/svc/EmpiMatchLinkSvc.java
@@ -25,12 +25,12 @@ import ca.uhn.fhir.empi.api.EmpiMatchOutcome;
import ca.uhn.fhir.empi.api.IEmpiLinkSvc;
import ca.uhn.fhir.empi.log.Logs;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.util.EmpiUtil;
import ca.uhn.fhir.empi.util.PersonHelper;
import ca.uhn.fhir.jpa.empi.svc.candidate.CandidateList;
import ca.uhn.fhir.jpa.empi.svc.candidate.EmpiPersonFindingSvc;
import ca.uhn.fhir.jpa.empi.svc.candidate.MatchedPersonCandidate;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.slf4j.Logger;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
index 58e4bee84c1..f1faca6fef8 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/helper/EmpiHelperR4.java
@@ -1,10 +1,10 @@
package ca.uhn.fhir.jpa.empi.helper;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
index 60726f25887..e3575c743a7 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/interceptor/EmpiStorageInterceptorIT.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.empi.interceptor;
import ca.uhn.fhir.empi.model.CanonicalEID;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
@@ -12,6 +11,7 @@ import ca.uhn.fhir.jpa.entity.EmpiLink;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
diff --git a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
index 76c23ab4c27..c7cd05b2c9f 100644
--- a/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
+++ b/hapi-fhir-jpaserver-empi/src/test/java/ca/uhn/fhir/jpa/empi/svc/EmpiPersonMergerSvcTest.java
@@ -5,12 +5,12 @@ import ca.uhn.fhir.empi.api.EmpiMatchOutcome;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.empi.api.IEmpiPersonMergerSvc;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.empi.BaseEmpiR4Test;
import ca.uhn.fhir.jpa.empi.helper.EmpiLinkHelper;
import ca.uhn.fhir.jpa.empi.interceptor.IEmpiStorageInterceptor;
import ca.uhn.fhir.jpa.entity.EmpiLink;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import org.hl7.fhir.r4.model.Address;
import org.hl7.fhir.r4.model.DateType;
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
index f10296a226d..bae42966a7a 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
+++ b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/EmpiTransactionContext.java
@@ -1,5 +1,7 @@
package ca.uhn.fhir.empi.model;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
+
public class EmpiTransactionContext {
/**
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
index 98c735c69ac..89c6d1281e8 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
+++ b/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/provider/BaseEmpiProvider.java
@@ -24,8 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.empi.api.EmpiLinkJson;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.empi.model.EmpiTransactionContext;
-import ca.uhn.fhir.empi.model.TransactionLogMessages;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.server.TransactionLogMessages;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.util.ParametersUtil;
diff --git a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java
similarity index 98%
rename from hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java
rename to hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java
index 3ebe06b7656..b7ea82fe6a6 100644
--- a/hapi-fhir-server-empi/src/main/java/ca/uhn/fhir/empi/model/TransactionLogMessages.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/TransactionLogMessages.java
@@ -1,4 +1,4 @@
-package ca.uhn.fhir.empi.model;
+package ca.uhn.fhir.rest.server;
/*-
* #%L
From 7627a8617624743a6e21f681ec372f1e357ce3be Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Wed, 2 Dec 2020 21:19:04 -0500
Subject: [PATCH 7/9] Improve version logging (#2213)
* Improve version logging
* Add changelog
* Test fixes
---
.../java/ca/uhn/fhir/util/VersionUtil.java | 20 +++++++++++++++++--
.../5_3_0/2213-improve-version-logging.yaml | 6 ++++++
.../uhn/fhir/rest/server/RestfulServer.java | 6 +++++-
.../MetadataConformanceDstu2_1Test.java | 5 +++--
.../MetadataCapabilityStatementDstu3Test.java | 4 ++--
.../server/MetadataConformanceDstu3Test.java | 6 ++++--
6 files changed, 38 insertions(+), 9 deletions(-)
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2213-improve-version-logging.yaml
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionUtil.java
index 9972023ad21..a6a8d37214d 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionUtil.java
@@ -37,11 +37,16 @@ public class VersionUtil {
private static String ourVersion;
private static String ourBuildNumber;
private static String ourBuildTime;
+ private static boolean ourSnapshot;
static {
initialize();
}
+ public static boolean isSnapshot() {
+ return ourSnapshot;
+ }
+
public static String getBuildNumber() {
return ourBuildNumber;
}
@@ -65,11 +70,18 @@ public class VersionUtil {
ourVersion = p.getProperty("hapifhir.version");
ourVersion = defaultIfBlank(ourVersion, "(unknown)");
- ourBuildNumber = p.getProperty("hapifhir.buildnumber");
+ ourSnapshot = ourVersion.contains("SNAPSHOT");
+
+ ourBuildNumber = StringUtils.left(p.getProperty("hapifhir.buildnumber"), 10);
ourBuildTime = p.getProperty("hapifhir.timestamp");
if (System.getProperty("suppress_hapi_fhir_version_log") == null) {
- ourLog.info("HAPI FHIR version {} - Rev {}", ourVersion, StringUtils.right(ourBuildNumber, 10));
+ String buildNumber = ourBuildNumber;
+ if (isSnapshot()) {
+ buildNumber = buildNumber + "/" + getBuildDate();
+ }
+
+ ourLog.info("HAPI FHIR version {} - Rev {}", ourVersion, buildNumber);
}
} catch (Exception e) {
@@ -77,4 +89,8 @@ public class VersionUtil {
}
}
+ public static String getBuildDate() {
+ return ourBuildTime.substring(0, 10);
+ }
+
}
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2213-improve-version-logging.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2213-improve-version-logging.yaml
new file mode 100644
index 00000000000..bdafe4265ae
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2213-improve-version-logging.yaml
@@ -0,0 +1,6 @@
+---
+type: add
+issue: 2213
+title: "Non release (i.e. SNAPSHOT) builds of HAPI FHIR will now include the Git revision hash as well as the build date in the
+ version string that is logged on initialization, and included in the default server X-Powered-By string. Release builds are
+ not affected by this change."
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
index 1ca9bd36573..c7f3c398163 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
@@ -299,7 +299,11 @@ public class RestfulServer extends HttpServlet implements IRestfulServer
", output);
+ assertThat(status.getFirstHeader("X-Powered-By").getValue(), containsString("REST Server (FHIR Server; FHIR " + ourCtx.getVersion().getVersion().getFhirVersionString() + "/" + ourCtx.getVersion().getVersion().name() + ")"));
} finally {
IOUtils.closeQuietly(status.getEntity().getContent());
}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java
index 3c7923caf9b..5bc1aba18e1 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/MetadataCapabilityStatementDstu3Test.java
@@ -86,8 +86,8 @@ public class MetadataCapabilityStatementDstu3Test {
output = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
assertEquals(200, status.getStatusLine().getStatusCode());
assertThat(output, containsString("
Date: Thu, 3 Dec 2020 05:31:04 -0500
Subject: [PATCH 8/9] Fix validating capabilitystatements (#2214)
* Fix validating capabilitystatements
* Add changelog
---
...4-fix-validating-capabilitystatements.yaml | 5 +
...JpaPersistedResourceValidationSupport.java | 115 ++++++++++--------
.../ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java | 4 +
.../dao/r4/FhirResourceDaoR4ValidateTest.java | 36 ++++++
4 files changed, 108 insertions(+), 52 deletions(-)
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2214-fix-validating-capabilitystatements.yaml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2214-fix-validating-capabilitystatements.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2214-fix-validating-capabilitystatements.yaml
new file mode 100644
index 00000000000..205dac29f10
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2214-fix-validating-capabilitystatements.yaml
@@ -0,0 +1,5 @@
+---
+type: fix
+issue: 2214
+title: "When using the validator from within the JPA server, validating CapabilityStatement resources failed with
+ an error when trying to load linked SearchParameter resources. This has been corrected."
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
index 1480e8ff0bc..a89dcf228ec 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
@@ -119,71 +119,82 @@ public class JpaPersistedResourceValidationSupport implements IValidationSupport
String resourceName = myFhirContext.getResourceType(theClass);
IBundleProvider search;
- if ("ValueSet".equals(resourceName)) {
- if (localReference) {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronousUpTo(1);
- params.add(IAnyResource.SP_RES_ID, new StringParam(theUri));
- search = myDaoRegistry.getResourceDao(resourceName).search(params);
- if (search.size() == 0) {
- params = new SearchParameterMap();
+ switch (resourceName) {
+ case "ValueSet":
+ if (localReference) {
+ SearchParameterMap params = new SearchParameterMap();
params.setLoadSynchronousUpTo(1);
- params.add(ValueSet.SP_URL, new UriParam(theUri));
+ params.add(IAnyResource.SP_RES_ID, new StringParam(theUri));
+ search = myDaoRegistry.getResourceDao(resourceName).search(params);
+ if (search.size() == 0) {
+ params = new SearchParameterMap();
+ params.setLoadSynchronousUpTo(1);
+ params.add(ValueSet.SP_URL, new UriParam(theUri));
+ search = myDaoRegistry.getResourceDao(resourceName).search(params);
+ }
+ } else {
+ int versionSeparator = theUri.lastIndexOf('|');
+ SearchParameterMap params = new SearchParameterMap();
+ params.setLoadSynchronousUpTo(1);
+ if (versionSeparator != -1) {
+ params.add(ValueSet.SP_VERSION, new TokenParam(theUri.substring(versionSeparator + 1)));
+ params.add(ValueSet.SP_URL, new UriParam(theUri.substring(0, versionSeparator)));
+ } else {
+ params.add(ValueSet.SP_URL, new UriParam(theUri));
+ }
+ params.setSort(new SortSpec("_lastUpdated").setOrder(SortOrderEnum.DESC));
search = myDaoRegistry.getResourceDao(resourceName).search(params);
}
- } else {
+ break;
+ case "StructureDefinition": {
+ // Don't allow the core FHIR definitions to be overwritten
+ if (theUri.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
+ String typeName = theUri.substring("http://hl7.org/fhir/StructureDefinition/".length());
+ if (myFhirContext.getElementDefinition(typeName) != null) {
+ return myNoMatch;
+ }
+ }
+ SearchParameterMap params = new SearchParameterMap();
+ params.setLoadSynchronousUpTo(1);
+ params.add(StructureDefinition.SP_URL, new UriParam(theUri));
+ search = myDaoRegistry.getResourceDao("StructureDefinition").search(params);
+ break;
+ }
+ case "Questionnaire": {
+ SearchParameterMap params = new SearchParameterMap();
+ params.setLoadSynchronousUpTo(1);
+ if (localReference || myFhirContext.getVersion().getVersion().isEquivalentTo(FhirVersionEnum.DSTU2)) {
+ params.add(IAnyResource.SP_RES_ID, new StringParam(id.getIdPart()));
+ } else {
+ params.add(Questionnaire.SP_URL, new UriParam(id.getValue()));
+ }
+ search = myDaoRegistry.getResourceDao("Questionnaire").search(params);
+ break;
+ }
+ case "CodeSystem": {
int versionSeparator = theUri.lastIndexOf('|');
SearchParameterMap params = new SearchParameterMap();
params.setLoadSynchronousUpTo(1);
if (versionSeparator != -1) {
- params.add(ValueSet.SP_VERSION, new TokenParam(theUri.substring(versionSeparator + 1)));
- params.add(ValueSet.SP_URL, new UriParam(theUri.substring(0,versionSeparator)));
+ params.add(CodeSystem.SP_VERSION, new TokenParam(theUri.substring(versionSeparator + 1)));
+ params.add(CodeSystem.SP_URL, new UriParam(theUri.substring(0, versionSeparator)));
} else {
- params.add(ValueSet.SP_URL, new UriParam(theUri));
+ params.add(CodeSystem.SP_URL, new UriParam(theUri));
}
params.setSort(new SortSpec("_lastUpdated").setOrder(SortOrderEnum.DESC));
search = myDaoRegistry.getResourceDao(resourceName).search(params);
+ break;
}
- } else if ("StructureDefinition".equals(resourceName)) {
- // Don't allow the core FHIR definitions to be overwritten
- if (theUri.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
- String typeName = theUri.substring("http://hl7.org/fhir/StructureDefinition/".length());
- if (myFhirContext.getElementDefinition(typeName) != null) {
- return myNoMatch;
- }
+ case "ImplementationGuide":
+ case "SearchParameter": {
+ SearchParameterMap params = new SearchParameterMap();
+ params.setLoadSynchronousUpTo(1);
+ params.add(ImplementationGuide.SP_URL, new UriParam(theUri));
+ search = myDaoRegistry.getResourceDao(resourceName).search(params);
+ break;
}
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronousUpTo(1);
- params.add(StructureDefinition.SP_URL, new UriParam(theUri));
- search = myDaoRegistry.getResourceDao("StructureDefinition").search(params);
- } else if ("Questionnaire".equals(resourceName)) {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronousUpTo(1);
- if (localReference || myFhirContext.getVersion().getVersion().isEquivalentTo(FhirVersionEnum.DSTU2)) {
- params.add(IAnyResource.SP_RES_ID, new StringParam(id.getIdPart()));
- } else {
- params.add(Questionnaire.SP_URL, new UriParam(id.getValue()));
- }
- search = myDaoRegistry.getResourceDao("Questionnaire").search(params);
- } else if ("CodeSystem".equals(resourceName)) {
- int versionSeparator = theUri.lastIndexOf('|');
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronousUpTo(1);
- if (versionSeparator != -1) {
- params.add(CodeSystem.SP_VERSION, new TokenParam(theUri.substring(versionSeparator + 1)));
- params.add(CodeSystem.SP_URL, new UriParam(theUri.substring(0,versionSeparator)));
- } else {
- params.add(CodeSystem.SP_URL, new UriParam(theUri));
- }
- params.setSort(new SortSpec("_lastUpdated").setOrder(SortOrderEnum.DESC));
- search = myDaoRegistry.getResourceDao(resourceName).search(params);
- } else if ("ImplementationGuide".equals(resourceName)) {
- SearchParameterMap params = new SearchParameterMap();
- params.setLoadSynchronousUpTo(1);
- params.add(ImplementationGuide.SP_URL, new UriParam(theUri));
- search = myDaoRegistry.getResourceDao("ImplementationGuide").search(params);
- } else {
- throw new IllegalArgumentException("Can't fetch resource type: " + resourceName);
+ default:
+ throw new IllegalArgumentException("Can't fetch resource type: " + resourceName);
}
Integer size = search.size();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
index 68ba2a59431..52535fafb07 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
@@ -98,6 +98,7 @@ import org.hl7.fhir.r4.model.Appointment;
import org.hl7.fhir.r4.model.AuditEvent;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.CapabilityStatement;
import org.hl7.fhir.r4.model.CarePlan;
import org.hl7.fhir.r4.model.CareTeam;
import org.hl7.fhir.r4.model.ChargeItem;
@@ -356,6 +357,9 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil
@Qualifier("myDocumentReferenceDaoR4")
protected IFhirResourceDao myDocumentReferenceDao;
@Autowired
+ @Qualifier("myCapabilityStatementDaoR4")
+ protected IFhirResourceDao myCapabilityStatementDao;
+ @Autowired
@Qualifier("myPatientDaoR4")
protected IFhirResourceDaoPatient myPatientDao;
@Autowired
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
index c04aff9f276..06e7d516992 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
@@ -36,6 +36,7 @@ import org.hl7.fhir.r4.model.AllergyIntolerance;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CanonicalType;
+import org.hl7.fhir.r4.model.CapabilityStatement;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.Coding;
@@ -56,6 +57,7 @@ import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Questionnaire;
import org.hl7.fhir.r4.model.QuestionnaireResponse;
import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.SearchParameter;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.UriType;
@@ -1236,6 +1238,40 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
myFhirCtx.setParserErrorHandler(new StrictErrorHandler());
}
+ @Test
+ public void testValidateCapabilityStatement() {
+
+ SearchParameter sp = new SearchParameter();
+ sp.setUrl("http://example.com/name");
+ sp.setId("name");
+ sp.setCode("name");
+ sp.setType(Enumerations.SearchParamType.STRING);
+ sp.setStatus(Enumerations.PublicationStatus.ACTIVE);
+ sp.addBase("Patient");
+ sp.setExpression("Patient.name");
+ mySearchParameterDao.update(sp);
+
+ CapabilityStatement cs = new CapabilityStatement();
+ cs.getText().setStatus(Narrative.NarrativeStatus.GENERATED).getDiv().setValue("aaaa
");
+ CapabilityStatement.CapabilityStatementRestComponent rest = cs.addRest();
+ CapabilityStatement.CapabilityStatementRestResourceComponent patient = rest.addResource();
+ patient .setType("Patient");
+ patient.addSearchParam().setName("foo").setType(Enumerations.SearchParamType.DATE).setDefinition("http://example.com/name");
+
+
+ try {
+ myCapabilityStatementDao.validate(cs, null, null, null, ValidationModeEnum.CREATE, null, mySrd);
+ fail();
+ } catch (PreconditionFailedException e) {
+ String oo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome());
+ ourLog.info(oo);
+ assertThat(oo, oo, containsString("Type mismatch - SearchParameter 'http://example.com/name' type is string, but type here is date"));
+ }
+
+
+ }
+
+
@Test
public void testValidateForCreate() {
String methodName = "testValidateForCreate";
From 1eae5db374152e6fd94eb38f972e8777617a17d1 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Thu, 3 Dec 2020 08:53:37 -0500
Subject: [PATCH 9/9] autoCreatePlaceholderReferenceTargets true breaks
multitenancy (#2215)
* Fix #2209 - autoCreatePlaceholderReferenceTargets true breaks multi-tenancy
* Add changelog
* Address fixme
---
...eate-placeholders-breaks-multitenancy.yaml | 6 +
hapi-fhir-jpaserver-base/pom.xml | 8 +-
.../ca/uhn/fhir/jpa/config/BaseConfig.java | 2 +-
.../dao/index/DaoResourceLinkResolver.java | 8 +-
...rchParamWithInlineReferencesExtractor.java | 2 +-
.../java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java | 51 ++--
.../fhir/jpa/dao/r4/BaseJpaR4SystemTest.java | 14 +-
.../jpa/dao/r4/ConsentEventsDaoR4Test.java | 27 +-
.../r4/FhirResourceDaoR4InterceptorTest.java | 4 +-
.../jpa/dao/r4/PartitioningSqlR4Test.java | 283 ++++++++++--------
.../PartitioningInterceptorR4Test.java | 3 -
.../jpa/util/JpaInterceptorBroadcaster.java | 6 +-
.../uhn/fhir/rest/server/RestfulServer.java | 2 +-
13 files changed, 220 insertions(+), 196 deletions(-)
create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2215-auto-create-placeholders-breaks-multitenancy.yaml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2215-auto-create-placeholders-breaks-multitenancy.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2215-auto-create-placeholders-breaks-multitenancy.yaml
new file mode 100644
index 00000000000..4c23d05ddee
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_3_0/2215-auto-create-placeholders-breaks-multitenancy.yaml
@@ -0,0 +1,6 @@
+---
+type: fix
+issue: 2215
+title: "When using a partitioned JPA server, auto-create placeholder targets did not work if the partition interceptor was
+ registered against the server (e.g. for a multitenancy configuration). This has been corrected. Thanks to Rob Whelan for
+ reporting!"
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index c10d239efc3..dd2d3aaf337 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -609,7 +609,13 @@
org.jetbrains
annotations
-
+
+ org.mortbay.jetty
+ servlet-api
+ 2.5-20081211
+ test
+
+
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
index 257b19acdc0..27090bbbc8f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
@@ -361,7 +361,7 @@ public abstract class BaseConfig {
@Bean
public IInterceptorService jpaInterceptorService() {
- return new InterceptorService();
+ return new InterceptorService("JPA");
}
/**
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java
index 9fa15dc0384..f61de9cb546 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java
@@ -72,7 +72,7 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
ourLog.trace("Translated {}/{} to resource PID {}", theType, idPart, resolvedResource);
} catch (ResourceNotFoundException e) {
- Optional createdTableOpt = createPlaceholderTargetIfConfiguredToDoSo(theType, theReference, idPart);
+ Optional createdTableOpt = createPlaceholderTargetIfConfiguredToDoSo(theType, theReference, idPart, theRequest);
if (!createdTableOpt.isPresent()) {
if (myDaoConfig.isEnforceReferentialIntegrityOnWrite() == false) {
@@ -109,7 +109,7 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
/**
* @param theIdToAssignToPlaceholder If specified, the placeholder resource created will be given a specific ID
*/
- public Optional createPlaceholderTargetIfConfiguredToDoSo(Class theType, IBaseReference theReference, @Nullable String theIdToAssignToPlaceholder) {
+ public Optional createPlaceholderTargetIfConfiguredToDoSo(Class theType, IBaseReference theReference, @Nullable String theIdToAssignToPlaceholder, RequestDetails theRequest) {
ResourceTable valueOf = null;
if (myDaoConfig.isAutoCreatePlaceholderReferenceTargets()) {
@@ -128,9 +128,9 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
if (theIdToAssignToPlaceholder != null) {
newResource.setId(resName + "/" + theIdToAssignToPlaceholder);
- valueOf = ((ResourceTable) placeholderResourceDao.update(newResource).getEntity());
+ valueOf = ((ResourceTable) placeholderResourceDao.update(newResource, theRequest).getEntity());
} else {
- valueOf = ((ResourceTable) placeholderResourceDao.create(newResource).getEntity());
+ valueOf = ((ResourceTable) placeholderResourceDao.create(newResource, theRequest).getEntity());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
index 1b78788f013..81dae24aca6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
@@ -254,7 +254,7 @@ public class SearchParamWithInlineReferencesExtractor {
ResourcePersistentId match;
if (matches.isEmpty()) {
- Optional placeholderOpt = myDaoResourceLinkResolver.createPlaceholderTargetIfConfiguredToDoSo(matchResourceType, nextRef, null);
+ Optional placeholderOpt = myDaoResourceLinkResolver.createPlaceholderTargetIfConfiguredToDoSo(matchResourceType, nextRef, null, theRequest);
if (placeholderOpt.isPresent()) {
match = new ResourcePersistentId(placeholderOpt.get().getResourceId());
} else {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
index f51067c407c..fa95c97a45c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
@@ -38,14 +38,13 @@ import ca.uhn.fhir.test.utilities.LoggingExtension;
import ca.uhn.fhir.test.utilities.ProxyUtil;
import ca.uhn.fhir.test.utilities.UnregisterScheduledProcessor;
import ca.uhn.fhir.util.BundleUtil;
+import ca.uhn.fhir.util.FhirVersionIndependentConcept;
import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.util.TestUtil;
-import ca.uhn.fhir.util.FhirVersionIndependentConcept;
import org.apache.commons.io.IOUtils;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.jdbc.Work;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.Resource;
@@ -70,10 +69,9 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
+import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -85,6 +83,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static ca.uhn.fhir.util.TestUtil.randomizeLocale;
+import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.eq;
@@ -116,7 +115,7 @@ public abstract class BaseJpaTest extends BaseTest {
public LoggingExtension myLoggingExtension = new LoggingExtension();
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
protected ServletRequestDetails mySrd;
- protected InterceptorService myRequestOperationCallback;
+ protected InterceptorService mySrdInterceptorService;
@Autowired
protected DatabaseBackedPagingProvider myDatabaseBackedPagingProvider;
@Autowired
@@ -173,18 +172,13 @@ public abstract class BaseJpaTest extends BaseTest {
AtomicBoolean isReadOnly = new AtomicBoolean();
Session currentSession;
try {
+ assert sessionFactory != null;
currentSession = sessionFactory.getCurrentSession();
} catch (HibernateException e) {
currentSession = null;
}
if (currentSession != null) {
- currentSession.doWork(new Work() {
-
- @Override
- public void execute(Connection connection) throws SQLException {
- isReadOnly.set(connection.isReadOnly());
- }
- });
+ currentSession.doWork(connection -> isReadOnly.set(connection.isReadOnly()));
assertFalse(isReadOnly.get());
}
@@ -199,12 +193,12 @@ public abstract class BaseJpaTest extends BaseTest {
}
@BeforeEach
- public void beforeInitMocks() {
- myRequestOperationCallback = new InterceptorService();
+ public void beforeInitMocks() throws Exception {
+ mySrdInterceptorService = new InterceptorService();
MockitoAnnotations.initMocks(this);
- when(mySrd.getInterceptorBroadcaster()).thenReturn(myRequestOperationCallback);
+ when(mySrd.getInterceptorBroadcaster()).thenReturn(mySrdInterceptorService);
when(mySrd.getUserData()).thenReturn(new HashMap<>());
when(mySrd.getHeaders(eq(JpaConstants.HEADER_META_SNAPSHOT_MODE))).thenReturn(new ArrayList<>());
when(mySrd.getServer().getDefaultPageSize()).thenReturn(null);
@@ -231,7 +225,7 @@ public abstract class BaseJpaTest extends BaseTest {
public void runInTransaction(Runnable theRunnable) {
newTxTemplate().execute(new TransactionCallbackWithoutResult() {
@Override
- protected void doInTransactionWithoutResult(TransactionStatus theStatus) {
+ protected void doInTransactionWithoutResult(@Nonnull TransactionStatus theStatus) {
theRunnable.run();
}
});
@@ -250,16 +244,14 @@ public abstract class BaseJpaTest extends BaseTest {
/**
* Sleep until at least 1 ms has elapsed
*/
- public void sleepUntilTimeChanges() throws InterruptedException {
+ public void sleepUntilTimeChanges() {
StopWatch sw = new StopWatch();
- while (sw.getMillis() == 0) {
- Thread.sleep(10);
- }
+ await().until(() -> sw.getMillis() > 0);
}
protected org.hl7.fhir.dstu3.model.Bundle toBundle(IBundleProvider theSearch) {
org.hl7.fhir.dstu3.model.Bundle bundle = new org.hl7.fhir.dstu3.model.Bundle();
- for (IBaseResource next : theSearch.getResources(0, theSearch.size())) {
+ for (IBaseResource next : theSearch.getResources(0, theSearch.sizeOrThrowNpe())) {
bundle.addEntry().setResource((Resource) next);
}
return bundle;
@@ -267,7 +259,7 @@ public abstract class BaseJpaTest extends BaseTest {
protected org.hl7.fhir.r4.model.Bundle toBundleR4(IBundleProvider theSearch) {
org.hl7.fhir.r4.model.Bundle bundle = new org.hl7.fhir.r4.model.Bundle();
- for (IBaseResource next : theSearch.getResources(0, theSearch.size())) {
+ for (IBaseResource next : theSearch.getResources(0, theSearch.sizeOrThrowNpe())) {
bundle.addEntry().setResource((org.hl7.fhir.r4.model.Resource) next);
}
return bundle;
@@ -275,11 +267,11 @@ public abstract class BaseJpaTest extends BaseTest {
@SuppressWarnings({"rawtypes"})
protected List toList(IBundleProvider theSearch) {
- return theSearch.getResources(0, theSearch.size());
+ return theSearch.getResources(0, theSearch.sizeOrThrowNpe());
}
protected List toUnqualifiedIdValues(IBaseBundle theFound) {
- List retVal = new ArrayList();
+ List retVal = new ArrayList<>();
List res = BundleUtil.toListOfResources(getContext(), theFound);
int size = res.size();
@@ -291,8 +283,8 @@ public abstract class BaseJpaTest extends BaseTest {
}
protected List toUnqualifiedIdValues(IBundleProvider theFound) {
- List retVal = new ArrayList();
- int size = theFound.size();
+ List retVal = new ArrayList<>();
+ int size = theFound.sizeOrThrowNpe();
ourLog.info("Found {} results", size);
List resources = theFound.getResources(0, size);
for (IBaseResource next : resources) {
@@ -302,7 +294,7 @@ public abstract class BaseJpaTest extends BaseTest {
}
protected List toUnqualifiedVersionlessIdValues(IBaseBundle theFound) {
- List retVal = new ArrayList();
+ List retVal = new ArrayList<>();
List res = BundleUtil.toListOfResources(getContext(), theFound);
int size = res.size();
@@ -429,6 +421,7 @@ public abstract class BaseJpaTest extends BaseTest {
return retVal.toArray(new String[0]);
}
+ @SuppressWarnings("BusyWait")
protected void waitForActivatedSubscriptionCount(int theSize) throws Exception {
for (int i = 0; ; i++) {
if (i == 10) {
@@ -473,6 +466,7 @@ public abstract class BaseJpaTest extends BaseTest {
return IOUtils.toByteArray(bundleRes);
}
+ @SuppressWarnings("BusyWait")
protected static void purgeDatabase(DaoConfig theDaoConfig, IFhirSystemDao, ?> theSystemDao, IResourceReindexingSvc theResourceReindexingSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry, IBulkDataExportSvc theBulkDataExportSvc) {
theSearchCoordinatorSvc.cancelAllActiveSearches();
theResourceReindexingSvc.cancelAndPurgeAllJobs();
@@ -519,6 +513,7 @@ public abstract class BaseJpaTest extends BaseTest {
return retVal;
}
+ @SuppressWarnings("BusyWait")
public static void waitForSize(int theTarget, List> theList) {
StopWatch sw = new StopWatch();
while (theList.size() != theTarget && sw.getMillis() <= 16000) {
@@ -549,6 +544,7 @@ public abstract class BaseJpaTest extends BaseTest {
waitForSize(theTarget, 10000, theCallable);
}
+ @SuppressWarnings("BusyWait")
public static void waitForSize(int theTarget, int theTimeout, Callable theCallable) throws Exception {
StopWatch sw = new StopWatch();
while (theCallable.call().intValue() != theTarget && sw.getMillis() < theTimeout) {
@@ -568,6 +564,7 @@ public abstract class BaseJpaTest extends BaseTest {
waitForSize(theTarget, 10000, theCallable, theFailureMessage);
}
+ @SuppressWarnings("BusyWait")
public static void waitForSize(int theTarget, int theTimeout, Callable theCallable, Callable theFailureMessage) throws Exception {
StopWatch sw = new StopWatch();
while (theCallable.call().intValue() != theTarget && sw.getMillis() < theTimeout) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4SystemTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4SystemTest.java
index 4bb1c93d12e..71f506b53c8 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4SystemTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4SystemTest.java
@@ -1,15 +1,10 @@
package ca.uhn.fhir.jpa.dao.r4;
-import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.jpa.rp.r4.PatientResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
-import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
-import ca.uhn.fhir.util.TestUtil;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
@@ -17,17 +12,16 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public abstract class BaseJpaR4SystemTest extends BaseJpaR4Test {
- protected ServletRequestDetails mySrd;
private RestfulServer myServer;
+ @Override
@SuppressWarnings("unchecked")
@BeforeEach
- public void before() throws ServletException {
- mySrd = mock(ServletRequestDetails.class);
- when(mySrd.getInterceptorBroadcaster()).thenReturn(mock(IInterceptorBroadcaster.class));
+ public void beforeInitMocks() throws Exception {
+ super.beforeInitMocks();
if (myServer == null) {
- myServer = new RestfulServer(myFhirCtx);
+ myServer = new RestfulServer(myFhirCtx, mySrdInterceptorService);
PatientResourceProvider patientRp = new PatientResourceProvider();
patientRp.setDao(myPatientDao);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java
index 360366ae17a..0db292467f8 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java
@@ -3,7 +3,6 @@ package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
import ca.uhn.fhir.interceptor.api.Pointcut;
-import ca.uhn.fhir.interceptor.executor.InterceptorService;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.config.TestR4Config;
import ca.uhn.fhir.jpa.entity.Search;
@@ -52,7 +51,6 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
private static final Logger ourLog = LoggerFactory.getLogger(ConsentEventsDaoR4Test.class);
private List myObservationIds;
private List myPatientIds;
- private InterceptorService myInterceptorService;
private List myObservationIdsOddOnly;
private List myObservationIdsEvenOnly;
private List myObservationIdsWithVersions;
@@ -64,16 +62,11 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields());
}
- @Override
@BeforeEach
public void before() throws ServletException {
- super.before();
-
RestfulServer restfulServer = new RestfulServer();
restfulServer.setPagingProvider(myPagingProvider);
- myInterceptorService = new InterceptorService();
- when(mySrd.getInterceptorBroadcaster()).thenReturn(myInterceptorService);
when(mySrd.getServer()).thenReturn(restfulServer);
myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190));
@@ -86,7 +79,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCounting(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -118,7 +111,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -158,7 +151,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -191,7 +184,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -216,7 +209,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -244,7 +237,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -269,7 +262,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCounting(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -292,7 +285,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a search
SearchParameterMap map = new SearchParameterMap();
@@ -316,7 +309,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
// Perform a history
SearchParameterMap map = new SearchParameterMap();
@@ -346,7 +339,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest {
AtomicInteger hitCount = new AtomicInteger(0);
List interceptedResourceIds = new ArrayList<>();
IAnonymousInterceptor interceptor = new PreAccessInterceptorCountingAndBlockOdd(hitCount, interceptedResourceIds);
- myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
+ mySrdInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
myObservationDao.read(new IdType(myObservationIdsEvenOnly.get(0)), mySrd);
myObservationDao.read(new IdType(myObservationIdsEvenOnly.get(1)), mySrd);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
index 31f68443559..caf3cae8c0d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java
@@ -7,7 +7,6 @@ import ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.interceptor.IServerOperationInterceptor;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
-import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;
@@ -16,7 +15,6 @@ import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -508,7 +506,7 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test {
((Patient) theResource).setActive(true);
}
};
- myRequestOperationCallback.registerInterceptor(interceptor);
+ mySrdInterceptorService.registerInterceptor(interceptor);
Patient p = new Patient();
p.setActive(false);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
index 8045dc5206c..80022b4d7a3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java
@@ -116,7 +116,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myPartitionSettings.setPartitioningEnabled(new PartitionSettings().isPartitioningEnabled());
myPartitionSettings.setAllowReferencesAcrossPartitions(new PartitionSettings().getAllowReferencesAcrossPartitions());
- myInterceptorRegistry.unregisterInterceptorsIf(t -> t instanceof MyReadWriteInterceptor);
+ mySrdInterceptorService.unregisterInterceptorsIf(t -> t instanceof MyReadWriteInterceptor);
myInterceptor = null;
if (myHaveDroppedForcedIdUniqueConstraint) {
@@ -127,13 +127,11 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
}
myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields());
+ myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets());
}
- @Override
@BeforeEach
public void before() throws ServletException {
- super.before();
-
myPartitionSettings.setPartitioningEnabled(true);
myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes());
@@ -147,7 +145,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myPartitionId2 = 2;
myPartitionInterceptor = new MyReadWriteInterceptor();
- myInterceptorRegistry.registerInterceptor(myPartitionInterceptor);
+ mySrdInterceptorService.registerInterceptor(myPartitionInterceptor);
myPartitionConfigSvc.createPartition(new PartitionEntity().setId(1).setName(PARTITION_1));
myPartitionConfigSvc.createPartition(new PartitionEntity().setId(2).setName(PARTITION_2));
@@ -158,7 +156,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Ensure the partition names are resolved
myPartitionInterceptor.addReadPartition(RequestPartitionId.fromPartitionNames(JpaConstants.DEFAULT_PARTITION_NAME, PARTITION_1, PARTITION_2, PARTITION_3, PARTITION_4));
- myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true));
+ myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true), mySrd);
}
@@ -188,7 +186,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addCreatePartition(myPartitionId, myPartitionDate);
Patient patient = new Patient();
patient.setActive(true);
- IIdType patientId = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition 2
addCreatePartition(myPartitionId2, myPartitionDate2);
@@ -196,7 +194,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
obs.getSubject().setReference(patientId.getValue());
myCaptureQueriesListener.clear();
- IIdType obsId = myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ IIdType obsId = myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
List selectQueries = myCaptureQueriesListener.getSelectQueriesForCurrentThread();
assertEquals(2, selectQueries.size());
@@ -222,7 +220,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addCreatePartition(myPartitionId, myPartitionDate);
Patient patient = new Patient();
patient.setActive(true);
- IIdType patientId = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition 2
addCreatePartition(myPartitionId2, myPartitionDate2);
@@ -230,7 +228,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
obs.getSubject().setReference(patientId.getValue());
try {
- myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), startsWith("Resource Patient/" + patientId.getIdPart() + " not found, specified in path: Observation.subject"));
@@ -248,13 +246,13 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Patient patient = new Patient();
patient.setId("ONE");
patient.setActive(true);
- IIdType patientId = myPatientDao.update(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.update(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition 2
addCreatePartition(myPartitionId2, myPartitionDate2);
Observation obs = new Observation();
obs.getSubject().setReference(patientId.getValue());
- IIdType obsId = myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ IIdType obsId = myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
runInTransaction(() -> {
List resLinks = myResourceLinkDao.findAll();
@@ -274,7 +272,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Patient patient = new Patient();
patient.setId("ONE");
patient.setActive(true);
- IIdType patientId = myPatientDao.update(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.update(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition 2
addCreatePartition(myPartitionId2, myPartitionDate2);
@@ -282,7 +280,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
obs.getSubject().setReference(patientId.getValue());
try {
- myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), startsWith("Resource Patient/ONE not found, specified in path: Observation.subject"));
@@ -296,13 +294,13 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addCreateDefaultPartition(myPartitionDate);
Patient patient = new Patient();
patient.setActive(true);
- IIdType patientId = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition NULL
addCreateDefaultPartition(myPartitionDate);
Observation obs = new Observation();
obs.getSubject().setReference(patientId.getValue());
- IIdType obsId = myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ IIdType obsId = myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
runInTransaction(() -> {
List resLinks = myResourceLinkDao.findAll();
@@ -321,13 +319,13 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Patient patient = new Patient();
patient.setId("ONE");
patient.setActive(true);
- IIdType patientId = myPatientDao.update(patient).getId().toUnqualifiedVersionless();
+ IIdType patientId = myPatientDao.update(patient, mySrd).getId().toUnqualifiedVersionless();
// Create observation in partition NULL
addCreateDefaultPartition(myPartitionDate);
Observation obs = new Observation();
obs.getSubject().setReference(patientId.getValue());
- IIdType obsId = myObservationDao.create(obs).getId().toUnqualifiedVersionless();
+ IIdType obsId = myObservationDao.create(obs, mySrd).getId().toUnqualifiedVersionless();
runInTransaction(() -> {
List resLinks = myResourceLinkDao.findAll();
@@ -381,15 +379,33 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
}
}
+ @Test
+ public void testCreate_AutoCreatePlaceholderTargets() {
+ myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true);
+
+ addCreatePartition(1, null);
+ addCreatePartition(1, null);
+ addReadPartition(1);
+ IIdType patientId1 = createPatient(withOrganization(new IdType("Organization/FOO")));
+
+ addReadPartition(1);
+ IdType gotId1 = myPatientDao.read(patientId1, mySrd).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId1, gotId1);
+
+ addReadPartition(1);
+ IdType gotIdOrg = myOrganizationDao.read(new IdType("Organization/FOO"), mySrd).getIdElement().toUnqualifiedVersionless();
+ assertEquals("Organization/FOO", gotIdOrg.toUnqualifiedVersionless().getValue());
+ }
+
@Test
public void testCreate_UnknownPartition() {
addCreatePartition(99, null);
- Patient p = new Patient();
- p.addIdentifier().setSystem("system").setValue("value");
- p.setBirthDate(new Date());
+ Patient patient = new Patient();
+ patient.addIdentifier().setSystem("system").setValue("value");
+ patient.setBirthDate(new Date());
try {
- myPatientDao.create(p);
+ myPatientDao.create(patient, mySrd);
fail();
} catch (ResourceNotFoundException e) {
assertEquals("No partition exists with ID 99", e.getMessage());
@@ -401,10 +417,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
public void testCreate_ServerId_NoPartition() {
addCreateDefaultPartition();
- Patient p = new Patient();
- p.addIdentifier().setSystem("system").setValue("value");
- p.setBirthDate(new Date());
- Long patientId = myPatientDao.create(p).getId().getIdPartAsLong();
+ Patient patient = new Patient();
+ patient.addIdentifier().setSystem("system").setValue("value");
+ patient.setBirthDate(new Date());
+ Long patientId = myPatientDao.create(patient, mySrd).getId().getIdPartAsLong();
runInTransaction(() -> {
ResourceTable resourceTable = myResourceTableDao.findById(patientId).orElseThrow(IllegalArgumentException::new);
@@ -421,7 +437,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addCreatePartition(myPartitionId, myPartitionDate);
Organization org = new Organization();
org.setName("org");
- IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
+ IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
addCreatePartition(myPartitionId, myPartitionDate);
Patient p = new Patient();
@@ -505,7 +521,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addCreateDefaultPartition(myPartitionDate);
Organization org = new Organization();
org.setName("org");
- IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
+ IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless();
addCreateDefaultPartition(myPartitionDate);
Patient p = new Patient();
@@ -589,7 +605,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Organization org = new Organization();
org.setId("org");
org.setName("org");
- IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
+ IIdType orgId = myOrganizationDao.update(org, mySrd).getId().toUnqualifiedVersionless();
addReadPartition(myPartitionId);
addCreatePartition(myPartitionId, myPartitionDate);
@@ -617,7 +633,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Organization org = new Organization();
org.setId("org");
org.setName("org");
- IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
+ IIdType orgId = myOrganizationDao.update(org, mySrd).getId().toUnqualifiedVersionless();
addReadDefaultPartition();
addCreateDefaultPartition();
@@ -643,7 +659,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Organization org = new Organization();
org.setId("org");
org.setName("org");
- IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
+ IIdType orgId = myOrganizationDao.update(org, mySrd).getId().toUnqualifiedVersionless();
addReadDefaultPartition();
addCreateDefaultPartition(myPartitionDate);
@@ -713,10 +729,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Create a resource
addCreatePartition(myPartitionId, myPartitionDate);
- Patient p = new Patient();
- p.getMeta().addTag("http://system", "code", "diisplay");
- p.setActive(true);
- Long patientId = myPatientDao.create(p).getId().getIdPartAsLong();
+ Patient patient = new Patient();
+ patient.getMeta().addTag("http://system", "code", "diisplay");
+ patient.setActive(true);
+ Long patientId = myPatientDao.create(patient, mySrd).getId().getIdPartAsLong();
runInTransaction(() -> {
// HFJ_RESOURCE
ResourceTable resourceTable = myResourceTableDao.findById(patientId).orElseThrow(IllegalArgumentException::new);
@@ -726,10 +742,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Update that resource
addReadPartition(myPartitionId);
- p = new Patient();
- p.setId("Patient/" + patientId);
- p.setActive(false);
- myPatientDao.update(p, mySrd);
+ patient = new Patient();
+ patient.setId("Patient/" + patientId);
+ patient.setActive(false);
+ myPatientDao.update(patient, mySrd);
runInTransaction(() -> {
// HFJ_RESOURCE
@@ -1067,6 +1083,21 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
} catch (ResourceNotFoundException e) {
assertThat(e.getMessage(), matchesPattern("Resource Patient/TWO is not known"));
}
+
+ // Read in wrong Partition
+ addReadPartition(2);
+ try {
+ myPatientDao.read(patientId1, mySrd).getIdElement().toUnqualifiedVersionless();
+ fail();
+ } catch (ResourceNotFoundException e) {
+ assertThat(e.getMessage(), matchesPattern("Resource Patient/ONE is not known"));
+ }
+
+ // Read in correct Partition
+ addReadPartition(2);
+ IdType gotId2 = myPatientDao.read(patientId2, mySrd).getIdElement().toUnqualifiedVersionless();
+ assertEquals(patientId2, gotId2);
+
}
@Test
@@ -1152,7 +1183,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(1, searchOutcome.size());
IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
assertEquals(patientId1, gotId1);
@@ -1170,7 +1201,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1179,7 +1210,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1204,7 +1235,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(1, searchOutcome.size());
IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
assertEquals(patientId1, gotId1);
@@ -1224,7 +1255,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1235,7 +1266,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1261,7 +1292,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(1, searchOutcome.size());
IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
assertEquals(patientId1, gotId1);
@@ -1279,7 +1310,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1288,7 +1319,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1);
SearchParameterMap map = SearchParameterMap.newSynchronous(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1316,7 +1347,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientId1.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(1, searchOutcome.size());
IIdType gotId1 = searchOutcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless();
assertEquals(patientId1, gotId1);
@@ -1341,7 +1372,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientIdNull.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1352,7 +1383,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = SearchParameterMap.newSynchronous()
.add(Patient.SP_ACTIVE, new TokenParam("true"))
.add(Patient.SP_RES_ID, new TokenParam(patientId2.toUnqualifiedVersionless().getValue()));
- IBundleProvider searchOutcome = myPatientDao.search(map);
+ IBundleProvider searchOutcome = myPatientDao.search(map, mySrd);
assertEquals(0, searchOutcome.size());
}
@@ -1376,7 +1407,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_ACTIVE, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1393,7 +1424,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam().setMissing(false));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1418,7 +1449,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_ACTIVE, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1435,7 +1466,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam().setMissing(false));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1459,7 +1490,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_ACTIVE, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1476,7 +1507,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam().setMissing(false));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1502,7 +1533,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_GENERAL_PRACTITIONER, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1529,7 +1560,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_GENERAL_PRACTITIONER, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1557,7 +1588,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_GENERAL_PRACTITIONER, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1583,7 +1614,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_GENERAL_PRACTITIONER, new StringParam().setMissing(true));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdDefault));
@@ -1608,7 +1639,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myCaptureQueriesListener.clear();
SearchParameterMap map = new SearchParameterMap();
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1628,7 +1659,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myCaptureQueriesListener.clear();
SearchParameterMap map = new SearchParameterMap();
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1649,7 +1680,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myCaptureQueriesListener.clear();
SearchParameterMap map = new SearchParameterMap();
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, Matchers.contains(patientId1, patientId2));
@@ -1670,7 +1701,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
myCaptureQueriesListener.clear();
SearchParameterMap map = new SearchParameterMap();
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids.toString(), ids, Matchers.containsInAnyOrder(patientIdNull, patientId2));
@@ -1698,7 +1729,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-04-20"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1714,7 +1745,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateOrListParam().addOr(new DateParam("2020-04-20")).addOr(new DateParam("2020-04-22")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1730,7 +1761,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateAndListParam().addAnd(new DateOrListParam().addOr(new DateParam("2020"))).addAnd(new DateOrListParam().addOr(new DateParam("2020-04-20"))));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1746,7 +1777,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateRangeParam(new DateParam("2020-01-01"), new DateParam("2020-04-25")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1778,7 +1809,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-04-20"));
map.setLoadSynchronous(true);
myCaptureQueriesListener.clear();
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1795,7 +1826,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateOrListParam().addOr(new DateParam("2020-04-20")).addOr(new DateParam("2020-04-22")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1811,7 +1842,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateAndListParam().addAnd(new DateOrListParam().addOr(new DateParam("2020"))).addAnd(new DateOrListParam().addOr(new DateParam("2020-04-20"))));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1827,7 +1858,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateRangeParam(new DateParam("2020-01-01"), new DateParam("2020-04-25")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -1857,7 +1888,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-04-20"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1873,7 +1904,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateOrListParam().addOr(new DateParam("2020-04-20")).addOr(new DateParam("2020-04-22")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1889,7 +1920,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateAndListParam().addAnd(new DateOrListParam().addOr(new DateParam("2020"))).addAnd(new DateOrListParam().addOr(new DateParam("2020-04-20"))));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1905,7 +1936,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateRangeParam(new DateParam("2020-01-01"), new DateParam("2020-04-25")));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -1923,14 +1954,14 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Organization org = new Organization();
org.setId("ORG");
org.setName("ORG");
- myOrganizationDao.update(org);
+ myOrganizationDao.update(org, mySrd);
addReadPartition(1);
addCreatePartition(1, null);
Practitioner practitioner = new Practitioner();
practitioner.setId("PRACT");
practitioner.addName().setFamily("PRACT");
- myPractitionerDao.update(practitioner);
+ myPractitionerDao.update(practitioner, mySrd);
addReadPartition(1);
addCreatePartition(1, null);
@@ -1938,7 +1969,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
role.setId("ROLE");
role.getPractitioner().setReference("Practitioner/PRACT");
role.getOrganization().setReference("Organization/ORG");
- myPractitionerRoleDao.update(role);
+ myPractitionerRoleDao.update(role, mySrd);
addReadPartition(1);
SearchParameterMap params = SearchParameterMap.newSynchronous();
@@ -1946,7 +1977,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
value.addAnd(new HasOrListParam().addOr(new HasParam("PractitionerRole", "practitioner", "_id", "ROLE")));
params.add("_has", value);
myCaptureQueriesListener.clear();
- IBundleProvider outcome = myPractitionerDao.search(params);
+ IBundleProvider outcome = myPractitionerDao.search(params, mySrd);
myCaptureQueriesListener.logSelectQueriesForCurrentThread(1);
assertEquals(1, outcome.getResources(0, 1).size());
@@ -1970,7 +2001,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -1992,7 +2023,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -2016,7 +2047,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(patientId1));
@@ -2049,7 +2080,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1, 2);
myCaptureQueriesListener.clear();
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids.toString(), ids, Matchers.containsInAnyOrder(patientId1, patientId2));
@@ -2064,7 +2095,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1, null);
myCaptureQueriesListener.clear();
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids.toString(), ids, Matchers.containsInAnyOrder(patientId1, patientIdNull));
@@ -2087,7 +2118,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadPartition(1, 2);
try {
- myPatientDao.search(map);
+ myPatientDao.search(map, mySrd);
fail();
} catch (InternalErrorException e) {
assertEquals("Can not search multiple partitions when partitions are included in search hashes", e.getMessage());
@@ -2105,7 +2136,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
try {
- IBundleProvider value = myPatientDao.search(map);
+ IBundleProvider value = myPatientDao.search(map, mySrd);
value.size();
fail();
} catch (PreconditionFailedException e) {
@@ -2127,7 +2158,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull));
@@ -2153,7 +2184,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_FAMILY, new StringParam("FAMILY"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(patientId1));
@@ -2178,7 +2209,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -2195,7 +2226,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.add(Patient.SP_IDENTIFIER, new TokenParam("http://foo", "bar"));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1));
@@ -2220,7 +2251,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true);
@@ -2247,7 +2278,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -2269,7 +2300,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -2292,7 +2323,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code"));
map.setLoadSynchronous(true);
myCaptureQueriesListener.clear();
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread(0);
assertThat(ids, contains(patientId1));
@@ -2320,7 +2351,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientIdNull, patientId1, patientId2));
@@ -2345,7 +2376,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Constants.PARAM_TAG, new TokenParam("http://system", "code2").setModifier(TokenParamModifier.NOT));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(patientId1));
@@ -2367,7 +2398,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-01-01"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(id));
@@ -2390,7 +2421,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-01-01"));
map.setLoadSynchronous(true);
- IBundleProvider results = myPatientDao.search(map);
+ IBundleProvider results = myPatientDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(id));
@@ -2406,7 +2437,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Patient.SP_BIRTHDATE, new DateParam("2020-01-01"));
map.setLoadSynchronous(true);
- results = myPatientDao.search(map);
+ results = myPatientDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, Matchers.empty());
@@ -2425,7 +2456,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- IBundleProvider results = myObservationDao.search(map);
+ IBundleProvider results = myObservationDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(observationId));
@@ -2443,7 +2474,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- results = myObservationDao.search(map);
+ results = myObservationDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, Matchers.empty());
@@ -2463,7 +2494,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- IBundleProvider results = myObservationDao.search(map);
+ IBundleProvider results = myObservationDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
assertThat(ids, contains(observationId));
@@ -2480,7 +2511,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- results = myObservationDao.search(map);
+ results = myObservationDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, Matchers.empty());
@@ -2499,7 +2530,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- IBundleProvider results = myObservationDao.search(map);
+ IBundleProvider results = myObservationDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, contains(observationId));
@@ -2516,7 +2547,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- results = myObservationDao.search(map);
+ results = myObservationDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, Matchers.empty());
@@ -2536,7 +2567,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
SearchParameterMap map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- IBundleProvider results = myObservationDao.search(map);
+ IBundleProvider results = myObservationDao.search(map, mySrd);
List ids = toUnqualifiedVersionlessIds(results);
String searchSql = myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true);
@@ -2552,7 +2583,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
map = new SearchParameterMap();
map.add(Observation.SP_SUBJECT, new ReferenceParam(patientId));
map.setLoadSynchronous(true);
- results = myObservationDao.search(map);
+ results = myObservationDao.search(map, mySrd);
ids = toUnqualifiedVersionlessIds(results);
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
assertThat(ids, Matchers.empty());
@@ -2565,10 +2596,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
addReadAllPartitions();
- Patient p = new Patient();
- p.setId(patientId.toUnqualifiedVersionless());
- p.setGender(Enumerations.AdministrativeGender.MALE);
- myPatientDao.update(p);
+ Patient patient = new Patient();
+ patient.setId(patientId.toUnqualifiedVersionless());
+ patient.setGender(Enumerations.AdministrativeGender.MALE);
+ myPatientDao.update(patient, mySrd);
}
@Test
@@ -2577,10 +2608,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Update the patient
addReadPartition(myPartitionId);
- Patient p = new Patient();
- p.setActive(false);
- p.setId(id);
- myPatientDao.update(p);
+ Patient patient = new Patient();
+ patient.setActive(false);
+ patient.setId(id);
+ myPatientDao.update(patient, mySrd);
addReadPartition(1);
myCaptureQueriesListener.clear();
@@ -2623,7 +2654,7 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
Patient p = new Patient();
p.setActive(false);
p.setId(id);
- myPatientDao.update(p);
+ myPatientDao.update(p, mySrd);
addReadPartition(2);
try {
@@ -2640,10 +2671,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Update the patient
addReadDefaultPartition();
- Patient p = new Patient();
- p.setActive(false);
- p.setId(id);
- myPatientDao.update(p);
+ Patient patient = new Patient();
+ patient.setActive(false);
+ patient.setId(id);
+ myPatientDao.update(patient, mySrd);
addReadDefaultPartition();
myCaptureQueriesListener.clear();
@@ -2681,10 +2712,10 @@ public class PartitioningSqlR4Test extends BaseJpaR4SystemTest {
// Update the patient
addReadPartition(myPartitionId);
- Patient p = new Patient();
- p.setActive(false);
- p.setId(id);
- myPatientDao.update(p);
+ Patient patient = new Patient();
+ patient.setActive(false);
+ patient.setId(id);
+ myPatientDao.update(patient, mySrd);
addReadAllPartitions();
myCaptureQueriesListener.clear();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java
index a30da7104a2..156f2528082 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java
@@ -67,11 +67,8 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest {
myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields());
}
- @Override
@BeforeEach
public void before() throws ServletException {
- super.before();
-
myPartitionSettings.setPartitioningEnabled(true);
myPartitionInterceptor = new MyWriteInterceptor();
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/util/JpaInterceptorBroadcaster.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/util/JpaInterceptorBroadcaster.java
index 9a071c6fb5e..b800874b224 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/util/JpaInterceptorBroadcaster.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/util/JpaInterceptorBroadcaster.java
@@ -39,7 +39,8 @@ public class JpaInterceptorBroadcaster {
retVal = theInterceptorBroadcaster.callHooks(thePointcut, theParams);
}
if (theRequestDetails != null && retVal) {
- theRequestDetails.getInterceptorBroadcaster().callHooks(thePointcut, theParams);
+ IInterceptorBroadcaster interceptorBroadcaster = theRequestDetails.getInterceptorBroadcaster();
+ interceptorBroadcaster.callHooks(thePointcut, theParams);
}
return retVal;
}
@@ -54,7 +55,8 @@ public class JpaInterceptorBroadcaster {
retVal = theInterceptorBroadcaster.callHooksAndReturnObject(thePointcut, theParams);
}
if (theRequestDetails != null && retVal == null) {
- retVal = theRequestDetails.getInterceptorBroadcaster().callHooksAndReturnObject(thePointcut, theParams);
+ IInterceptorBroadcaster interceptorBroadcaster = theRequestDetails.getInterceptorBroadcaster();
+ retVal = interceptorBroadcaster.callHooksAndReturnObject(thePointcut, theParams);
}
return retVal;
}
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
index c7f3c398163..6b670de6c39 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
@@ -175,7 +175,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer