Class ExternalCatalogProvider
java.lang.Object
com.broadleafcommerce.datafeed.service.collector.provider.ExternalCatalogProvider
- All Implemented Interfaces:
- CatalogProvider
Default implementation of 
CatalogProvider.- Author:
- Kelly Tisdell (ktisdell)
- 
Constructor SummaryConstructorsConstructorDescriptionExternalCatalogProvider(org.springframework.web.reactive.function.client.WebClient webClient, CatalogProviderProperties catalogProviderProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProviderUtil providerUtil) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddProductConsolidationConfigurationParams(org.springframework.web.util.UriBuilder uriBuilder) Adds the request parameters to configure the product consolidation request.protected StringbuildReadBatchOfProductIdsUriForFullFeed(String startId, int batchSize, String rsql) protected StringbuildReadBatchOfProductsUri(@NonNull List<String> ids) Builds a catalog fetch URI with a filter containing a range of IDs of products to retrieve from catalog.protected <T> reactor.core.publisher.Mono<T>customizeReadIdBatchForFullFeedMono(reactor.core.publisher.Mono<T> mono) protected <T> reactor.core.publisher.Mono<T>customizeReadIdBatchForPartialFeedMono(reactor.core.publisher.Mono<T> mono) protected <T> reactor.core.publisher.Mono<T>customizeReadProductsMono(reactor.core.publisher.Mono<T> mono) protected List<CollectedProduct>deserializeBatchOfProductsResponse(List<com.fasterxml.jackson.databind.node.ObjectNode> productJsonObjects) protected CollectedProductdeserializeProduct(com.fasterxml.jackson.databind.node.ObjectNode productJson) Deserializes anObjectNodeintoCollectedProduct.protected CatalogProviderPropertiesprotected com.fasterxml.jackson.databind.ObjectMapperprotected ProviderUtilprotected com.broadleafcommerce.common.extension.TypeFactoryprotected org.springframework.web.reactive.function.client.WebClientreadIdBatchForFullFeed(String cursor, int batchSize, String filterString, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads a batch of Product IDs, in ascending order, starting at the cursor.readIdBatchForPartialFeed(@NonNull List<IncrementalDataFeedEntityUpdateRecord> updateRecords, String filterString, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Given a batch ofIncrementalDataFeedEntityUpdateRecords, fetch Product IDs that correspond.readProducts(@NonNull List<String> idBatch, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Reads a batch ofCollectedProductsfrom the batch of provided IDs.
- 
Constructor Details- 
ExternalCatalogProviderpublic ExternalCatalogProvider(org.springframework.web.reactive.function.client.WebClient webClient, CatalogProviderProperties catalogProviderProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProviderUtil providerUtil) 
 
- 
- 
Method Details- 
readIdBatchForPartialFeedpublic List<String> readIdBatchForPartialFeed(@NonNull @NonNull List<IncrementalDataFeedEntityUpdateRecord> updateRecords, @Nullable String filterString, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Description copied from interface:CatalogProviderGiven a batch ofIncrementalDataFeedEntityUpdateRecords, fetch Product IDs that correspond.- Specified by:
- readIdBatchForPartialFeedin interface- CatalogProvider
- Parameters:
- updateRecords- a list of records with references to products and their IDs
- filterString- a RSQL filter string, or null
- readContextInfo- the- ContextInfofor reading the IDs
- Returns:
 
- 
customizeReadIdBatchForPartialFeedMonoprotected <T> reactor.core.publisher.Mono<T> customizeReadIdBatchForPartialFeedMono(reactor.core.publisher.Mono<T> mono) 
- 
readIdBatchForFullFeedpublic List<String> readIdBatchForFullFeed(@Nullable String cursor, int batchSize, @Nullable String filterString, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CatalogProviderReads a batch of Product IDs, in ascending order, starting at the cursor.- Specified by:
- readIdBatchForFullFeedin interface- CatalogProvider
- Parameters:
- cursor- the last ID fetched, or null
- batchSize- the number of IDs to fetch in a batch
- filterString- a RSQL filter string, or null
- contextInfo- the- ContextInfofor reading the IDs
- Returns:
 
- 
customizeReadIdBatchForFullFeedMonoprotected <T> reactor.core.publisher.Mono<T> customizeReadIdBatchForFullFeedMono(reactor.core.publisher.Mono<T> mono) 
- 
readProductspublic List<CollectedProduct> readProducts(@NonNull @NonNull List<String> idBatch, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Description copied from interface:CatalogProviderReads a batch ofCollectedProductsfrom the batch of provided IDs.- Specified by:
- readProductsin interface- CatalogProvider
- Parameters:
- idBatch- batch of IDs for which to fetch products
- readContextInfo- contextInfo the- ContextInfofor reading the IDs
- Returns:
 
- 
customizeReadProductsMonoprotected <T> reactor.core.publisher.Mono<T> customizeReadProductsMono(reactor.core.publisher.Mono<T> mono) 
- 
buildReadBatchOfProductIdsUriForFullFeed
- 
buildReadBatchOfProductsUriBuilds a catalog fetch URI with a filter containing a range of IDs of products to retrieve from catalog.- Parameters:
- ids- The list of ids
- Returns:
- A URI for retrieving a list of products from catalog.
 
- 
addProductConsolidationConfigurationParamsprotected void addProductConsolidationConfigurationParams(org.springframework.web.util.UriBuilder uriBuilder) Adds the request parameters to configure the product consolidation request.- Parameters:
- uriBuilder- the- UriBuilderto add the request parameters for
 
- 
deserializeBatchOfProductsResponseprotected List<CollectedProduct> deserializeBatchOfProductsResponse(@Nullable List<com.fasterxml.jackson.databind.node.ObjectNode> productJsonObjects) 
- 
deserializeProductprotected CollectedProduct deserializeProduct(com.fasterxml.jackson.databind.node.ObjectNode productJson) Deserializes anObjectNodeintoCollectedProduct.This manual process is necessary, as at the time of writing, concepts like JsonAnySetterandJsonAnyGetterdo not fully supportObjectNode. Thus, we first read JSON asObjectNodedirectly, then manually parse out specific properties we want to promote as first-class fields.- Parameters:
- productJson- the- ObjectNoderepresenting the product JSON
- Returns:
- a CollectedProductrepresentation of the input
 
- 
getWebClientprotected org.springframework.web.reactive.function.client.WebClient getWebClient()
- 
getCatalogProviderProperties
- 
getObjectMapperprotected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
- 
getTypeFactoryprotected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
- 
getProviderUtil
 
-