Class ProductDataFeedCollector<E extends CollectedProduct>
java.lang.Object
com.broadleafcommerce.datafeed.service.collector.AbstractJsonArrayDataFeedCollector<String,E>
 
com.broadleafcommerce.datafeed.service.collector.product.ProductDataFeedCollector<E>
- All Implemented Interfaces:
- DataFeedCollector
public class ProductDataFeedCollector<E extends CollectedProduct>
extends AbstractJsonArrayDataFeedCollector<String,E> 
Handles gathering and storing a Product data feed to be transformed and published.
- Author:
- Kelly Tisdell
- 
Constructor SummaryConstructorsConstructorDescriptionProductDataFeedCollector(com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> incrementalDataFeedEntityUpdateRecordService, List<CollectedEntityContributor> collectedEntityContributors, ProductDataFeedCollectorProperties productDataFeedCollectorProperties, CatalogProvider externalCatalogProvider) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanHandle(DataFeedCollectionRequest request) Indicates if thisDataFeedCollectorcan handle this type ofDataFeedProcessExecution, presumably because of an entity type or other feed type indicator.protected CatalogProviderprotected ProductDataFeedCollectorPropertiespostProcess(@NonNull DataFeedCollectionRequest request, @NonNull List<E> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Hook point to allow implementors to modify the Product list prior to returning to be written to a file.readDataFeedRecords(@NonNull DataFeedCollectionRequest request, @NonNull List<String> idBatch, @NonNull Map<String, Object> collectorProcessState, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) readIdBatchForFullFeed(@NonNull DataFeedCollectionRequest request, @NonNull Map<String, Object> collectorProcessState, int batchSize, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Returns aListthat provides a batch of IDs, sorted in ascending order.readIdBatchForPartialFeed(DataFeedCollectionRequest collectionRequest, @NonNull List<IncrementalDataFeedEntityUpdateRecord> updateRecords, @NonNull Map<String, Object> sharedProcessState, com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Given a list ofIncrementalDataFeedEntityUpdateRecords, we need to determine the Product IDs.Methods inherited from class com.broadleafcommerce.datafeed.service.collector.AbstractJsonArrayDataFeedCollectorbuildContextInfo, createEmptyLocalCollectedDataFile, executeContributors, getBatchSize, getCollectedEntityContributors, getIdBatchSize, getIncrementalDataFeedEntityUpdateRecordService, getObjectMapper, getRsqlParser, getTypeFactory, getWorkerThreads, handle, isIdDuplicateIncrementalId, readIncrementalUpdateRecords
- 
Constructor Details- 
ProductDataFeedCollectorpublic ProductDataFeedCollector(com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, IncrementalDataFeedEntityUpdateRecordService<IncrementalDataFeedEntityUpdateRecord> incrementalDataFeedEntityUpdateRecordService, List<CollectedEntityContributor> collectedEntityContributors, ProductDataFeedCollectorProperties productDataFeedCollectorProperties, CatalogProvider externalCatalogProvider) 
 
- 
- 
Method Details- 
canHandleDescription copied from interface:DataFeedCollectorIndicates if thisDataFeedCollectorcan handle this type ofDataFeedProcessExecution, presumably because of an entity type or other feed type indicator.- Returns:
 
- 
readDataFeedRecordsprotected List<E> readDataFeedRecords(@NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull List<String> idBatch, @NonNull @NonNull Map<String, Object> collectorProcessState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) - Specified by:
- readDataFeedRecordsin class- AbstractJsonArrayDataFeedCollector<String,- E extends CollectedProduct> 
- Parameters:
- request- the original request to collect data
- idBatch- a batch of unique IDs
- collectorProcessState- Map to optionally hold additional state across multiple method invocations - this is thread safe and guaranteed to be the same Map instance on each invocation
- readContextInfo- ContextInfo to read data from the DB or from an API
- Returns:
 
- 
postProcessprotected List<E> postProcess(@NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull List<E> products, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Hook point to allow implementors to modify the Product list prior to returning to be written to a file. By default, this does nothing but returns the original product list.- Parameters:
- request-
- products-
- readContextInfo-
- Returns:
 
- 
readIdBatchForFullFeedprotected List<String> readIdBatchForFullFeed(@NonNull @NonNull DataFeedCollectionRequest request, @NonNull @NonNull Map<String, Object> collectorProcessState, int batchSize, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Description copied from class:AbstractJsonArrayDataFeedCollectorReturns aListthat provides a batch of IDs, sorted in ascending order. Implementations must keep track of their own cursor (stating point) using the collectorProcessState, which is guaranteed to be the same Map instance between invocations.- Specified by:
- readIdBatchForFullFeedin class- AbstractJsonArrayDataFeedCollector<String,- E extends CollectedProduct> 
- Parameters:
- request- the original request to collect data
- collectorProcessState- Map to optionally hold additional state across multiple method invocations - this is thread safe and guaranteed to be the same Map instance on each invocation
- batchSize- the size of the id batch to fetch, usually larger than the normal batch size.
- readContextInfo- ContextInfo to read data from the DB or from an API
- Returns:
 
- 
readIdBatchForPartialFeedprotected List<String> readIdBatchForPartialFeed(DataFeedCollectionRequest collectionRequest, @NonNull @NonNull List<IncrementalDataFeedEntityUpdateRecord> updateRecords, @NonNull @NonNull Map<String, Object> sharedProcessState, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo readContextInfo) Given a list ofIncrementalDataFeedEntityUpdateRecords, we need to determine the Product IDs. TheIncrementalDataFeedEntityUpdateRecordcontains aIncrementalDataFeedEntityUpdateRecord.getAffectedProductReferenceType()and aIncrementalDataFeedEntityUpdateRecord.getAffectedProductReferenceValue(). The types can be one ofDefaultIncrementalEventProductReferenceTypes. For all references, we need to call the CatalogService and find the IDs, which will be queued up to fetch the products. Note that evenDefaultIncrementalEventProductReferenceTypes.IDreferences need to be sent to CatalogServices, as those records need to pass the same RSQL filters to actually be considered for inclusion.- Specified by:
- readIdBatchForPartialFeedin class- AbstractJsonArrayDataFeedCollector<String,- E extends CollectedProduct> 
- Parameters:
- collectionRequest-
- updateRecords-
- sharedProcessState-
- readContextInfo-
- Returns:
 
- 
getProductDataFeedCollectorProperties
- 
getExternalCatalogProvider
 
-