Class SimpleBundleProvider
- All Implemented Interfaces:
IBundleProvider
- Direct Known Subclasses:
BundleProviderWithNamedPages
-
Constructor Summary
ConstructorDescriptionCreate an empty bundleSimpleBundleProvider
(int theSize) Constructor that provides only a size but no actual data (useful for _count = 0)SimpleBundleProvider
(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList) ConstructorSimpleBundleProvider
(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList, String theUuid) SimpleBundleProvider
(org.hl7.fhir.instance.model.api.IBaseResource theResource) ConstructorSimpleBundleProvider
(org.hl7.fhir.instance.model.api.IBaseResource... theList) Constructor -
Method Summary
Modifier and TypeMethodDescriptionIf the results in this bundle were produced using an offset query (as opposed to a query using continuation pointers, page IDs, etc.) the page offset can be returned here.IfIBundleProvider.getCurrentPageOffset()
returns a non-null value, this method must also return the actual page size usedprotected List
<? extends org.hl7.fhir.instance.model.api.IBaseResource> getList()
Returns the results stored in this providerorg.hl7.fhir.instance.model.api.IPrimitiveType
<Date> Returns the instant as of which this result was created.List
<org.hl7.fhir.instance.model.api.IBaseResource> getResources
(int theFromIndex, int theToIndex, ResponsePage.ResponsePageBuilder theResponsePageBuilder) Load the given collection of resources by index, plus any additional resources per the server's processing rules (e.g.getUuid()
Returns the UUID associated with this search.Defaults to nullvoid
setCurrentPageOffset
(Integer theCurrentPageOffset) void
setCurrentPageSize
(Integer theCurrentPageSize) void
setPreferredPageSize
(Integer thePreferredPageSize) Sets the preferred page size to be returned bypreferredPageSize()
.void
setPublished
(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> thePublished) By default this class uses the object creation date/time (for this object) to determinethe published date
but this method may be used to specify an alternate date/timeSets the total number of results, if this provider corresponds to a single page within a larger search resultvoid
setTotalResourcesRequestedReturned
(int theAmount) size()
Returns the total number of results which match the given query (exclusive of any _include's or OperationOutcome).toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.rest.api.server.IBundleProvider
getAllResourceIds, getAllResources, getCurrentPageId, getNextPageId, getPreviousPageId, getResources, isEmpty, sizeOrThrowNpe
-
Constructor Details
-
SimpleBundleProvider
Constructor -
SimpleBundleProvider
public SimpleBundleProvider()Create an empty bundle -
SimpleBundleProvider
Constructor -
SimpleBundleProvider
Constructor- Since:
- 6.8.0
-
SimpleBundleProvider
public SimpleBundleProvider(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList, String theUuid) -
SimpleBundleProvider
Constructor that provides only a size but no actual data (useful for _count = 0)
-
-
Method Details
-
getCurrentPageOffset
Description copied from interface:IBundleProvider
If the results in this bundle were produced using an offset query (as opposed to a query using continuation pointers, page IDs, etc.) the page offset can be returned here. The server should then attempt to form paging links that use_offset
instead of opaque page IDs.- Specified by:
getCurrentPageOffset
in interfaceIBundleProvider
- Since:
- 5.5.0
-
setCurrentPageOffset
- Since:
- 5.5.0
-
getCurrentPageSize
Description copied from interface:IBundleProvider
IfIBundleProvider.getCurrentPageOffset()
returns a non-null value, this method must also return the actual page size used- Specified by:
getCurrentPageSize
in interfaceIBundleProvider
- Since:
- 5.5.0
-
setCurrentPageSize
- Since:
- 5.5.0
-
getList
Returns the results stored in this provider -
getPublished
Description copied from interface:IBundleProvider
Returns the instant as of which this result was created. The result of this value is used to populate thelastUpdated
value on search result/history result bundles.- Specified by:
getPublished
in interfaceIBundleProvider
-
setPublished
By default this class uses the object creation date/time (for this object) to determinethe published date
but this method may be used to specify an alternate date/time -
getResources
@Nonnull public List<org.hl7.fhir.instance.model.api.IBaseResource> getResources(int theFromIndex, int theToIndex, @Nonnull ResponsePage.ResponsePageBuilder theResponsePageBuilder) Description copied from 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 additional 20 resources which matched a client's _include specification.Note that if this bundle provider was loaded using a page ID (i.e. via
IPagingProvider.retrieveResultList(RequestDetails, String, String)
becauseIBundleProvider.getNextPageId()
provided a value on the previous page, then the indexes should be ignored and the whole page returned.- Specified by:
getResources
in interfaceIBundleProvider
- Parameters:
theFromIndex
- The low index (inclusive) to returntheToIndex
- The high index (exclusive) to returntheResponsePageBuilder
- The ResponsePageBuilder. The builder will add values needed for the response page.- Returns:
- A list of resources. The size of this list must be at least
theToIndex - theFromIndex
.
-
getUuid
Description copied from interface:IBundleProvider
Returns the UUID associated with this search. Note that this does not need to return a non-null value unless it a IPagingProvider is being used that requires UUIDs being returned.In other words, if you are using the default FifoMemoryPagingProvider in your server, it is fine for this method to simply return
null
since FifoMemoryPagingProvider does not use the value anyhow. On the other hand, if you are creating a custom IPagingProvider implementation you might use this method to communicate the search ID back to the provider.Note that the UUID returned by this method corresponds to the search, and not to the individual page.
- Specified by:
getUuid
in interfaceIBundleProvider
-
setTotalResourcesRequestedReturned
-
preferredPageSize
Defaults to null- Specified by:
preferredPageSize
in interfaceIBundleProvider
- Returns:
- Returns the preferred page size or
null
-
setPreferredPageSize
Sets the preferred page size to be returned bypreferredPageSize()
. Default isnull
. -
setSize
Sets the total number of results, if this provider corresponds to a single page within a larger search result -
size
Description copied from interface:IBundleProvider
Returns the total number of results which match the given query (exclusive of any _include's or OperationOutcome). May return null if the total size is not known or would be too expensive to calculate.- Specified by:
size
in interfaceIBundleProvider
-
toString
-