Class QueryUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <TMethod extends SimplePagedQueryResourceRequest<TMethod,
TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>>
CompletionStage<Void>queryAll
(SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, Consumer<List<TElement>> pageConsumer) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and a page size 500.static <TMethod extends SimplePagedQueryResourceRequest<TMethod,
TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>>
CompletionStage<Void>queryAll
(SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, Consumer<List<TElement>> pageConsumer, int pageSize) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and the suppliedpageSize
.static <TMethod extends SimplePagedQueryResourceRequest<TMethod,
TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>, S>
CompletionStage<List<S>>queryAll
(SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, Function<List<TElement>, S> pageMapper) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and a page size 500.static <TMethod extends SimplePagedQueryResourceRequest<TMethod,
TResult, ?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>, S>
CompletionStage<List<S>>queryAll
(SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, Function<List<TElement>, S> pageMapper, int pageSize) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and the suppliedpageSize
.
-
Constructor Details
-
QueryUtils
public QueryUtils()
-
-
Method Details
-
queryAll
@Nonnull public static <TMethod extends SimplePagedQueryResourceRequest<TMethod,TResult, CompletionStage<List<S>> queryAll?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>, S> (@Nonnull SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, @Nonnull Function<List<TElement>, S> pageMapper) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and a page size 500. More on the algorithm can be found here: Iterating all elements.
The method takes a callback
Function
that returns a result of type<S>
that is returned on every page of elements queried. Eventually, the method returns aCompletionStage
that contains a list of all the results of the callbacks returned from every page.NOTE: This method fetches all paged results sequentially as opposed to fetching the pages in parallel.
- Type Parameters:
TElement
- type of one query result elementTMethod
- type of the queryTResult
- type of the resultS
- type of the returned result of the callback function on every page.- Parameters:
query
- query containing predicates and expansion pathspageMapper
- callback function that is called on every page queried- Returns:
- a completion stage containing a list of mapped pages as a result.
-
queryAll
@Nonnull public static <TMethod extends SimplePagedQueryResourceRequest<TMethod,TResult, CompletionStage<Void> queryAll?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>> (@Nonnull SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, @Nonnull Consumer<List<TElement>> pageConsumer) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and a page size 500. More on the algorithm can be found here: Iterating all elements.
The method takes a consumer
Consumer
that is applied on every page of elements queried.NOTE: This method fetches all paged results sequentially as opposed to fetching the pages in parallel.
- Type Parameters:
TElement
- type of one query result elementTMethod
- type of the queryTResult
- type of the result- Parameters:
query
- query containing predicates and expansion pathspageConsumer
- consumer applied on every page queried- Returns:
- a completion stage containing void as a result after the consumer was applied on all pages.
-
queryAll
@Nonnull public static <TMethod extends SimplePagedQueryResourceRequest<TMethod,TResult, CompletionStage<List<S>> queryAll?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>, S> (@Nonnull SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, @Nonnull Function<List<TElement>, S> pageMapper, int pageSize) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and the supplied
pageSize
. More on the algorithm can be found here: Iterating all elements.The method takes a callback
Function
that returns a result of type<S>
that is returned on every page of elements queried. Eventually, the method returns aCompletionStage
that contains a list of all the results of the callbacks returned from every page.NOTE: This method fetches all paged results sequentially as opposed to fetching the pages in parallel.
- Type Parameters:
TElement
- type of one query result elementTMethod
- type of the queryTResult
- type of the resultS
- type of the returned result of the callback function on every page.- Parameters:
query
- query containing predicates and expansion pathspageMapper
- callback function that is called on every page queriedpageSize
- the page size.- Returns:
- a completion stage containing a list of mapped pages as a result.
-
queryAll
@Nonnull public static <TMethod extends SimplePagedQueryResourceRequest<TMethod,TResult, CompletionStage<Void> queryAll?>, TResult extends ResourcePagedQueryResponse<TElement>, TElement extends DomainResource<TElement>> (@Nonnull SimplePagedQueryResourceRequest<TMethod, TResult, ?> query, @Nonnull Consumer<List<TElement>> pageConsumer, int pageSize) Queries all elements matching a query by using a limit based pagination with a combination of id sorting and the supplied
pageSize
. More on the algorithm can be found here: Iterating all elements.The method takes a
Consumer
that is applied on every page of the queried elements.NOTE: This method fetches all paged results sequentially as opposed to fetching the pages in parallel.
- Type Parameters:
TElement
- type of one query result elementTMethod
- type of the queryTResult
- type of the result- Parameters:
query
- query containing predicates and expansion pathspageConsumer
- consumer applied on every page queriedpageSize
- the page size- Returns:
- a completion stage containing void as a result after the consumer was applied on all pages.
-