Skip to content

Commit 250a7f1

Browse files
author
jdar
committed
Merge remote-tracking branch 'origin/master' into mergeback-5-rel-8-8
2 parents 02a8fac + 1c96900 commit 250a7f1

File tree

6 files changed

+28
-27
lines changed

6 files changed

+28
-27
lines changed

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoEncounter.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public IBundleProvider encounterInstanceEverything(
4646
DateRangeParam theLastUpdated,
4747
SortSpec theSort) {
4848

49-
if (theId != null) {
50-
read(theId, theRequest);
51-
}
52-
5349
SearchParameterMap paramMap = new SearchParameterMap();
5450
if (theCount != null) {
5551
paramMap.setCount(theCount.getValue());

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoPatient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ public IBundleProvider patientInstanceEverything(
141141
PatientEverythingParameters theQueryParams,
142142
IIdType theId) {
143143

144-
read(theId, theRequestDetails);
145-
146144
TokenOrListParam id = new TokenOrListParam().add(new TokenParam(theId.getIdPart()));
147145
return doEverythingOperation(
148146
id,

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,13 @@ private void createChunkedQueryForEverythingSearch(
887887

888888
extractTargetPidsFromIdParams(targetPids);
889889

890+
if (targetPids.isEmpty()) {
891+
// An _id parameter was provided to perform an instance $everything operation,
892+
// but the ID could not be resoled to any PIDs --> throw ResourceNotFoundException as per FHIR spec
893+
throw new ResourceNotFoundException(
894+
Msg.code(2841) + "Resource " + myParams.get(IAnyResource.SP_RES_ID) + " is not known.");
895+
}
896+
890897
// add the target pids to our executors as the first
891898
// results iterator to go through
892899
theSearchQueryExecutors.add(new ResolvedSearchQueryExecutor(new ArrayList<>(targetPids)));

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4QueryCountTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,10 +1074,10 @@ public void testEverythingPaging() {
10741074
params.setCount(new IntegerType(10));
10751075
IBundleProvider outcome = myPatientDao.patientInstanceEverything(null, mySrd, params, pid);
10761076
assertEquals(10, outcome.getResources(0, 10).size());
1077-
assertEquals(7, myCaptureQueriesListener.countSelectQueries());
1077+
assertEquals(5, myCaptureQueriesListener.countSelectQueries());
10781078
assertEquals(17, myCaptureQueriesListener.countInsertQueries());
10791079
assertEquals(1, myCaptureQueriesListener.countUpdateQueries());
1080-
assertEquals(4, myCaptureQueriesListener.countCommits());
1080+
assertEquals(3, myCaptureQueriesListener.countCommits());
10811081

10821082
// Page 2
10831083
myCaptureQueriesListener.clear();

hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/dbpartitionmode/TestDefinitions.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -642,44 +642,44 @@ public void testOperation_Everything() {
642642
assertThat(actualIds).asList().containsExactlyInAnyOrder(ids.allIdValues().toArray(new String[0]));
643643

644644
myCaptureQueriesListener.logSelectQueries();
645-
assertEquals(8, myCaptureQueriesListener.countSelectQueries());
645+
assertEquals(6, myCaptureQueriesListener.countSelectQueries());
646646

647647
assertThat(getSelectSql(0)).doesNotContainIgnoringCase("union");
648648
if (myIncludePartitionIdsInSql) {
649-
assertThat(getSelectSql(2)).endsWith(" where rt1_0.PARTITION_ID='1' and (rt1_0.RES_TYPE='Patient' and rt1_0.FHIR_ID='" + ids.patientPid + "')");
649+
assertThat(getSelectSql(0)).endsWith(" where rt1_0.PARTITION_ID='1' and (rt1_0.RES_TYPE='Patient' and rt1_0.FHIR_ID='" + ids.patientPid + "')");
650650
} else {
651-
assertThat(getSelectSql(2)).endsWith(" where (rt1_0.RES_TYPE='Patient' and rt1_0.FHIR_ID='" + ids.patientPid + "')");
651+
assertThat(getSelectSql(0)).endsWith(" where (rt1_0.RES_TYPE='Patient' and rt1_0.FHIR_ID='" + ids.patientPid + "')");
652652
}
653653

654654
if (myIncludePartitionIdsInSql) {
655-
assertThat(getSelectSql(3)).startsWith("SELECT DISTINCT t0.PARTITION_ID,t0.SRC_RESOURCE_ID FROM HFJ_RES_LINK");
655+
assertThat(getSelectSql(1)).startsWith("SELECT DISTINCT t0.PARTITION_ID,t0.SRC_RESOURCE_ID FROM HFJ_RES_LINK");
656656
} else {
657-
assertThat(getSelectSql(3)).startsWith("SELECT DISTINCT t0.SRC_RESOURCE_ID FROM HFJ_RES_LINK");
657+
assertThat(getSelectSql(1)).startsWith("SELECT DISTINCT t0.SRC_RESOURCE_ID FROM HFJ_RES_LINK");
658658
}
659659
if (myIncludePartitionIdsInPks) {
660-
assertThat(getSelectSql(3)).contains("WHERE (((t0.TARGET_RES_PARTITION_ID,t0.TARGET_RESOURCE_ID) IN (('1','" + ids.patientPid + "')) )");
661-
assertThat(getSelectSql(3)).contains("GROUP BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
662-
assertThat(getSelectSql(3)).contains("ORDER BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
663-
assertThat(getSelectSql(4)).containsAnyOf(
660+
assertThat(getSelectSql(1)).contains("WHERE (((t0.TARGET_RES_PARTITION_ID,t0.TARGET_RESOURCE_ID) IN (('1','" + ids.patientPid + "')) )");
661+
assertThat(getSelectSql(1)).contains("GROUP BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
662+
assertThat(getSelectSql(1)).contains("ORDER BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
663+
assertThat(getSelectSql(2)).containsAnyOf(
664664
"from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.patientPid() + "','" + ids.encounterPid() + "') ",
665665
"from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.encounterPid() + "','" + ids.patientPid() + "') "
666666
);
667-
assertThat(getSelectSql(5)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.childOrgPid() + "') ");
668-
assertThat(getSelectSql(6)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.parentOrgPid() + "') ");
667+
assertThat(getSelectSql(3)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.childOrgPid() + "') ");
668+
assertThat(getSelectSql(4)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.PARTITION_ID='1' and rl1_0.SRC_RESOURCE_ID in ('" + ids.parentOrgPid() + "') ");
669669
} else {
670-
assertThat(getSelectSql(3)).contains("WHERE ((t0.TARGET_RESOURCE_ID = '" + ids.patientPid() + "') ");
670+
assertThat(getSelectSql(1)).contains("WHERE ((t0.TARGET_RESOURCE_ID = '" + ids.patientPid() + "') ");
671671
if (myIncludePartitionIdsInSql) {
672-
assertThat(getSelectSql(3)).contains(" GROUP BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
672+
assertThat(getSelectSql(1)).contains(" GROUP BY t0.PARTITION_ID,t0.SRC_RESOURCE_ID ");
673673
} else {
674-
assertThat(getSelectSql(3)).contains(" GROUP BY t0.SRC_RESOURCE_ID ");
674+
assertThat(getSelectSql(1)).contains(" GROUP BY t0.SRC_RESOURCE_ID ");
675675
}
676-
assertThat(getSelectSql(3)).endsWith(" ORDER BY t0.SRC_RESOURCE_ID fetch first '10000' rows only");
677-
assertThat(getSelectSql(4)).containsAnyOf(
676+
assertThat(getSelectSql(1)).endsWith(" ORDER BY t0.SRC_RESOURCE_ID fetch first '10000' rows only");
677+
assertThat(getSelectSql(2)).containsAnyOf(
678678
"from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.patientPid() + "','" + ids.encounterPid() + "') ",
679679
"from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.encounterPid() + "','" + ids.patientPid() + "') "
680680
);
681-
assertThat(getSelectSql(5)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.childOrgPid() + "') ");
682-
assertThat(getSelectSql(6)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.parentOrgPid() + "') ");
681+
assertThat(getSelectSql(3)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.childOrgPid() + "') ");
682+
assertThat(getSelectSql(4)).contains("from HFJ_RES_LINK rl1_0 where rl1_0.SRC_RESOURCE_ID in ('" + ids.parentOrgPid() + "') ");
683683
}
684684

685685
}

hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestElasticsearchContainerHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class TestElasticsearchContainerHelper {
3434
private static final Logger ourLog = LoggerFactory.getLogger(TestElasticsearchContainerHelper.class);
3535

3636

37-
public static final String ELASTICSEARCH_VERSION = "7.17.3";
37+
public static final String ELASTICSEARCH_VERSION = "7.17.25";
3838
public static final String ELASTICSEARCH_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch:" + ELASTICSEARCH_VERSION;
3939

4040
public static ElasticsearchContainer getEmbeddedElasticSearch() {

0 commit comments

Comments
 (0)