Class DefaultCatalogService
java.lang.Object
com.broadleafcommerce.search.index.catalog.service.DefaultCatalogService
- All Implemented Interfaces:
CatalogService,org.springframework.beans.factory.InitializingBean
public class DefaultCatalogService
extends Object
implements CatalogService, org.springframework.beans.factory.InitializingBean
Default implementation to read
products from the Catalog Service.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCatalogService(org.springframework.web.reactive.function.client.WebClient webClient, String catalogEndpoint, String readProductIdsPath, String readProductsPath) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBatchProductIdFilter(org.springframework.web.util.UriBuilder uriBuilder, List<String> ids) protected voidaddProductConsolidationConfigurationParams(org.springframework.web.util.UriBuilder uriBuilder) Adds the request parameters to configure the product consolidation request.voidprotected cz.jirutka.rsql.parser.ast.NodebuildBatchProductIdsFilters(String startId, Map<String, Object> additionalProperties) protected StringbuildReadBatchOfProductIdsUri(String startId, int batchSize) Deprecated.in favor ofbuildReadBatchOfProductIdsUri(String, int, Map<String, Object>)for the potential to utilize a time range when reading products.protected StringbuildReadBatchOfProductIdsUri(String startId, int batchSize, Map<String, Object> additionalProperties) Build the product id URI based on the provided parameters.protected StringBuilds a catalog fetch URI with a filter containing a range of IDs of products to retrieve from catalog.protected Stringprotected org.springframework.web.reactive.function.client.WebClientprotected com.broadleafcommerce.data.tracking.core.interlink.InterlinkClientprotected com.broadleafcommerce.data.tracking.core.interlink.InterlinkWebClientprotected com.fasterxml.jackson.databind.ObjectMapperprotected Objectprotected CatalogIndexerServicePropertiesprotected Stringprotected StringThe service client to use when calling catalog.readBatchOfProductIds(String startId, int batchSize) readBatchOfProductIds(String startId, int batchSize, Map<String, Object> additionalProperties) Reads a batch of IDs to be placed in a queue for processing.List<com.broadleafcommerce.search.catalog.core.domain.Product>Reads a batch ofProductsby an id.List<com.broadleafcommerce.search.catalog.core.domain.Product>readBatchOfProducts(List<String> ids) Reads a batch ofProductsby their IDs.voidsetIndexerWebClient(org.springframework.web.reactive.function.client.WebClient indexerWebClient) voidsetInterlinkClient(com.broadleafcommerce.data.tracking.core.interlink.InterlinkClient interlinkClient) voidsetInterlinkWebClient(com.broadleafcommerce.data.tracking.core.interlink.InterlinkWebClient interlinkWebClient) voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) voidsetProductConsolidationRequest(Object productConsolidationRequest) voidsetProperties(CatalogIndexerServiceProperties properties) voidsetServiceClient(String serviceClient) The service client to use when calling catalog.
-
Field Details
-
RSQL_FILTER_PARAM
- See Also:
-
SIZE_QUERY_PARAM
- See Also:
-
SORT_QUERY_PARAM
- See Also:
-
ID_IN_QUERY_PARAM
- See Also:
-
CONTEXT_ID
- See Also:
-
CONFIGURABLE_PARAM
- See Also:
-
INCLUDE_ALL_PRODUCT_ASSETS_PARAM
- See Also:
-
READ_ALL_PRODUCTS_IGNORE_NARROWING_HYDRATED_WITH_CONFIGURATION
- See Also:
-
READ_ALL_PRODUCT_IDS_IGNORE_NARROWING
- See Also:
-
-
Constructor Details
-
DefaultCatalogService
@Deprecated(since="2.3.0-GA") public DefaultCatalogService(org.springframework.web.reactive.function.client.WebClient webClient, String catalogEndpoint, String readProductIdsPath, String readProductsPath) Deprecated.in favor ofDefaultCatalogService() -
DefaultCatalogService
public DefaultCatalogService()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
readBatchOfProductIds
public List<String> readBatchOfProductIds(@Nullable String startId, int batchSize) throws com.broadleafcommerce.search.api.SearchIndexException - Specified by:
readBatchOfProductIdsin interfaceCatalogService- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
readBatchOfProductIds
public List<String> readBatchOfProductIds(String startId, int batchSize, @Nullable Map<String, Object> additionalProperties) throws com.broadleafcommerce.search.api.SearchIndexExceptionDescription copied from interface:CatalogServiceReads a batch of IDs to be placed in a queue for processing.- Specified by:
readBatchOfProductIdsin interfaceCatalogService- Parameters:
startId- The starting IDbatchSize- The size of the batch to readadditionalProperties- additional information that can be used to filter the items to be indexed- Returns:
- A list of product IDs.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException
-
readBatchOfProducts
public List<com.broadleafcommerce.search.catalog.core.domain.Product> readBatchOfProducts(List<String> ids) throws com.broadleafcommerce.search.api.SearchIndexException Description copied from interface:CatalogServiceReads a batch ofProductsby their IDs.- Specified by:
readBatchOfProductsin interfaceCatalogService- Parameters:
ids- A list of product IDs.- Returns:
- A list of products or an empty list.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if the service call fails for any reason.
-
readBatchOfProducts
public List<com.broadleafcommerce.search.catalog.core.domain.Product> readBatchOfProducts(String id) throws com.broadleafcommerce.search.api.SearchIndexException Description copied from interface:CatalogServiceReads a batch ofProductsby an id.- Specified by:
readBatchOfProductsin interfaceCatalogService- Parameters:
id- A product ID.- Returns:
- A list of products or an empty list.
- Throws:
com.broadleafcommerce.search.api.SearchIndexException- if the service call fails for any reason.
-
buildReadBatchOfProductIdsUri
@Deprecated(since="2.1.5-GA") protected String buildReadBatchOfProductIdsUri(@Nullable String startId, int batchSize) Deprecated.in favor ofbuildReadBatchOfProductIdsUri(String, int, Map<String, Object>)for the potential to utilize a time range when reading products. -
buildReadBatchOfProductIdsUri
protected String buildReadBatchOfProductIdsUri(@Nullable String startId, int batchSize, @Nullable Map<String, Object> additionalProperties) Build the product id URI based on the provided parameters.- Parameters:
startId- The starting IDbatchSize- The size of the batchadditionalProperties- additional information that can be used to filter the items to be indexed- Returns:
- the built uri
-
buildReadBatchOfProductsUri
Builds a catalog fetch URI with a filter containing a range of IDs of products to retrieve from catalog.e.g. id=ge=1;id=le=10
The List of ids passed into this method should be in ascending order.
- Parameters:
ids- The list of ids- Returns:
- A URI for retrieving a list of products from catalog.
-
addProductConsolidationConfigurationParams
protected void addProductConsolidationConfigurationParams(org.springframework.web.util.UriBuilder uriBuilder) Adds the request parameters to configure the product consolidation request.- Parameters:
uriBuilder- theUriBuilderto add the request parameters for
-
addBatchProductIdFilter
-
buildBatchProductIdsFilters
-
getCatalogEndpoint
-
getReadProductIdsPath
-
getReadProductsPath
-
getInterlinkClient
protected com.broadleafcommerce.data.tracking.core.interlink.InterlinkClient getInterlinkClient() -
setInterlinkClient
@Autowired public void setInterlinkClient(com.broadleafcommerce.data.tracking.core.interlink.InterlinkClient interlinkClient) -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
setObjectMapper
@Autowired public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
getProductConsolidationRequest
-
setProductConsolidationRequest
@Autowired(required=false) @Qualifier("productConsolidationRequest") public void setProductConsolidationRequest(Object productConsolidationRequest) -
getInterlinkWebClient
protected com.broadleafcommerce.data.tracking.core.interlink.InterlinkWebClient getInterlinkWebClient() -
setInterlinkWebClient
@Autowired public void setInterlinkWebClient(com.broadleafcommerce.data.tracking.core.interlink.InterlinkWebClient interlinkWebClient) -
getProperties
-
setProperties
-
getIndexerWebClient
protected org.springframework.web.reactive.function.client.WebClient getIndexerWebClient() -
setIndexerWebClient
public void setIndexerWebClient(org.springframework.web.reactive.function.client.WebClient indexerWebClient) -
getServiceClient
The service client to use when calling catalog. Default is "indexerclient". -
setServiceClient
The service client to use when calling catalog. Default is "indexerclient".
-
DefaultCatalogService()