diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index a82f5712346..d58d93f64bc 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index e1f57b1972c..e583ca6e6c7 100644
--- a/hapi-fhir-android/pom.xml
+++ b/hapi-fhir-android/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index 3c9420a9734..00977896560 100644
--- a/hapi-fhir-base/pom.xml
+++ b/hapi-fhir-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParam.java
new file mode 100644
index 00000000000..9b085313b9a
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParam.java
@@ -0,0 +1,46 @@
+package ca.uhn.fhir.rest.param;
+
+/*-
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2022 Smile CDR, Inc.
+ * %%
+ * 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 java.util.Map;
+
+public class HistorySearchDateRangeParam extends DateRangeParam {
+ public HistorySearchDateRangeParam(Map theParameters, DateRangeParam theDateRange,
+ Integer theOffset){
+ super(theDateRange);
+ this.myOffset = theOffset;
+
+ this.myHistorySearchType = theParameters == null? null
+ : theParameters.keySet().stream().map(key -> HistorySearchStyleEnum.parse(key))
+ .filter(type -> type != null).findAny().orElse(null);
+ }
+ private HistorySearchStyleEnum myHistorySearchType;
+
+ private Integer myOffset;
+
+ public HistorySearchStyleEnum getHistorySearchType() {
+ return myHistorySearchType;
+ }
+
+ public Integer getOffset() {
+ return myOffset;
+ }
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnum.java
new file mode 100644
index 00000000000..1316e7c6dce
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnum.java
@@ -0,0 +1,50 @@
+package ca.uhn.fhir.rest.param;
+
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2022 Smile CDR, Inc.
+ * %%
+ * 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.api.Constants;
+
+import java.util.Arrays;
+
+public enum HistorySearchStyleEnum {
+ AT(Constants.PARAM_AT),
+ SINCE(Constants.PARAM_SINCE),
+ COUNT(Constants.PARAM_COUNT);
+
+ public String getValue() {
+ return myValue;
+ }
+
+ private final String myValue;
+
+ HistorySearchStyleEnum(String theValue) {
+ this.myValue = theValue;
+ }
+
+ public static HistorySearchStyleEnum parse(String value){
+ return Arrays.stream(HistorySearchStyleEnum.values())
+ .filter(type -> type.myValue.equals(value)).findAny().orElse(null);
+ }
+
+ public boolean isAt(){
+ return this == HistorySearchStyleEnum.AT;
+ }
+}
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParamTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParamTest.java
new file mode 100644
index 00000000000..07196cb40fe
--- /dev/null
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchDateRangeParamTest.java
@@ -0,0 +1,41 @@
+package ca.uhn.fhir.rest.param;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class HistorySearchDateRangeParamTest {
+ private final int theOffset = 100;
+ private final DateRangeParam dateRangeParam = new DateRangeParam();
+
+ @Test
+ public void testSearchDateRangeParamWithInvalidSearchType() {
+ HistorySearchDateRangeParam param = new HistorySearchDateRangeParam(Map.of("Some key", new String[]{"value"}), dateRangeParam, theOffset);
+ assertNull(param.getHistorySearchType());
+ assertEquals(theOffset, param.getOffset());
+ }
+
+ @Test
+ public void testSearchDateRangeParamWithSearchTypeAsAt() {
+ HistorySearchDateRangeParam param = new HistorySearchDateRangeParam(Map.of("_at", new String[]{"value"}), dateRangeParam, theOffset);
+ assertEquals(HistorySearchStyleEnum.AT, param.getHistorySearchType());
+ assertEquals(theOffset, param.getOffset());
+ }
+ @Test
+ public void testSearchDateRangeParamWithSearchTypeAsSince() {
+ HistorySearchDateRangeParam param = new HistorySearchDateRangeParam(Map.of("_since", new String[]{"value"}), dateRangeParam, theOffset);
+ assertEquals(HistorySearchStyleEnum.SINCE, param.getHistorySearchType());
+ assertEquals(theOffset, param.getOffset());
+ }
+
+
+ @Test
+ public void testSearchDateRangeParamWithSearchTypeAsCount() {
+ HistorySearchDateRangeParam param = new HistorySearchDateRangeParam(Map.of("_count", new String[]{"value"}), dateRangeParam, theOffset);
+ assertEquals(HistorySearchStyleEnum.COUNT, param.getHistorySearchType());
+ assertEquals(theOffset, param.getOffset());
+
+ }
+}
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnumTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnumTest.java
new file mode 100644
index 00000000000..daa4a4cfe08
--- /dev/null
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/param/HistorySearchStyleEnumTest.java
@@ -0,0 +1,26 @@
+package ca.uhn.fhir.rest.param;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class HistorySearchStyleEnumTest {
+ @Test
+ public void testParse(){
+ assertNull(HistorySearchStyleEnum.parse(""));
+ assertNull(HistorySearchStyleEnum.parse(null));
+ assertNull(HistorySearchStyleEnum.parse("Anything"));
+ assertEquals(HistorySearchStyleEnum.AT, HistorySearchStyleEnum.parse("_at"));
+ assertEquals(HistorySearchStyleEnum.SINCE, HistorySearchStyleEnum.parse("_since"));
+ assertEquals(HistorySearchStyleEnum.COUNT, HistorySearchStyleEnum.parse("_count"));
+ }
+
+ @Test
+ public void testIsAt(){
+ assertTrue(HistorySearchStyleEnum.AT.isAt());
+ assertFalse(HistorySearchStyleEnum.SINCE.isAt());
+ }
+}
diff --git a/hapi-fhir-batch/pom.xml b/hapi-fhir-batch/pom.xml
index 99d8532e074..1e5282ace24 100644
--- a/hapi-fhir-batch/pom.xml
+++ b/hapi-fhir-batch/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml
index 5126b04e7a0..196502fcd8c 100644
--- a/hapi-fhir-bom/pom.xml
+++ b/hapi-fhir-bom/pom.xml
@@ -3,14 +3,14 @@
4.0.0
ca.uhn.hapi.fhir
hapi-fhir-bom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
pom
HAPI FHIR BOM
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml
index 9df1eae5777..1ef85c23426 100644
--- a/hapi-fhir-checkstyle/pom.xml
+++ b/hapi-fhir-checkstyle/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
index 8407d86fb28..1ea67dbd6ef 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
index 4e250fbac08..6b0d7745c09 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir-cli
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
index 550c7c6678e..34060f343b5 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
+++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../hapi-deployable-pom
diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml
index 1690196dd12..1357042fe6b 100644
--- a/hapi-fhir-cli/pom.xml
+++ b/hapi-fhir-cli/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index 9d8e5e3a695..3d63d40d9ee 100644
--- a/hapi-fhir-client-okhttp/pom.xml
+++ b/hapi-fhir-client-okhttp/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml
index 1fee912180c..7aa1dc3c82c 100644
--- a/hapi-fhir-client/pom.xml
+++ b/hapi-fhir-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml
index ea802d27905..2c2e976d9d0 100644
--- a/hapi-fhir-converter/pom.xml
+++ b/hapi-fhir-converter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml
index 73da5a28685..9375b9266ea 100644
--- a/hapi-fhir-dist/pom.xml
+++ b/hapi-fhir-dist/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml
index 4fd6bd9e5ac..e1caa17fc66 100644
--- a/hapi-fhir-docs/pom.xml
+++ b/hapi-fhir-docs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/4009-history-searchwith-at-and-gt-parameters-are-not-returning-the-correct-number-of-resources.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/4009-history-searchwith-at-and-gt-parameters-are-not-returning-the-correct-number-of-resources.yaml
new file mode 100644
index 00000000000..15ccce31705
--- /dev/null
+++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/4009-history-searchwith-at-and-gt-parameters-are-not-returning-the-correct-number-of-resources.yaml
@@ -0,0 +1,6 @@
+---
+type: fix
+issue: 4008
+jira: SMILE-4296
+title: "Previously, when executing a '[base]/_history' search, '_since' and '_at' shared the same behaviour. When a user searched for the date between the records' updated date with '_at', the record of '_at' time was not returned.
+This has been corrected. '_since' query parameter works as it previously did, and the '_at' query parameter returns the record of '_at' time."
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 9942399a74c..ef50f1cf042 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -11,7 +11,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index 32d3ecddda9..c5833eaa398 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml
index a647efee66e..ff06663567e 100644
--- a/hapi-fhir-jpa/pom.xml
+++ b/hapi-fhir-jpa/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 5e787bbd833..66ee5297728 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
index ef1110fe13f..08b8719f70f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
@@ -49,9 +49,7 @@ import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
-import ca.uhn.fhir.jpa.partition.RequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProviderFactory;
-import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc;
import ca.uhn.fhir.jpa.searchparam.extractor.LogicalReferenceHelper;
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult;
@@ -73,11 +71,11 @@ import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.parser.LenientErrorHandler;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum;
-import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
+import ca.uhn.fhir.rest.param.HistorySearchStyleEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
@@ -516,7 +514,10 @@ public abstract class BaseHapiFhirDao extends BaseStora
}
protected IBundleProvider history(RequestDetails theRequest, String theResourceType, Long theResourcePid, Date theRangeStartInclusive, Date theRangeEndInclusive, Integer theOffset) {
+ return history(theRequest, theResourceType, theResourcePid, theRangeStartInclusive, theRangeEndInclusive, theOffset, null);
+ }
+ protected IBundleProvider history(RequestDetails theRequest, String theResourceType, Long theResourcePid, Date theRangeStartInclusive, Date theRangeEndInclusive, Integer theOffset, HistorySearchStyleEnum searchParameterType) {
String resourceName = defaultIfBlank(theResourceType, null);
Search search = new Search();
@@ -529,6 +530,7 @@ public abstract class BaseHapiFhirDao extends BaseStora
search.setResourceId(theResourcePid);
search.setSearchType(SearchTypeEnum.HISTORY);
search.setStatus(SearchStatusEnum.FINISHED);
+ search.setHistorySearchStyle(searchParameterType);
return myPersistedJpaBundleProviderFactory.newInstance(theRequest, search);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
index 65072ae46f1..39d5fb6e625 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
@@ -89,6 +89,7 @@ import ca.uhn.fhir.rest.api.server.storage.IDeleteExpungeJobSubmitter;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
import ca.uhn.fhir.rest.param.HasParam;
+import ca.uhn.fhir.rest.param.HistorySearchDateRangeParam;
import ca.uhn.fhir.rest.server.IPagingProvider;
import ca.uhn.fhir.rest.server.IRestfulServerDefaults;
import ca.uhn.fhir.rest.server.RestfulServerUtils;
@@ -936,6 +937,25 @@ public abstract class BaseHapiFhirResourceDao extends B
return retVal;
}
+ @Override
+ @Transactional
+ public IBundleProvider history(final IIdType theId, final HistorySearchDateRangeParam theHistorySearchDateRangeParam,
+ RequestDetails theRequest) {
+ StopWatch w = new StopWatch();
+
+ IIdType id = theId.withResourceType(myResourceName).toUnqualifiedVersionless();
+ BaseHasResource entity = readEntity(id, theRequest);
+
+ IBundleProvider retVal = super.history(theRequest, myResourceName, entity.getId(),
+ theHistorySearchDateRangeParam.getLowerBoundAsInstant(),
+ theHistorySearchDateRangeParam.getUpperBoundAsInstant(),
+ theHistorySearchDateRangeParam.getOffset(),
+ theHistorySearchDateRangeParam.getHistorySearchType());
+
+ ourLog.debug("Processed history on {} in {}ms", id, w.getMillisAndRestart());
+ return retVal;
+ }
+
protected boolean isPagingProviderDatabaseBacked(RequestDetails theRequestDetails) {
if (theRequestDetails == null || theRequestDetails.getServer() == null) {
return false;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
index a22d0655d62..d69e20c82c6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
@@ -29,6 +29,7 @@ import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
+import ca.uhn.fhir.rest.param.HistorySearchStyleEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimaps;
@@ -43,9 +44,11 @@ import javax.persistence.PersistenceContextType;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Expression;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
+import javax.persistence.criteria.Subquery;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -93,19 +96,20 @@ public class HistoryBuilder {
Root from = criteriaQuery.from(ResourceHistoryTable.class);
criteriaQuery.select(cb.count(from));
- addPredicatesToQuery(cb, thePartitionId, criteriaQuery, from);
+ addPredicatesToQuery(cb, thePartitionId, criteriaQuery, from, null);
TypedQuery query = myEntityManager.createQuery(criteriaQuery);
return query.getSingleResult();
}
@SuppressWarnings("OptionalIsPresent")
- public List fetchEntities(RequestPartitionId thePartitionId, Integer theOffset, int theFromIndex, int theToIndex) {
+ public List fetchEntities(RequestPartitionId thePartitionId, Integer theOffset, int theFromIndex,
+ int theToIndex, HistorySearchStyleEnum theHistorySearchStyle) {
CriteriaBuilder cb = myEntityManager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = cb.createQuery(ResourceHistoryTable.class);
Root from = criteriaQuery.from(ResourceHistoryTable.class);
- addPredicatesToQuery(cb, thePartitionId, criteriaQuery, from);
+ addPredicatesToQuery(cb, thePartitionId, criteriaQuery, from, theHistorySearchStyle);
from.fetch("myProvenance", JoinType.LEFT);
@@ -149,7 +153,8 @@ public class HistoryBuilder {
return tables;
}
- private void addPredicatesToQuery(CriteriaBuilder theCriteriaBuilder, RequestPartitionId thePartitionId, CriteriaQuery> theQuery, Root theFrom) {
+ private void addPredicatesToQuery(CriteriaBuilder theCriteriaBuilder, RequestPartitionId thePartitionId, CriteriaQuery> theQuery,
+ Root theFrom, HistorySearchStyleEnum theHistorySearchStyle) {
List predicates = new ArrayList<>();
if (!thePartitionId.isAllPartitions()) {
@@ -175,7 +180,11 @@ public class HistoryBuilder {
}
if (myRangeStartInclusive != null) {
- predicates.add(theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated").as(Date.class), myRangeStartInclusive));
+ if(HistorySearchStyleEnum.AT == theHistorySearchStyle && myResourceId != null) {
+ addPredicateForAtQueryParameter(theCriteriaBuilder, theQuery, theFrom, predicates);
+ } else {
+ predicates.add(theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated").as(Date.class), myRangeStartInclusive));
+ }
}
if (myRangeEndInclusive != null) {
predicates.add(theCriteriaBuilder.lessThanOrEqualTo(theFrom.get("myUpdated").as(Date.class), myRangeEndInclusive));
@@ -186,6 +195,23 @@ public class HistoryBuilder {
}
}
+ private void addPredicateForAtQueryParameter(CriteriaBuilder theCriteriaBuilder, CriteriaQuery> theQuery,
+ Root theFrom, List thePredicates) {
+ Subquery pastDateSubQuery = theQuery.subquery(Date.class);
+ Root subQueryResourceHistory = pastDateSubQuery.from(ResourceHistoryTable.class);
+ Expression myUpdatedMostRecent = theCriteriaBuilder.max(subQueryResourceHistory.get("myUpdated")).as(Date.class);
+ Expression myUpdatedMostRecentOrDefault = theCriteriaBuilder.coalesce(myUpdatedMostRecent,
+ theCriteriaBuilder.literal(myRangeStartInclusive));
+
+ pastDateSubQuery.select(myUpdatedMostRecentOrDefault)
+ .where(theCriteriaBuilder.lessThanOrEqualTo(subQueryResourceHistory.get("myUpdated").as(Date.class), myRangeStartInclusive)
+ , theCriteriaBuilder.equal(subQueryResourceHistory.get("myResourceId"), myResourceId));
+
+ Predicate updatedDatePredicate = theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated").as(Date.class),
+ pastDateSubQuery);
+ thePredicates.add(updatedDatePredicate);
+ }
+
private void validateNotSearchingAllPartitions(RequestPartitionId thePartitionId) {
if (myPartitionSettings.isPartitioningEnabled()) {
if (thePartitionId.isAllPartitions()) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
index 91880d86118..157ec2ce8f5 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
@@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.rest.param.DateRangeParam;
+import ca.uhn.fhir.rest.param.HistorySearchStyleEnum;
import ca.uhn.fhir.rest.server.util.ICachedSearchDetails;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -158,6 +159,13 @@ public class Search implements ICachedSearchDetails, Serializable {
@Transient
private Integer mySizeModeSize;
+ /**
+ * This isn't currently persisted in the DB. When there is search criteria defined in the
+ * search parameter, this is used to keep the search criteria type.
+ */
+ @Transient
+ private HistorySearchStyleEnum myHistorySearchStyle;
+
/**
* Constructor
*/
@@ -415,6 +423,14 @@ public class Search implements ICachedSearchDetails, Serializable {
myOffset = theOffset;
}
+ public HistorySearchStyleEnum getHistorySearchStyle() {
+ return myHistorySearchStyle;
+ }
+
+ public void setHistorySearchStyle(HistorySearchStyleEnum theHistorySearchStyle) {
+ this.myHistorySearchStyle = theHistorySearchStyle;
+ }
+
@Nonnull
public static String createSearchQueryStringForStorage(@Nonnull String theSearchQueryString, @Nonnull RequestPartitionId theRequestPartitionId) {
String searchQueryString = theSearchQueryString;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
index 2cc36d1585a..075a9a6b64e 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
@@ -149,10 +149,12 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
*/
private List doHistoryInTransaction(Integer theOffset, int theFromIndex, int theToIndex) {
- HistoryBuilder historyBuilder = myHistoryBuilderFactory.newHistoryBuilder(mySearchEntity.getResourceType(), mySearchEntity.getResourceId(), mySearchEntity.getLastUpdatedLow(), mySearchEntity.getLastUpdatedHigh());
+ HistoryBuilder historyBuilder = myHistoryBuilderFactory.newHistoryBuilder(mySearchEntity.getResourceType(),
+ mySearchEntity.getResourceId(), mySearchEntity.getLastUpdatedLow(), mySearchEntity.getLastUpdatedHigh());
RequestPartitionId partitionId = getRequestPartitionIdForHistory();
- List results = historyBuilder.fetchEntities(partitionId, theOffset, theFromIndex, theToIndex);
+ List results = historyBuilder.fetchEntities(partitionId, theOffset, theFromIndex,
+ theToIndex, mySearchEntity.getHistorySearchStyle());
List retVal = new ArrayList<>();
for (ResourceHistoryTable next : results) {
diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml
index 03260cbd686..ceb13fab925 100644
--- a/hapi-fhir-jpaserver-cql/pom.xml
+++ b/hapi-fhir-jpaserver-cql/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
index bdfc41cec2f..bef6dfb8c68 100644
--- a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml
index f368321f9be..c20cdda7336 100644
--- a/hapi-fhir-jpaserver-mdm/pom.xml
+++ b/hapi-fhir-jpaserver-mdm/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml
index f1987cdca32..ee421aaa409 100644
--- a/hapi-fhir-jpaserver-model/pom.xml
+++ b/hapi-fhir-jpaserver-model/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml
index 5237763e86b..b23d9bc3e66 100755
--- a/hapi-fhir-jpaserver-searchparam/pom.xml
+++ b/hapi-fhir-jpaserver-searchparam/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml
index afa84021c78..0788bcafe7b 100644
--- a/hapi-fhir-jpaserver-subscription/pom.xml
+++ b/hapi-fhir-jpaserver-subscription/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml
index b8922d0605e..894ffe12dbf 100644
--- a/hapi-fhir-jpaserver-test-dstu2/pom.xml
+++ b/hapi-fhir-jpaserver-test-dstu2/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml
index 2d1591b1394..f41c930942a 100644
--- a/hapi-fhir-jpaserver-test-dstu3/pom.xml
+++ b/hapi-fhir-jpaserver-test-dstu3/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
index 96db0cabc1e..2a289c3659f 100644
--- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
+++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java
@@ -1521,10 +1521,14 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
Patient patient = new Patient();
patient.addName().setFamily(methodName);
- IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
List preDates = Lists.newArrayList();
List ids = Lists.newArrayList();
+
+ IIdType idCreated = myPatientDao.create(patient, mySrd).getId();
+ ids.add(idCreated.toUnqualified().getValue());
+ IIdType id = idCreated.toUnqualifiedVersionless();
+
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
preDates.add(new Date());
@@ -1537,13 +1541,13 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
List idValues;
idValues = toUnqualifiedIdValues(myPatientDao.history(id, preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = toUnqualifiedIdValues(myPatientDao.history(preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = toUnqualifiedIdValues(mySystemDao.history(preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
}
@Test
diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
index da7b89bd180..27c51efc73f 100644
--- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
+++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
@@ -2246,10 +2246,14 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
Patient patient = new Patient();
patient.addName().setFamily(methodName);
- IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
List preDates = Lists.newArrayList();
List ids = Lists.newArrayList();
+
+ IIdType idCreated = myPatientDao.create(patient, mySrd).getId();
+ ids.add(idCreated.toUnqualified().getValue());
+ IIdType id = idCreated.toUnqualifiedVersionless();
+
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
preDates.add(new Date());
@@ -2262,13 +2266,13 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
List idValues;
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + id.getIdPart() + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1), ids.get(0)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt2060");
assertThat(idValues.toString(), idValues, empty());
diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml
index f0e6bfca781..e2716da6ada 100644
--- a/hapi-fhir-jpaserver-test-r4/pom.xml
+++ b/hapi-fhir-jpaserver-test-r4/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
index ccd58c2e02c..76e7ac2f9f2 100644
--- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
+++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
@@ -2090,10 +2090,13 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
Patient patient = new Patient();
patient.addName().setFamily(methodName);
- IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
List preDates = Lists.newArrayList();
List ids = Lists.newArrayList();
+ IIdType idCreated = myPatientDao.create(patient, mySrd).getId();
+ ids.add(idCreated.toUnqualified().getValue());
+ IIdType id = idCreated.toUnqualifiedVersionless();
+
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
preDates.add(new Date());
@@ -2106,13 +2109,13 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
List idValues;
idValues = toUnqualifiedIdValues(myPatientDao.history(id, preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = toUnqualifiedIdValues(myPatientDao.history(preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = toUnqualifiedIdValues(mySystemDao.history(preDates.get(0), preDates.get(3), null, mySrd));
- assertThat(idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
}
@Test
diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
index 9ed65e15945..fd78f3d4bdd 100644
--- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
+++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
@@ -179,6 +179,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -3032,10 +3033,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient patient = new Patient();
patient.addName().setFamily(methodName);
- IIdType id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
List preDates = Lists.newArrayList();
List ids = Lists.newArrayList();
+
+ IIdType idCreated = myPatientDao.create(patient, mySrd).getId();
+ ids.add(idCreated.toUnqualified().getValue());
+ IIdType id = idCreated.toUnqualifiedVersionless();
+
for (int i = 0; i < 10; i++) {
sleepOneClick();
preDates.add(new Date());
@@ -3049,13 +3054,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
List idValues;
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + id.getIdPart() + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1), ids.get(0)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt" + toStr(preDates.get(0)) + "&_at=lt" + toStr(preDates.get(3)));
- assertThat(idValues.toString(), idValues, contains(ids.get(2), ids.get(1), ids.get(0)));
+ assertThat(idValues.toString(), idValues, contains(ids.get(3), ids.get(2), ids.get(1)));
idValues = searchAndReturnUnqualifiedIdValues(ourServerBase + "/_history?_at=gt2060");
assertThat(idValues.toString(), idValues, empty());
@@ -7234,6 +7239,108 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(0, results.getEntry().size());
}
+ @Test
+ public void testSearchHistoryWithAtAndGtParameters() throws Exception {
+
+ // Create Patient
+ Patient patient = new Patient();
+ patient = (Patient) myClient.create().resource(patient).execute().getResource();
+ Long patientId = patient.getIdElement().getIdPartAsLong();
+
+ // Update Patient after delay
+ int delayInMs = 1000;
+ TimeUnit.MILLISECONDS.sleep(delayInMs);
+ patient.getNameFirstRep().addGiven("Bob");
+ myClient.update().resource(patient).execute();
+
+ Patient unrelatedPatient = (Patient) myClient.create().resource(new Patient()).execute().getResource();
+ assertNotEquals(unrelatedPatient.getIdElement().getIdPartAsLong(), patientId);
+
+ // ensure the patient has the expected overall history
+ Bundle result = myClient.history()
+ .onInstance("Patient/"+patientId)
+ .returnBundle(Bundle.class)
+ .execute();
+
+ assertEquals(2, result.getEntry().size());
+
+ Patient patientV1 = (Patient) result.getEntry().get(1).getResource();
+ assertEquals(patientId, patientV1.getIdElement().getIdPartAsLong());
+
+ Patient patientV2 = (Patient) result.getEntry().get(0).getResource();
+ assertEquals(patientId, patientV2.getIdElement().getIdPartAsLong());
+
+ Date dateV1 = patientV1.getMeta().getLastUpdated();
+ Date dateV2 = patientV2.getMeta().getLastUpdated();
+ assertTrue(dateV1.before((dateV2)));
+
+ // Issue 3138 test case, verify behavior of _at
+ verifyAtBehaviourWhenQueriedDateDuringTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+ verifyAtBehaviourWhenQueriedDateAfterTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+ verifyAtBehaviourWhenQueriedDateBeforeTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+ // verify behavior of _since
+ verifySinceBehaviourWhenQueriedDateDuringTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+ verifySinceBehaviourWhenQueriedDateAfterTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+ verifySinceBehaviourWhenQueriedDateBeforeTwoUpdatedDates(patientId, delayInMs, dateV1, dateV2);
+
+ }
+
+ private void verifyAtBehaviourWhenQueriedDateDuringTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV1, delayInMs / 2);
+ assertTrue(timeBetweenUpdates.after(dateV1));
+ assertTrue(timeBetweenUpdates.before(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_at=gt" + toStr(timeBetweenUpdates));
+ assertEquals(2, resultIds.size());
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/1"));
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/2"));
+ }
+
+ private void verifyAtBehaviourWhenQueriedDateAfterTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV2, delayInMs);
+ assertTrue(timeBetweenUpdates.after(dateV1));
+ assertTrue(timeBetweenUpdates.after(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_at=gt" + toStr(timeBetweenUpdates));
+ assertEquals(1, resultIds.size());
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/2"));
+ }
+
+ private void verifyAtBehaviourWhenQueriedDateBeforeTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV1, - delayInMs);
+ assertTrue(timeBetweenUpdates.before(dateV1));
+ assertTrue(timeBetweenUpdates.before(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_at=gt" + toStr(timeBetweenUpdates));
+ assertEquals(2, resultIds.size());
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/1"));
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/2"));
+ }
+
+ private void verifySinceBehaviourWhenQueriedDateDuringTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV1, delayInMs / 2);
+ assertTrue(timeBetweenUpdates.after(dateV1));
+ assertTrue(timeBetweenUpdates.before(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_since=" + toStr(timeBetweenUpdates));
+ assertEquals(1, resultIds.size());
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/2"));
+ }
+
+ private void verifySinceBehaviourWhenQueriedDateAfterTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV2, delayInMs);
+ assertTrue(timeBetweenUpdates.after(dateV1));
+ assertTrue(timeBetweenUpdates.after(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_since=" + toStr(timeBetweenUpdates));
+ assertEquals(0, resultIds.size());
+ }
+
+ private void verifySinceBehaviourWhenQueriedDateBeforeTwoUpdatedDates(Long patientId, int delayInMs, Date dateV1, Date dateV2) throws IOException {
+ Date timeBetweenUpdates = DateUtils.addMilliseconds(dateV1, - delayInMs);
+ assertTrue(timeBetweenUpdates.before(dateV1));
+ assertTrue(timeBetweenUpdates.before(dateV2));
+ List resultIds = searchAndReturnUnqualifiedIdValues(ourServerBase + "/Patient/" + patientId + "/_history?_since=" + toStr(timeBetweenUpdates));
+ assertEquals(2, resultIds.size());
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/1"));
+ assertTrue(resultIds.contains("Patient/"+ patientId +"/_history/2"));
+ }
+
@Test
public void searchResource_bySourceWithPreserveRequestIdDisabled_isSuccess() {
String sourceUri = "http://acme.org";
diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml
index 19507333a55..5cfbd6ec0d4 100644
--- a/hapi-fhir-jpaserver-test-r5/pom.xml
+++ b/hapi-fhir-jpaserver-test-r5/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml
index ec4570b4fb4..3cf2b4495bb 100644
--- a/hapi-fhir-jpaserver-test-utilities/pom.xml
+++ b/hapi-fhir-jpaserver-test-utilities/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
index 934cb40294d..8277f9fffe5 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
+++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml
index 552ad409f2b..821c98bb56f 100644
--- a/hapi-fhir-server-mdm/pom.xml
+++ b/hapi-fhir-server-mdm/pom.xml
@@ -7,7 +7,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml
index c7e8806e59c..20c055c716b 100644
--- a/hapi-fhir-server-openapi/pom.xml
+++ b/hapi-fhir-server-openapi/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml
index 5f6c7c4302f..8be20316af9 100644
--- a/hapi-fhir-server/pom.xml
+++ b/hapi-fhir-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
index fa32ec5c422..f7023e81ff8 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
index 3c5f8adf19e..cdd9c6186f9 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
hapi-fhir-spring-boot-sample-client-apache
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
index bc367ed7a11..130954aa96c 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
hapi-fhir-spring-boot-sample-client-okhttp
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
index 404c372a997..a847a9a98b2 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot-samples
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
hapi-fhir-spring-boot-sample-server-jersey
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
index 12545b42954..57ee4877d03 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir-spring-boot
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
hapi-fhir-spring-boot-samples
diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
index d7e90402d0b..eb2bd702fd2 100644
--- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
+++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml
index 8c9c659b1d1..f508df8f284 100644
--- a/hapi-fhir-spring-boot/pom.xml
+++ b/hapi-fhir-spring-boot/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml
index 1b399984689..f24aa09026c 100644
--- a/hapi-fhir-sql-migrate/pom.xml
+++ b/hapi-fhir-sql-migrate/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml
index 8d10e6960d2..52ce16e6b82 100644
--- a/hapi-fhir-storage-batch2-jobs/pom.xml
+++ b/hapi-fhir-storage-batch2-jobs/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml
index b0ae1577775..e0ead75d0fc 100644
--- a/hapi-fhir-storage-batch2/pom.xml
+++ b/hapi-fhir-storage-batch2/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml
index 343189a858e..2c61020caae 100644
--- a/hapi-fhir-storage-mdm/pom.xml
+++ b/hapi-fhir-storage-mdm/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml
index 5c8d1a6eb81..b57f28b9a2f 100644
--- a/hapi-fhir-storage-test-utilities/pom.xml
+++ b/hapi-fhir-storage-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
4.0.0
diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml
index 9e41bdb1275..63673894d71 100644
--- a/hapi-fhir-storage/pom.xml
+++ b/hapi-fhir-storage/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java
index 3387afc20cf..7727fbdb26d 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java
@@ -40,6 +40,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
+import ca.uhn.fhir.rest.param.HistorySearchDateRangeParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
@@ -123,8 +124,14 @@ public interface IFhirResourceDao extends IDao {
IBundleProvider history(Date theSince, Date theUntil, Integer theOffset, RequestDetails theRequestDetails);
+ /**
+ * @deprecated Just use history(IIdType theId, HistorySearchDateRangeParam theHistorySearchDateRangeParam, RequestDetails theRequestDetails) instead;
+ */
+ @Deprecated(since = "6.2")
IBundleProvider history(IIdType theId, Date theSince, Date theUntil, Integer theOffset, RequestDetails theRequestDetails);
+ IBundleProvider history(IIdType theId, HistorySearchDateRangeParam theHistorySearchDateRangeParam, RequestDetails theRequestDetails);
+
/**
* Not supported in DSTU1!
*
diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java
index c486860f4f0..be38b2fd9c2 100644
--- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java
+++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProvider.java
@@ -49,6 +49,7 @@ import ca.uhn.fhir.rest.api.ValidationModeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.DateRangeParam;
+import ca.uhn.fhir.rest.param.HistorySearchDateRangeParam;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
@@ -118,7 +119,7 @@ public abstract class BaseJpaResourceProvider extends B
startRequest(theRequest);
try {
DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt);
- return myDao.history(theId, sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theOffset, theRequestDetails);
+ return myDao.history(theId, new HistorySearchDateRangeParam(theRequestDetails.getParameters(), sinceOrAt, theOffset), theRequestDetails);
} finally {
endRequest(theRequest);
}
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index bc27fc8fa45..936be847dff 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index b3475bdf7e5..a7005d9a389 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index 0bd46010812..d3e7b656be7 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml
index a7ecbd30b07..1dbe2f2da67 100644
--- a/hapi-fhir-structures-hl7org-dstu2/pom.xml
+++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml
index 57d3a2a8f47..bc1934e3d05 100644
--- a/hapi-fhir-structures-r4/pom.xml
+++ b/hapi-fhir-structures-r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml
index 73ff997043f..f3d21672dc6 100644
--- a/hapi-fhir-structures-r5/pom.xml
+++ b/hapi-fhir-structures-r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml
index 580a415026e..a4e2ffe67f8 100644
--- a/hapi-fhir-test-utilities/pom.xml
+++ b/hapi-fhir-test-utilities/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml
index c5714f267e8..3025acb3f35 100644
--- a/hapi-fhir-testpage-overlay/pom.xml
+++ b/hapi-fhir-testpage-overlay/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml
index 25dca05c7bb..09a377f0c80 100644
--- a/hapi-fhir-validation-resources-dstu2.1/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml
index a65d36d0a9c..e103aac5e9d 100644
--- a/hapi-fhir-validation-resources-dstu2/pom.xml
+++ b/hapi-fhir-validation-resources-dstu2/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml
index 4d6db7e093d..4679fb17bdf 100644
--- a/hapi-fhir-validation-resources-dstu3/pom.xml
+++ b/hapi-fhir-validation-resources-dstu3/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml
index d32d7861017..a8ce318bba7 100644
--- a/hapi-fhir-validation-resources-r4/pom.xml
+++ b/hapi-fhir-validation-resources-r4/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml
index d8869cc21e6..4d651e3207a 100644
--- a/hapi-fhir-validation-resources-r5/pom.xml
+++ b/hapi-fhir-validation-resources-r5/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml
index 7c45a203499..92a67699224 100644
--- a/hapi-fhir-validation/pom.xml
+++ b/hapi-fhir-validation/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml
index b51ae3247f9..b8c081cf2a6 100644
--- a/hapi-tinder-plugin/pom.xml
+++ b/hapi-tinder-plugin/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
@@ -58,37 +58,37 @@
ca.uhn.hapi.fhir
hapi-fhir-structures-dstu3
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-hl7org-dstu2
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r4
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-structures-r5
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu2
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu3
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-r4
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
org.apache.velocity
diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml
index fc693ae0bee..99343ceb767 100644
--- a/hapi-tinder-test/pom.xml
+++ b/hapi-tinder-test/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index c8518c9e15b..0576533e892 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
pom
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
HAPI-FHIR
An open-source implementation of the FHIR specification in Java.
https://hapifhir.io
@@ -2024,7 +2024,7 @@
ca.uhn.hapi.fhir
hapi-fhir-checkstyle
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
index c704a575e39..7a7212fc1da 100644
--- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
+++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml
@@ -6,7 +6,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
index d2767de9b39..529d0f75ed1 100644
--- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml
@@ -4,7 +4,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../pom.xml
diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
index 560d4bf86e2..dbe8f3fdf93 100644
--- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml
+++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.2.0-PRE10-SNAPSHOT
+ 6.2.0-PRE11-SNAPSHOT
../../pom.xml