public final class CtpQueryUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T extends GraphQlBaseResult<U>,U extends GraphQlBaseResource> |
queryAll(io.sphere.sdk.client.SphereClient client,
GraphQlBaseRequest<T> graphQlRequest,
java.util.function.Consumer<java.util.Set<U>> pageConsumer)
Creates a graphQL query to fetch all elements where keys matching given set of keys with
pagination using a combination of limit and id sorting.
|
static <T extends GraphQlBaseResult<U>,U extends GraphQlBaseResource> |
queryAll(io.sphere.sdk.client.SphereClient client,
GraphQlBaseRequest<T> graphQlRequest,
java.util.function.Consumer<java.util.Set<U>> pageConsumer,
int pageSize)
Creates a graphQL query to fetch all elements where keys matching given set of keys with
pagination using a combination of limit and id sorting.
|
static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>> |
queryAll(io.sphere.sdk.client.SphereClient client,
io.sphere.sdk.queries.QueryDsl<T,C> query,
java.util.function.Consumer<java.util.List<T>> 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 <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>> |
queryAll(io.sphere.sdk.client.SphereClient client,
io.sphere.sdk.queries.QueryDsl<T,C> query,
java.util.function.Consumer<java.util.List<T>> 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 . |
static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>,S> |
queryAll(io.sphere.sdk.client.SphereClient client,
io.sphere.sdk.queries.QueryDsl<T,C> query,
java.util.function.Function<java.util.List<T>,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 <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>,S> |
queryAll(io.sphere.sdk.client.SphereClient client,
io.sphere.sdk.queries.QueryDsl<T,C> query,
java.util.function.Function<java.util.List<T>,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 . |
@Nonnull public static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>,S> java.util.concurrent.CompletionStage<java.util.List<S>> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull io.sphere.sdk.queries.QueryDsl<T,C> query, @Nonnull java.util.function.Function<java.util.List<T>,S> pageMapper)
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 a CompletionStage
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.
T
- type of one query result elementC
- type of the queryS
- type of the returned result of the callback function on every page.client
- commercetools clientquery
- query containing predicates and expansion pathspageMapper
- callback function that is called on every page queried@Nonnull public static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>> java.util.concurrent.CompletionStage<java.lang.Void> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull io.sphere.sdk.queries.QueryDsl<T,C> query, @Nonnull java.util.function.Consumer<java.util.List<T>> pageConsumer)
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.
T
- type of one query result elementC
- type of the queryclient
- commercetools clientquery
- query containing predicates and expansion pathspageConsumer
- consumer applied on every page queried@Nonnull public static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>,S> java.util.concurrent.CompletionStage<java.util.List<S>> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull io.sphere.sdk.queries.QueryDsl<T,C> query, @Nonnull java.util.function.Function<java.util.List<T>,S> pageMapper, int pageSize)
pageSize
. More on the algorithm can be found here:
http://dev.commercetools.com/http-api.html#offset.
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 a CompletionStage
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.
T
- type of one query result elementC
- type of the queryS
- type of the returned result of the callback function on every page.client
- commercetools clientquery
- query containing predicates and expansion pathspageMapper
- callback function that is called on every page queriedpageSize
- the page size.@Nonnull public static <T extends io.sphere.sdk.models.ResourceView,C extends io.sphere.sdk.queries.QueryDsl<T,C>> java.util.concurrent.CompletionStage<java.lang.Void> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull io.sphere.sdk.queries.QueryDsl<T,C> query, @Nonnull java.util.function.Consumer<java.util.List<T>> pageConsumer, int pageSize)
pageSize
. More on the algorithm can be found here:
http://dev.commercetools.com/http-api.html#offset
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.
T
- type of one query result elementC
- type of the queryclient
- commercetools clientquery
- query containing predicates and expansion pathspageConsumer
- consumer applied on every page queriedpageSize
- the page size@Nonnull public static <T extends GraphQlBaseResult<U>,U extends GraphQlBaseResource> java.util.concurrent.CompletionStage<java.lang.Void> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull GraphQlBaseRequest<T> graphQlRequest, @Nonnull java.util.function.Consumer<java.util.Set<U>> pageConsumer, int pageSize)
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.
T
- the result type which extends GraphQlBaseResult
U
- the resource type which extends GraphQlBaseResource
client
- commercetools clientgraphQlRequest
- graphql query containing predicates and pagination limitspageConsumer
- consumer applied on every page queriedpageSize
- the page size.@Nonnull public static <T extends GraphQlBaseResult<U>,U extends GraphQlBaseResource> java.util.concurrent.CompletionStage<java.lang.Void> queryAll(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull GraphQlBaseRequest<T> graphQlRequest, @Nonnull java.util.function.Consumer<java.util.Set<U>> pageConsumer)
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.
T
- the result type which extends GraphQlBaseResult
U
- the resource type which extends GraphQlBaseResource
client
- commercetools clientgraphQlRequest
- graphql query containing predicates and pagination limitspageConsumer
- consumer applied on every page queried