T
- type of the search resultC
- type of the class implementing this classS
- type of the sort modelF
- type of the facet modelE
- type of the expansion modelpublic abstract class MetaModelSearchDslImpl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,S,L,F,E> extends Base implements MetaModelSearchDsl<T,C,S,L,F,E>
MAX_OFFSET, MIN_OFFSET
Constructor and Description |
---|
MetaModelSearchDslImpl(LocalizedStringEntry text,
Boolean fuzzy,
Integer fuzzyLevel,
List<FacetExpression<T>> facets,
List<FilterExpression<T>> resultFilters,
List<FilterExpression<T>> queryFilters,
List<FilterExpression<T>> facetFilters,
List<FacetedSearchExpression<T>> facetedSearch,
List<SortExpression<T>> sort,
Long limit,
Long offset,
String endpoint,
Function<HttpResponse,PagedSearchResult<T>> resultMapper,
List<ExpansionPath<T>> expansionPaths,
List<NameValuePair> additionalQueryParameters,
S sortModel,
L filterModel,
F facetModel,
E expansionModel,
Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction) |
MetaModelSearchDslImpl(MetaModelSearchDslBuilder<T,C,S,L,F,E> builder) |
MetaModelSearchDslImpl(String endpoint,
com.fasterxml.jackson.core.type.TypeReference<PagedSearchResult<T>> pagedSearchResultTypeReference,
S sortModel,
L filterModel,
F facetModel,
E expansionModel,
Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction) |
MetaModelSearchDslImpl(String endpoint,
com.fasterxml.jackson.core.type.TypeReference<PagedSearchResult<T>> pagedSearchResultTypeReference,
S sortModel,
L filterModel,
F facetModel,
E expansionModel,
Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction,
List<NameValuePair> additionalQueryParameters) |
Modifier and Type | Method and Description |
---|---|
protected List<NameValuePair> |
additionalQueryParameters() |
protected MetaModelSearchDslBuilder<T,C,S,L,F,E> |
copyBuilder() |
PagedSearchResult<T> |
deserialize(HttpResponse httpResponse)
Takes an http response and maps it into a Java object of type T.
|
String |
endpoint() |
boolean |
equals(Object o) |
List<ExpansionPath<T>> |
expansionPaths() |
List<FacetedSearchExpression<T>> |
facetedSearch() |
List<FilterExpression<T>> |
facetFilters() |
List<FacetExpression<T>> |
facets() |
Integer |
fuzzyLevel() |
int |
hashCode() |
HttpRequestIntent |
httpRequestIntent()
Provides an http request intent, this does not include the execution of it.
|
Boolean |
isFuzzy() |
Long |
limit() |
Long |
offset() |
C |
plusExpansionPaths(ExpansionPath<T> expansionPath)
Creates a new object with the properties of the old object but adds
expansionPath to the expansion paths. |
C |
plusExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
Creates a new object with the properties of the old object but adds a new expansion path to it by using meta models.
|
C |
plusExpansionPaths(List<ExpansionPath<T>> expansionPaths)
Creates a new object with the properties of the old object but adds
expansionPaths to the expansion paths. |
C |
plusExpansionPaths(String expansionPath)
Creates a new object with the properties of the old object but adds
expansionPath to the expansion paths. |
C |
plusFacetedSearch(FacetedSearchExpression<T> facetedSearchExpression)
Returns a new object with the new faceted search expression appended to the existing faceted search (combination of the query parameter
facet
with the facet expression and the query parameters filter.facet and filter with the filter expressions). |
C |
plusFacetedSearch(List<FacetedSearchExpression<T>> facetedSearchExpressions)
Returns a ResourceSearch with the new faceted search expression list appended to the existing faceted search (combination of the query parameter
facet
with the facet expression and the query parameters filter.facet and filter with the filter expressions). |
C |
plusFacetFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but adds a new filter list to the
facetFilters by using meta models. |
C |
plusFacetFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new facet filter list appended to the existing facet filters (query parameter
filter.facet ). |
C |
plusFacets(FacetExpression<T> facetExpression)
Returns a new object with the new facet expression appended to the existing facets (query parameter
facet ). |
C |
plusFacets(Function<F,FacetExpression<T>> m)
Creates a new object with the properties of the old object but adds a new facet to it by using meta models.
|
C |
plusFacets(List<FacetExpression<T>> facetExpressions)
Returns a ResourceSearch with the new facet expression list appended to the existing facets (query parameter
facet ). |
C |
plusQueryFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but adds a new filter list to the
queryFilters by using meta models. |
C |
plusQueryFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new query filter expression list appended to the existing query filters (query parameter
filter.query ). |
C |
plusResultFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but adds a new filter list to the
resultFilters by using meta models. |
C |
plusResultFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new result filter expression list appended to the existing result filters (query parameter
filter ). |
C |
plusSort(Function<S,SortExpression<T>> m)
Creates a new object with the properties of the old object but adds a new sort expression to it by using meta models.
|
C |
plusSort(List<SortExpression<T>> sortExpressions)
Returns a new object with the new sort expression list appended to the existing sort expressions.
|
C |
plusSort(SortExpression<T> sortExpression)
Returns a new object with the new sort expression list appended to the existing sort expressions.
|
List<FilterExpression<T>> |
queryFilters() |
List<FilterExpression<T>> |
resultFilters() |
List<SortExpression<T>> |
sort() |
LocalizedStringEntry |
text() |
String |
toString() |
C |
withAdditionalQueryParameter(NameValuePair pair) |
protected C |
withAdditionalQueryParameters(List<NameValuePair> pairs) |
C |
withExpansionPaths(ExpansionPath<T> expansionPath)
Creates a new object with the properties of the old object but replaces all expansion paths with a single
expansionPath . |
C |
withExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
Creates a new object with the properties of the old object but replaces all expansion paths with a single
expansionPath by using meta models. |
C |
withExpansionPaths(List<ExpansionPath<T>> expansionPaths)
Creates a new object with the properties of the old object but replaces all expansion paths with
expansionPaths . |
C |
withExpansionPaths(String expansionPath)
Creates a new object with the properties of the old object but replaces all expansion paths with a single
expansionPath . |
C |
withFacetedSearch(FacetedSearchExpression<T> facetedSearchExpression)
Returns a new object with the new faceted search expression as facets (combination of the query parameter
facet
with the facet expression and the query parameters filter.facet and filter with the filter expressions). |
C |
withFacetedSearch(List<FacetedSearchExpression<T>> facetedSearchExpressions)
Returns a new object with the new faceted search expression list as faceted search (combination of the query parameter
facet
with the facet expression and the query parameters filter.facet and filter with the filter expressions). |
C |
withFacetFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but replaces all filters with a list of filter expressions to the
facetFilters by using meta models. |
C |
withFacetFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new facet filter list as facet filter (query parameter
filter.facet ). |
C |
withFacets(FacetExpression<T> facetExpression)
Returns a new object with the new facet expression as facets (query parameter
facet ). |
C |
withFacets(Function<F,FacetExpression<T>> m)
Creates a new object with the properties of the old object but replaces all facets with a single facet expression to it by using meta models.
|
C |
withFacets(List<FacetExpression<T>> facets)
Returns a new object with the new facet expression list as facets (query parameter
facet ). |
C |
withFuzzy(Boolean fuzzy)
Returns an ResourceSearch with modified fuzzy parameter.
|
C |
withFuzzyLevel(Integer fuzzyLevel)
Returns an ResourceSearch with modified fuzzyLevel parameter.
|
C |
withLimit(Long limit)
Returns a new object with the new limit.
|
C |
withOffset(Long offset)
Returns a new object with the new offset.
|
C |
withQueryFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but replaces all filters with a list of filter expressions to the
queryFilters by using meta models. |
C |
withQueryFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new query filter expression list as query filters (query parameter
filter.query ). |
C |
withResultFilters(Function<L,List<FilterExpression<T>>> m)
Creates a new object with the properties of the old object but replaces all filters with a list of filter expressions to the
resultFilters by using meta models. |
C |
withResultFilters(List<FilterExpression<T>> filterExpressions)
Returns a new object with the new result filter expression list as result filter (query parameter
filter ). |
C |
withSort(Function<S,SortExpression<T>> m)
Creates a new object with the properties of the old object but replaces all sort expressions with a single sort expression to it by using meta models.
|
C |
withSort(List<SortExpression<T>> sortExpressions)
Returns a new object with the new sort expressions.
|
C |
withSort(SortExpression<T> sortExpression)
Returns a new object with the new sort expressions.
|
C |
withText(Locale locale,
String text)
Returns a new object with the new text as search text.
|
C |
withText(LocalizedStringEntry text)
Returns a new object with the new text as search text.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
withLimit, withOffset
canDeserialize
plusExpansionPaths, withExpansionPaths
public MetaModelSearchDslImpl(@Nullable LocalizedStringEntry text, @Nullable Boolean fuzzy, @Nullable Integer fuzzyLevel, List<FacetExpression<T>> facets, List<FilterExpression<T>> resultFilters, List<FilterExpression<T>> queryFilters, List<FilterExpression<T>> facetFilters, List<FacetedSearchExpression<T>> facetedSearch, List<SortExpression<T>> sort, @Nullable Long limit, @Nullable Long offset, String endpoint, Function<HttpResponse,PagedSearchResult<T>> resultMapper, List<ExpansionPath<T>> expansionPaths, List<NameValuePair> additionalQueryParameters, S sortModel, L filterModel, F facetModel, E expansionModel, Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction)
public MetaModelSearchDslImpl(String endpoint, com.fasterxml.jackson.core.type.TypeReference<PagedSearchResult<T>> pagedSearchResultTypeReference, S sortModel, L filterModel, F facetModel, E expansionModel, Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction, List<NameValuePair> additionalQueryParameters)
public MetaModelSearchDslImpl(String endpoint, com.fasterxml.jackson.core.type.TypeReference<PagedSearchResult<T>> pagedSearchResultTypeReference, S sortModel, L filterModel, F facetModel, E expansionModel, Function<MetaModelSearchDslBuilder<T,C,S,L,F,E>,C> searchDslBuilderFunction)
public C withText(@Nullable LocalizedStringEntry text)
SearchDsl
public C withText(Locale locale, String text)
SearchDsl
public C withFuzzy(Boolean fuzzy)
SearchDsl
public C withFuzzyLevel(Integer fuzzyLevel)
SearchDsl
final String searchWord = "abcdfgh"; final String productName = "abcdefgh"; withProduct(client(), builder -> builder.name(ofEnglish(productName)), product -> { final ProductProjectionSearch request = ProductProjectionSearch.ofStaged() .withText(ENGLISH, searchWord) .withFuzzy(true); assertEventually(() -> { softAssert(s -> { s.assertThat(client().executeBlocking(request.withFuzzyLevel(0))) .as("level 0 matches not") .doesNotHave(product()); s.assertThat(client().executeBlocking(request.withFuzzyLevel(1))) .as("level 1 matches") .has(product()); s.assertThat(client().executeBlocking(request.withFuzzyLevel(2))) .as("level 2 matches") .has(product()); }); }); });
See the test code.
public C withFacets(List<FacetExpression<T>> facets)
FacetDsl
facet
).public C withFacets(FacetExpression<T> facetExpression)
FacetDsl
facet
).public C withFacets(Function<F,FacetExpression<T>> m)
MetaModelFacetDsl
withFacets
in interface MetaModelFacetDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,F>
m
- function to use the meta model for facets to create a facet expressionpublic C plusFacets(List<FacetExpression<T>> facetExpressions)
FacetDsl
facet
).public C plusFacets(FacetExpression<T> facetExpression)
FacetDsl
facet
).public C plusFacets(Function<F,FacetExpression<T>> m)
MetaModelFacetDsl
plusFacets
in interface MetaModelFacetDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,F>
m
- function to use the meta model for facets to create a facet expressionpublic C withResultFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter
).public C withResultFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
resultFilters
by using meta models.withResultFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a list of filter expressionpublic C plusResultFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter
).public C plusResultFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
resultFilters
by using meta models.plusResultFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a filter expressionpublic C withQueryFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter.query
).public C withQueryFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
queryFilters
by using meta models.withQueryFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a list of filter expressionpublic C plusQueryFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter.query
).public C plusQueryFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
queryFilters
by using meta models.plusQueryFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a filter expressionpublic C withFacetFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter.facet
).public C withFacetFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
facetFilters
by using meta models.withFacetFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a list of filter expressionpublic C plusFacetFilters(List<FilterExpression<T>> filterExpressions)
FilterDsl
filter.facet
).public C plusFacetFilters(Function<L,List<FilterExpression<T>>> m)
MetaModelFilterDsl
facetFilters
by using meta models.plusFacetFilters
in interface MetaModelFilterDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,L>
m
- function to use the meta model for filters to create a filter expressionpublic C withFacetedSearch(List<FacetedSearchExpression<T>> facetedSearchExpressions)
FacetedSearchDsl
facet
with the facet expression and the query parameters filter.facet
and filter
with the filter expressions).
This enables the behaviour of the faceted search as explained in the documentation.withFacetedSearch
in interface FacetedSearchDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
facetedSearchExpressions
- the new faceted search expression listpublic C withFacetedSearch(FacetedSearchExpression<T> facetedSearchExpression)
FacetedSearchDsl
facet
with the facet expression and the query parameters filter.facet
and filter
with the filter expressions).
This enables the behaviour of the faceted search as explained in the documentation.withFacetedSearch
in interface FacetedSearchDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
facetedSearchExpression
- the new faceted search expressionpublic C plusFacetedSearch(List<FacetedSearchExpression<T>> facetedSearchExpressions)
FacetedSearchDsl
facet
with the facet expression and the query parameters filter.facet
and filter
with the filter expressions).
This enables the behaviour of the faceted search as explained in the documentation.plusFacetedSearch
in interface FacetedSearchDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
facetedSearchExpressions
- the new faceted search expression listpublic C plusFacetedSearch(FacetedSearchExpression<T> facetedSearchExpression)
FacetedSearchDsl
facet
with the facet expression and the query parameters filter.facet
and filter
with the filter expressions).
This enables the behaviour of the faceted search as explained in the documentation.plusFacetedSearch
in interface FacetedSearchDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
facetedSearchExpression
- the new faceted search expressionpublic C withSort(List<SortExpression<T>> sortExpressions)
SortDsl
public C withSort(SortExpression<T> sortExpression)
SortDsl
public C withSort(Function<S,SortExpression<T>> m)
MetaModelSortDsl
public C plusSort(List<SortExpression<T>> sortExpressions)
SortDsl
public C plusSort(SortExpression<T> sortExpression)
SortDsl
public C plusSort(Function<S,SortExpression<T>> m)
MetaModelSortDsl
public C withLimit(Long limit)
SearchDsl
public C withOffset(Long offset)
SearchDsl
public C withExpansionPaths(List<ExpansionPath<T>> expansionPaths)
ReferenceExpansionDsl
expansionPaths
.withExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPaths
- the new expansion pathspublic C withExpansionPaths(ExpansionPath<T> expansionPath)
ReferenceExpansionDsl
expansionPath
.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .withExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch.withExpansionPaths(ProductProjectionExpansionModel.of().productType()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged") .isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("productType"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
This method also can be used to use the same expansions as in another request:
final ProductProjectionQuery query = ProductProjectionQuery.ofCurrent().withExpansionPaths(m -> m.categories()); final ProductProjectionSearch search = ProductProjectionSearch.ofCurrent().withExpansionPaths(query); assertThat(query.expansionPaths()) .hasSize(1) .as("reuse expansion spec from other request") .isEqualTo(search.expansionPaths());
See the test code.
withExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPath
- the new expansion pathspublic C withExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
MetaModelReferenceExpansionDsl
expansionPath
by using meta models.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch.withExpansionPaths(m -> m.productType()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged") .isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("productType"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
withExpansionPaths
in interface MetaModelReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,E>
m
- function to use the meta model for expansions to create an expansion pathpublic C plusExpansionPaths(List<ExpansionPath<T>> expansionPaths)
ReferenceExpansionDsl
expansionPaths
to the expansion paths.plusExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPaths
- the new expansion paths to add to the existing onespublic C plusExpansionPaths(ExpansionPath<T> expansionPath)
ReferenceExpansionDsl
expansionPath
to the expansion paths.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT); assertThat(fetch.expansionPaths()).isEmpty(); final ProductProjectionByIdGet fetch2 = fetch.plusExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged").isEmpty(); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
plusExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPath
- the new expansion path to add to the existing onespublic C plusExpansionPaths(Function<E,ExpansionPathContainer<T>> m)
MetaModelReferenceExpansionDsl
An example in the product projection context:
final ProductProjectionByIdGet fetch1 = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(m -> m.categories()); assertThat(fetch1.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch1.plusExpansionPaths(m -> m.productType()); assertThat(fetch2.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType"))) .isEqualTo(listOf(fetch1.expansionPaths(), ExpansionPath.of("productType"))); //this is equivalent to final ExpansionPath<ProductProjection> categoryExpand = ProductProjectionExpansionModel.of().categories().expansionPaths().get(0); final ExpansionPath<ProductProjection> productTypeExpand = ProductProjectionExpansionModel.of().productType().expansionPaths().get(0); final ProductProjectionByIdGet fetchB = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .withExpansionPaths(asList(categoryExpand, productTypeExpand)); assertThat(fetchB.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType")));
See the test code.
plusExpansionPaths
in interface MetaModelReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,E>
m
- function to use the meta model for expansions to create an expansion pathpublic C withExpansionPaths(String expansionPath)
ReferenceExpansionDsl
expansionPath
.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .withExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch.withExpansionPaths(ProductProjectionExpansionModel.of().productType()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged") .isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("productType"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
This method also can be used to use the same expansions as in another request:
final ProductProjectionQuery query = ProductProjectionQuery.ofCurrent().withExpansionPaths(m -> m.categories()); final ProductProjectionSearch search = ProductProjectionSearch.ofCurrent().withExpansionPaths(query); assertThat(query.expansionPaths()) .hasSize(1) .as("reuse expansion spec from other request") .isEqualTo(search.expansionPaths());
See the test code.
withExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPath
- the new expansion pathspublic C plusExpansionPaths(String expansionPath)
ReferenceExpansionDsl
expansionPath
to the expansion paths.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT); assertThat(fetch.expansionPaths()).isEmpty(); final ProductProjectionByIdGet fetch2 = fetch.plusExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged").isEmpty(); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
plusExpansionPaths
in interface ReferenceExpansionDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>>
expansionPath
- the new expansion path to add to the existing onespublic C withAdditionalQueryParameter(NameValuePair pair)
withAdditionalQueryParameter
in interface MetaModelSearchDsl<T,C extends MetaModelSearchDsl<T,C,S,L,F,E>,S,L,F,E>
protected C withAdditionalQueryParameters(List<NameValuePair> pairs)
@Nullable public LocalizedStringEntry text()
text
in interface ResourceSearch<T>
public List<FacetExpression<T>> facets()
facets
in interface FacetSupport<T>
public List<FilterExpression<T>> resultFilters()
resultFilters
in interface FilterSupport<T>
public List<FilterExpression<T>> queryFilters()
queryFilters
in interface FilterSupport<T>
public List<FilterExpression<T>> facetFilters()
facetFilters
in interface FilterSupport<T>
public List<FacetedSearchExpression<T>> facetedSearch()
facetedSearch
in interface FacetedSearchSupport<T>
public List<SortExpression<T>> sort()
sort
in interface SortSupport<T>
@Nullable public Long limit()
limit
in interface ResourceSearch<T>
@Nullable public Long offset()
offset
in interface ResourceSearch<T>
public String endpoint()
endpoint
in interface ResourceSearch<T>
public List<ExpansionPath<T>> expansionPaths()
expansionPaths
in interface ExpansionPathContainer<T>
expansionPaths
in interface ReferenceExpansionSupport<T>
@Nullable public Boolean isFuzzy()
isFuzzy
in interface ResourceSearch<T>
@Nullable public Integer fuzzyLevel()
fuzzyLevel
in interface ResourceSearch<T>
protected List<NameValuePair> additionalQueryParameters()
public HttpRequestIntent httpRequestIntent()
SphereRequest
httpRequestIntent
in interface SphereRequest<PagedSearchResult<T>>
public PagedSearchResult<T> deserialize(HttpResponse httpResponse)
SphereRequest
SphereRequest.canDeserialize(HttpResponse)
if the response can be consumed.deserialize
in interface SphereRequest<PagedSearchResult<T>>
deserialize
in interface Search<T>
httpResponse
- the http response of the API