Class SimpleBundleProvider

    • Constructor Detail

      • SimpleBundleProvider

        public SimpleBundleProvider​(org.hl7.fhir.instance.model.api.IBaseResource theResource)
        Constructor
      • SimpleBundleProvider

        public SimpleBundleProvider​(List<? extends org.hl7.fhir.instance.model.api.IBaseResource> theList)
        Constructor
      • SimpleBundleProvider

        public SimpleBundleProvider​(int theSize)
        Constructor that provides only a size but no actual data (useful for _count = 0)
    • Method Detail

      • getCurrentPageOffset

        public Integer 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 interface IBundleProvider
        Since:
        5.5.0
      • 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<DategetPublished()
        Description copied from interface: IBundleProvider
        Returns the instant as of which this result was created. The result of this value is used to populate the lastUpdated value on search result/history result bundles.
        Specified by:
        getPublished in interface IBundleProvider
      • 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 determine the 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)
        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) because IBundleProvider.getNextPageId() provided a value on the previous page, then the indexes should be ignored and the whole page returned.

        Specified by:
        getResources in interface IBundleProvider
        Parameters:
        theFromIndex - The low index (inclusive) to return
        theToIndex - 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: 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 interface IBundleProvider
      • 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: 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 interface IBundleProvider