public interface ProductProjectionQuery extends MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>, PriceSelectionRequestDsl<ProductProjectionQuery>, LocaleSelectionRequestDsl<ProductProjectionQuery>, StoreSelectionRequestDsl<ProductProjectionQuery>
For further information how to use the query API to consult the Query API documentation.
MAX_OFFSET, MIN_OFFSET
Modifier and Type | Method and Description |
---|---|
default ProductProjectionQuery |
byProductType(Referenceable<ProductType> productType) |
default ProductProjectionQuery |
bySku(List<String> skus) |
default ProductProjectionQuery |
bySku(String sku) |
default ProductProjectionQuery |
bySlug(Locale locale,
String slug) |
static ProductProjectionQuery |
of(ProductProjectionType productProjectionType) |
static ProductProjectionQuery |
ofCurrent() |
static ProductProjectionQuery |
ofStaged() |
ProductProjectionQuery |
plusLocaleSelection(LocaleSelection localeSelection) |
ProductProjectionQuery |
plusPredicates(Function<ProductProjectionQueryModel,QueryPredicate<ProductProjection>> m)
Returns a new instance with the new predicate appended (AND semantics).
|
ProductProjectionQuery |
plusPredicates(List<QueryPredicate<ProductProjection>> queryPredicates)
Returns a new instance with the new predicate list appended to the existing predicates (AND semantic).
|
ProductProjectionQuery |
plusPredicates(QueryPredicate<ProductProjection> queryPredicate)
Returns a new instance with the new predicate appended to the existing predicates (AND semantic).
|
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<ProductProjection>> |
resultTypeReference()
Creates a container which contains the full Java type information to deserialize the query result (NOT this class) from JSON.
|
ProductProjectionQuery |
withLimit(Long limit)
Creates a new instance which a limited amount of results.
|
ProductProjectionQuery |
withLocaleSelection(LocaleSelection localeSelection) |
ProductProjectionQuery |
withOffset(Long offset)
Returns a new query with the new offset as offset.
|
ProductProjectionQuery |
withPredicates(Function<ProductProjectionQueryModel,QueryPredicate<ProductProjection>> predicateFunction)
Returns a new instance with the new predicate as only predicate.
|
ProductProjectionQuery |
withPredicates(List<QueryPredicate<ProductProjection>> queryPredicates)
Returns a new instance with the new predicate list as predicates.
|
ProductProjectionQuery |
withPredicates(QueryPredicate<ProductProjection> queryPredicate)
Returns a new instance with the new predicate as only predicate.
|
ProductProjectionQuery |
withPriceSelection(PriceSelection priceSelection)
Uses the cart price selection logic to retrieve the prices for product variants.
|
ProductProjectionQuery |
withSort(Function<ProductProjectionQueryModel,QuerySort<ProductProjection>> m)
Returns a query with the new sort as only sort parameter.
|
ProductProjectionQuery |
withSort(List<QuerySort<ProductProjection>> sort)
Returns a query with the new sort list as only sort parameters.
|
ProductProjectionQuery |
withSort(QuerySort<ProductProjection> sort)
Returns a query with the new sort as only sort parameter.
|
ProductProjectionQuery |
withSortMulti(Function<ProductProjectionQueryModel,List<QuerySort<ProductProjection>>> m)
Returns a query with the new sort list as only sort parameters.
|
ProductProjectionQuery |
withStoreSelection(StoreSelection storeSelection) |
plusPredicates, plusSort, plusSort, plusSort, plusSort, withPredicates, withQueryParam, withSort
withFetchTotal, withLimit, withOffset
endpoint, expansionPaths, fetchTotal, limit, offset, predicates, sort
deserialize, toQuery
canDeserialize, httpRequestIntent
plusExpansionPaths, withExpansionPaths
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
getPriceSelection
getLocaleSelection
getStoreSelection
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<ProductProjection>> resultTypeReference()
default ProductProjectionQuery byProductType(Referenceable<ProductType> productType)
default ProductProjectionQuery bySlug(Locale locale, String slug)
default ProductProjectionQuery bySku(String sku)
default ProductProjectionQuery bySku(List<String> skus)
static ProductProjectionQuery ofStaged()
static ProductProjectionQuery ofCurrent()
static ProductProjectionQuery of(ProductProjectionType productProjectionType)
ProductProjectionQuery withLimit(Long limit)
QueryDsl
withLimit
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
limit
- the maximum amount of items of T
which should be included in the PagedQueryResult
.PagedQueryResult.getResults()
ProductProjectionQuery withOffset(Long offset)
QueryDsl
withOffset
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
offset
- the number of items which should be omitted in the query result.ProductProjectionQuery withPredicates(List<QueryPredicate<ProductProjection>> queryPredicates)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
withPredicates
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
queryPredicates
- the new predicate listQueryDsl.plusPredicates(List)
ProductProjectionQuery withPredicates(QueryPredicate<ProductProjection> queryPredicate)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
withPredicates
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
queryPredicate
- the new predicateQueryDsl.plusPredicates(QueryPredicate)
ProductProjectionQuery withPredicates(Function<ProductProjectionQueryModel,QueryPredicate<ProductProjection>> predicateFunction)
MetaModelQueryDsl
withPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
predicateFunction
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.plusPredicates(Function)
ProductProjectionQuery plusPredicates(List<QueryPredicate<ProductProjection>> queryPredicates)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
plusPredicates
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
queryPredicates
- the new predicate listQueryDsl.withPredicates(List)
ProductProjectionQuery plusPredicates(QueryPredicate<ProductProjection> queryPredicate)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
plusPredicates
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
queryPredicate
- the new predicateQueryDsl.withPredicates(QueryPredicate)
ProductProjectionQuery plusPredicates(Function<ProductProjectionQueryModel,QueryPredicate<ProductProjection>> m)
MetaModelQueryDsl
plusPredicates
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
m
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.withPredicates(Function)
ProductProjectionQuery withSort(Function<ProductProjectionQueryModel,QuerySort<ProductProjection>> m)
MetaModelQueryDsl
withSort
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
m
- function given a meta model description of the model returns a QuerySort
MetaModelQueryDsl.plusSort(Function)
ProductProjectionQuery withSort(List<QuerySort<ProductProjection>> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
withSort
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
sort
- list of sorts how the results of the query should be sortedQueryDsl.plusSort(List)
ProductProjectionQuery withSort(QuerySort<ProductProjection> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
withSort
in interface QueryDsl<ProductProjection,ProductProjectionQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.plusSort(QuerySort)
ProductProjectionQuery withSortMulti(Function<ProductProjectionQueryModel,List<QuerySort<ProductProjection>>> m)
MetaModelQueryDsl
withSortMulti
in interface MetaModelQueryDsl<ProductProjection,ProductProjectionQuery,ProductProjectionQueryModel,ProductProjectionExpansionModel<ProductProjection>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.plusSort(List)
,
MetaModelQueryDsl.withSort(Function)
ProductProjectionQuery withPriceSelection(@Nullable PriceSelection priceSelection)
Example for selecting just a currency
final List<PriceDraft> prices = asList(PriceDraft.of(EURO_30), PriceDraft.of(USD_20)); withProductOfPrices(prices, product -> { final ProductProjectionQuery request = ProductProjectionQuery.ofStaged() .withPredicates(m -> m.id().is(product.getId()))//to limit the test scope .withPriceSelection(PriceSelection.of(EUR));//price selection config final PagedQueryResult<ProductProjection> result = client().executeBlocking(request); assertThat(result.getCount()).isEqualTo(1); final ProductVariant masterVariant = result.getResults().get(0).getMasterVariant(); assertThat(masterVariant.getPrice()).isNotNull().has(price(PriceDraft.of(EURO_30))); });
See the test code.
withPriceSelection
in interface PriceSelectionRequestDsl<ProductProjectionQuery>
priceSelection
- parameters for the price selection, using null deletes the valuesProductVariant.getPrice()
ProductProjectionQuery withLocaleSelection(@Nullable LocaleSelection localeSelection)
withLocaleSelection
in interface LocaleSelectionRequestDsl<ProductProjectionQuery>
ProductProjectionQuery plusLocaleSelection(@Nullable LocaleSelection localeSelection)
ProductProjectionQuery withStoreSelection(@Nullable StoreSelection storeSelection)
withStoreSelection
in interface StoreSelectionRequestDsl<ProductProjectionQuery>