Class SimpleBundleProvider
- java.lang.Object
-
- ca.uhn.fhir.rest.server.SimpleBundleProvider
-
- All Implemented Interfaces:
IBundleProvider
- Direct Known Subclasses:
BundleProviderWithNamedPages
public class SimpleBundleProvider extends Object implements IBundleProvider
-
-
Constructor Summary
Constructors Constructor Description SimpleBundleProvider()Create an empty bundleSimpleBundleProvider(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList)SimpleBundleProvider(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList, String theUuid)SimpleBundleProvider(org.hl7.fhir.instance.model.api.IBaseResource theResource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<? extends org.hl7.fhir.instance.model.api.IBaseResource>getList()Returns the results stored in this providerorg.hl7.fhir.instance.model.api.IPrimitiveType<Date>getPublished()Returns the instant as of which this result was created.List<org.hl7.fhir.instance.model.api.IBaseResource>getResources(int theFromIndex, int theToIndex)Load the given collection of resources by index, plus any additional resources per the server's processing rules (e.g.StringgetUuid()Returns the UUID associated with this search.IntegerpreferredPageSize()Defaults to nullvoidsetPreferredPageSize(Integer thePreferredPageSize)Sets the preferred page size to be returned bypreferredPageSize().voidsetPublished(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 datebut this method may be used to specify an alternate date/timeSimpleBundleProvidersetSize(Integer theSize)Sets the total number of results, if this provider corresponds to a single page within a larger search resultIntegersize()Returns the total number of results which match the given query (exclusive of any _include's or OperationOutcome).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.uhn.fhir.rest.api.server.IBundleProvider
getCurrentPageId, getNextPageId, getPreviousPageId, isEmpty
-
-
-
-
Constructor Detail
-
SimpleBundleProvider
public SimpleBundleProvider(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList)
-
SimpleBundleProvider
public SimpleBundleProvider(org.hl7.fhir.instance.model.api.IBaseResource theResource)
-
SimpleBundleProvider
public SimpleBundleProvider()
Create an empty bundle
-
SimpleBundleProvider
public SimpleBundleProvider(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList, String theUuid)
-
-
Method Detail
-
getList
protected List<? extends org.hl7.fhir.instance.model.api.IBaseResource> getList()
Returns the results stored in this provider
-
getPublished
public org.hl7.fhir.instance.model.api.IPrimitiveType<Date> getPublished()
Description copied from interface:IBundleProviderReturns the instant as of which this result was created. The result of this value is used to populate thelastUpdatedvalue on search result/history result bundles.- Specified by:
getPublishedin interfaceIBundleProvider
-
setPublished
public 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 datebut 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)
Description copied from interface:IBundleProviderLoad 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:
getResourcesin interfaceIBundleProvider- Parameters:
theFromIndex- The low index (inclusive) to returntheToIndex- The high index (exclusive) to return- Returns:
- A list of resources. The size of this list must be at least
theToIndex - theFromIndex.
-
getUuid
public String getUuid()
Description copied from interface:IBundleProviderReturns 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
nullsince 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:
getUuidin interfaceIBundleProvider
-
preferredPageSize
public Integer preferredPageSize()
Defaults to null- Specified by:
preferredPageSizein interfaceIBundleProvider- Returns:
- Returns the preferred page size or
null
-
setPreferredPageSize
public void setPreferredPageSize(Integer thePreferredPageSize)
Sets the preferred page size to be returned bypreferredPageSize(). Default isnull.
-
setSize
public SimpleBundleProvider setSize(Integer theSize)
Sets the total number of results, if this provider corresponds to a single page within a larger search result
-
size
public Integer size()
Description copied from interface:IBundleProviderReturns 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:
sizein interfaceIBundleProvider
-
-