diff --git a/examples/src/main/java/example/PagingPatientProvider.java b/examples/src/main/java/example/PagingPatientProvider.java index ab398a3679a..ce70e046e76 100644 --- a/examples/src/main/java/example/PagingPatientProvider.java +++ b/examples/src/main/java/example/PagingPatientProvider.java @@ -60,6 +60,11 @@ public class PagingPatientProvider implements IResourceProvider { // Typically this method just returns null return null; } + + @Override + public String getUuid() { + return null; + } }; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java index 83bcdf95bf9..efd36d79cd7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/HistoryMethodBinding.java @@ -171,7 +171,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding { return new IBundleProvider() { @Override - public InstantDt getPublished() { + public IPrimitiveType getPublished() { return resources.getPublished(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java index 609bb164f17..71c7eae09fb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IBundleProvider.java @@ -1,5 +1,7 @@ package ca.uhn.fhir.rest.server; +import java.util.Date; + /* * #%L * HAPI FHIR - Core Library @@ -10,7 +12,7 @@ package ca.uhn.fhir.rest.server; * 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 + * 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, @@ -23,6 +25,7 @@ package ca.uhn.fhir.rest.server; import java.util.List; import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.model.primitive.InstantDt; @@ -31,15 +34,17 @@ public interface IBundleProvider { /** * Load the given collection of resources by index, plus any additional resources per the * server's processing rules (e.g. _include'd resources, OperationOutcome, etc.). For example, - * if the method is invoked with index 0,10 the method might return 10 search results, plus an + * if the method is invoked with index 0,10 the method might return 10 search results, plus an * additional 20 resources which matched a client's _include specification. * - * @param theFromIndex The low index (inclusive) to return - * @param theToIndex The high index (exclusive) to return + * @param theFromIndex + * The low index (inclusive) to return + * @param theToIndex + * The high index (exclusive) to return * @return A list of resources. The size of this list must be at least theToIndex - theFromIndex. */ List getResources(int theFromIndex, int theToIndex); - + /** * Optionally may be used to signal a preferred page size to the server, e.g. because * the implementing code recognizes that the resources which will be returned by this @@ -50,17 +55,17 @@ public interface IBundleProvider { * @return Returns the preferred page size or null */ Integer preferredPageSize(); - + /** * Returns the total number of results which match the given query (exclusive of any * _include's or OperationOutcome) */ int size(); - + /** * Returns the instant as of which this result was valid */ - InstantDt getPublished(); + IPrimitiveType getPublished(); /** * Returns the UUID associated with this search. Note that this @@ -68,7 +73,11 @@ public interface IBundleProvider { * {@link IPagingProvider} is being used that requires UUIDs * being returned. *

- * Otherwise you may simply return {@code null} + * In other words, if you are using the default {@link FifoMemoryPagingProvider} in + * your server, it is fine for this method to simply return {@code null} since {@link FifoMemoryPagingProvider} + * does not use the value anyhow. On the other hand, if you are creating a custom + * [@code IPagingProvider} implementation you might use this method to communicate + * the search ID back to the provider. *

*/ public String getUuid(); diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java index 57be98b0552..a5170173a49 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchHl7OrgDstu2Test.java @@ -160,6 +160,11 @@ public class SearchHl7OrgDstu2Test { public int size() { return 0; } + + @Override + public String getUuid() { + return null; + } }; }