Class ValidatingItemSearchService
- java.lang.Object
-
- de.hybris.platform.integrationservices.search.impl.ValidatingItemSearchService
-
- All Implemented Interfaces:
ItemSearchService
public class ValidatingItemSearchService extends java.lang.Object implements ItemSearchService
This implementation validatesItemSearchRequestbefore performing a search. If request is valid, then processing is delegated toDefaultItemSearchService, otherwise the search is vetoed by throwing an exception.
-
-
Constructor Summary
Constructors Constructor Description ValidatingItemSearchService(@NotNull ItemSearchService service)Instantiates this service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountItems(ItemSearchRequest request)Counts how many items in the platform match the provided request conditions.ItemSearchResult<ItemModel>findItems(ItemSearchRequest request)Searches forItems in the platform based on the provided request criteria.java.util.Optional<ItemModel>findUniqueItem(ItemSearchRequest request)Searches for a singleItemmatching therequestcriteria.voidsetCountSearchEnrichers(@NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whencountItems(ItemSearchRequest)is called.voidsetCountSearchValidators(@NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whencountItems(ItemSearchRequest)is called.voidsetItemsSearchEnrichers(@NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whenfindItems(ItemSearchRequest)is called.voidsetItemsSearchValidators(@NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whenfindItems(ItemSearchRequest)is called.voidsetUniqueItemSearchEnrichers(@NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whenfindUniqueItem(ItemSearchRequest)is called.voidsetUniqueItemSearchValidators(@NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whenfindUniqueItem(ItemSearchRequest)is called.
-
-
-
Constructor Detail
-
ValidatingItemSearchService
public ValidatingItemSearchService(@NotNull @NotNull ItemSearchService service)Instantiates this service.- Parameters:
service- a service to delegate search to in case when no validation problems found.
-
-
Method Detail
-
findUniqueItem
public java.util.Optional<ItemModel> findUniqueItem(ItemSearchRequest request)
Description copied from interface:ItemSearchServiceSearches for a singleItemmatching therequestcriteria.- Specified by:
findUniqueItemin interfaceItemSearchService- Parameters:
request- item search request- Returns:
- an Optional containing the matching item model or an empty Optional, if a matching item is not found.
-
findItems
public ItemSearchResult<ItemModel> findItems(ItemSearchRequest request)
Description copied from interface:ItemSearchServiceSearches forItems in the platform based on the provided request criteria.- Specified by:
findItemsin interfaceItemSearchService- Parameters:
request- a request containing search conditions, i.e. type of items to find, pagination parameters, etc- Returns:
- result of the item search.
-
countItems
public int countItems(ItemSearchRequest request)
Description copied from interface:ItemSearchServiceCounts how many items in the platform match the provided request conditions.- Specified by:
countItemsin interfaceItemSearchService- Parameters:
request- a request specifying the search criteria.- Returns:
- number of items in the platform matching the search criteria.
-
setUniqueItemSearchValidators
public void setUniqueItemSearchValidators(@NotNull @NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whenfindUniqueItem(ItemSearchRequest)is called. The validators can be configured programmatically or by overridingintegrationServicesUniqueItemSearchValidatorslist definition in the Spring configuration.- Parameters:
validators- validators to use. If empty or this method is not called, thenfindUniqueItem(ItemSearchRequest)will be called unconditionally.
-
setItemsSearchValidators
public void setItemsSearchValidators(@NotNull @NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whenfindItems(ItemSearchRequest)is called. The validators can be configured programmatically or by overridingintegrationServicesItemsSearchValidatorslist definition in the Spring configuration.- Parameters:
validators- validators to use. If empty or this method is not called, thenfindItems(ItemSearchRequest)will be called unconditionally.
-
setCountSearchValidators
public void setCountSearchValidators(@NotNull @NotNull java.util.List<ItemSearchRequestValidator> validators)Provides validators to be used for validating item search requests whencountItems(ItemSearchRequest)is called. The validators can be configured programmatically or by overridingintegrationServicesCountSearchValidatorslist definition in the Spring configuration.- Parameters:
validators- validators to use. If empty or this method is not called, thencountItems(ItemSearchRequest)will be called unconditionally.
-
setUniqueItemSearchEnrichers
public void setUniqueItemSearchEnrichers(@NotNull @NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whenfindUniqueItem(ItemSearchRequest)is called. The enrichers can be configured programmatically or by overridingintegrationServicesUniqueItemSearchEnricherslist definition in the Spring configuration.- Parameters:
enrichers- enrichers to use. If empty or this method is not called, thenfindUniqueItem(ItemSearchRequest)will be called unconditionally.
-
setItemsSearchEnrichers
public void setItemsSearchEnrichers(@NotNull @NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whenfindItems(ItemSearchRequest)is called. The enrichers can be configured programmatically or by overridingintegrationServicesItemsSearchEnricherslist definition in the Spring configuration.- Parameters:
enrichers- enrichers to use. If empty or this method is not called, thenfindItems(ItemSearchRequest)will be called unconditionally.
-
setCountSearchEnrichers
public void setCountSearchEnrichers(@NotNull @NotNull java.util.List<ItemSearchRequestEnricher> enrichers)Provides enrichers to be used for enriching item search requests whencountItems(ItemSearchRequest)is called. The enrichers can be configured programmatically or by overridingintegrationServicesCountSearchEnricherslist definition in the Spring configuration.- Parameters:
enrichers- enrichers to use. If empty or this method is not called, thencountItems(ItemSearchRequest)will be called unconditionally.
-
-