Interface IBundleProvider

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default String getCurrentPageId()
      If this method is implemented, provides an ID for the current page of results.
      default String getNextPageId()
      If this method is implemented, provides an ID for the next page of results.
      default String getPreviousPageId()
      If this method is implemented, provides an ID for the previous page of results.
      org.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.
      String getUuid()
      Returns the UUID associated with this search.
      default boolean isEmpty()
      This method returns true if the bundle provider knows that at least one result exists.
      Integer preferredPageSize()
      Optionally may be used to signal a preferred page size to the server, e.g.
      Integer size()
      Returns the total number of results which match the given query (exclusive of any _include's or OperationOutcome).
      default int sizeOrThrowNpe()
      Returns the value of size() and throws a NullPointerException of it is null
    • Method Detail

      • getCurrentPageId

        default String getCurrentPageId()
        If this method is implemented, provides an ID for the current page of results. This ID should be unique (at least within the current search as identified by getUuid()) so that it can be used to look up a specific page of results.

        This can be used in order to allow the server paging mechanism to work using completely opaque links (links that do not encode any index/offset information), which can be useful on some servers.

        Since:
        3.5.0
      • getNextPageId

        default String getNextPageId()
        If this method is implemented, provides an ID for the next page of results. This ID should be unique (at least within the current search as identified by getUuid()) so that it can be used to look up a specific page of results.

        This can be used in order to allow the server paging mechanism to work using completely opaque links (links that do not encode any index/offset information), which can be useful on some servers.

        Since:
        3.5.0
      • getPreviousPageId

        default String getPreviousPageId()
        If this method is implemented, provides an ID for the previous page of results. This ID should be unique (at least within the current search as identified by getUuid()) so that it can be used to look up a specific page of results.

        This can be used in order to allow the server paging mechanism to work using completely opaque links (links that do not encode any index/offset information), which can be useful on some servers.

        Since:
        3.5.0
      • getPublished

        org.hl7.fhir.instance.model.api.IPrimitiveType<DategetPublished()
        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.
      • getResources

        @Nonnull
        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. _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 getNextPageId() provided a value on the previous page, then the indexes should be ignored and the whole page returned.

        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

        @Nullable
        String getUuid()
        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.

      • preferredPageSize

        Integer preferredPageSize()
        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 implementation are expensive to load so a smaller page size should be used. The value returned by this method will only be used if the client has not explicitly requested a page size.
        Returns:
        Returns the preferred page size or null
      • size

        @Nullable
        Integer size()
        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.
      • isEmpty

        default boolean isEmpty()
        This method returns true if the bundle provider knows that at least one result exists.