Class AbstractPriceDataPreloadProcessor
java.lang.Object
com.broadleafcommerce.dataexchange.service.catalog.product.AbstractPriceDataPreloadProcessor
- All Implemented Interfaces:
BatchExtensionProcessor
,NodeBuilder
,org.springframework.core.Ordered
- Direct Known Subclasses:
DefaultPriceDataPreloadProcessor
public abstract class AbstractPriceDataPreloadProcessor
extends Object
implements BatchExtensionProcessor, NodeBuilder
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractPriceDataPreloadProcessor
(PriceProvider<PriceData, PriceList> pricingProvider, DataExchangePriceListProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract cz.jirutka.rsql.parser.ast.Node
buildPriceDataReadFilter
(Map<String, PriceList> priceListMap, List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) Builds the criteria for bulk reading price data.buildPriceListMap
(List<PriceList> priceLists, List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) protected abstract cz.jirutka.rsql.parser.ast.Node
buildPriceListReadFilter
(List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) Builds the criteria for reading price lists.boolean
Method to determine if this handler should execute.Return a function that maps a price list to a key for a map.protected PriceProvider<PriceData,
PriceList> protected DataExchangePriceListProperties
protected com.broadleafcommerce.common.extension.TypeFactory
protected abstract void
populatePriceListIdForPriceData
(ComprehensiveProduct product, Prices prices, PriceData priceData, Map<String, PriceList> priceListMap, BatchContext<ComprehensiveProduct> batch) Populates the price list id for the given price data.protected void
populatePriceListIds
(List<ComprehensiveProduct> products, Map<String, PriceList> priceListMap, BatchContext<ComprehensiveProduct> batch) Builds a map of price lists by key.void
preProcess
(BatchContext<?> batchContext) This method will be executed to allow customers to fetch, for example, data that is required for future processing.readExistingPriceData
(cz.jirutka.rsql.parser.ast.Node filters, BatchContext<ComprehensiveProduct> batch) readPriceLists
(cz.jirutka.rsql.parser.ast.Node filters, BatchContext<ComprehensiveProduct> batch) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.dataexchange.service.BatchExtensionProcessor
getOrder, postProcess
Methods inherited from interface com.broadleafcommerce.dataexchange.service.NodeBuilder
buildAndNode, buildAndNode, buildEqualsNode, buildInNode, buildInNode, buildOrNode, buildOrNode, emptyNode, escapeSpecialCharacters, filterEmptyNodes, filterEmptyNodes, isEmptyNodeOrNull
-
Constructor Details
-
AbstractPriceDataPreloadProcessor
public AbstractPriceDataPreloadProcessor(PriceProvider<PriceData, PriceList> pricingProvider, DataExchangePriceListProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
canHandle
Description copied from interface:BatchExtensionProcessor
Method to determine if this handler should execute.- Specified by:
canHandle
in interfaceBatchExtensionProcessor
- Returns:
-
preProcess
Description copied from interface:BatchExtensionProcessor
This method will be executed to allow customers to fetch, for example, data that is required for future processing. This is good in situations where you want to pre-fetch or batch fetch and pre-cache data for use within this batch context. Generally, implementors should save any results that they want to save and use later inBatchContext#getAdditionalProperties()
. This method is called only ifBatchExtensionProcessor.canHandle(Class)
returns true. It is executed inAbstractDataExchangeService.saveAll(List, ContextInfo)
afterAbstractDataExchangeService.split(List, BatchContext)
and beforeAbstractDataExchangeService.aggregate(BatchContext)
.- Specified by:
preProcess
in interfaceBatchExtensionProcessor
-
readPriceLists
public List<PriceList> readPriceLists(cz.jirutka.rsql.parser.ast.Node filters, BatchContext<ComprehensiveProduct> batch) -
readExistingPriceData
public List<PriceData> readExistingPriceData(cz.jirutka.rsql.parser.ast.Node filters, BatchContext<ComprehensiveProduct> batch) -
buildPriceListMap
protected Map<String,PriceList> buildPriceListMap(List<PriceList> priceLists, List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) -
populatePriceListIds
protected void populatePriceListIds(List<ComprehensiveProduct> products, Map<String, PriceList> priceListMap, BatchContext<ComprehensiveProduct> batch) Builds a map of price lists by key.- Parameters:
products
- The productspriceListMap
- A map of price lists. Key depends on the implementation. This implementation callspopulatePriceListIdForPriceData(ComprehensiveProduct, Prices, PriceData, Map, BatchContext)
to populate the appropriate ID on the price data.batch
- the batch context
-
populatePriceListIdForPriceData
protected abstract void populatePriceListIdForPriceData(ComprehensiveProduct product, Prices prices, PriceData priceData, Map<String, PriceList> priceListMap, BatchContext<ComprehensiveProduct> batch) Populates the price list id for the given price data. The implementation should populatePriceData.setPriceListId(String)
with the appropriate ID from the supplied price list map. If the price list is not found, the implementation should register an error with the batch context for the supplied product.- Parameters:
product
- The productpriceData
- The price datapriceListMap
- The price list map. Key depends on the implementation.batch
- The batch context
-
getPriceListMapKeyFunction
Return a function that maps a price list to a key for a map. This will be used whenpopulating the price list ID
for a given price data.- Returns:
- a function that maps a price list to a key for a map
-
buildPriceDataReadFilter
protected abstract cz.jirutka.rsql.parser.ast.Node buildPriceDataReadFilter(Map<String, PriceList> priceListMap, List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) Builds the criteria for bulk reading price data. SeePriceProvider.bulkReadPriceData(Node, BatchContext)
- Parameters:
batch
- the batch context- Returns:
- the criteria for bulk reading price data
-
buildPriceListReadFilter
protected abstract cz.jirutka.rsql.parser.ast.Node buildPriceListReadFilter(List<ComprehensiveProduct> products, BatchContext<ComprehensiveProduct> batch) Builds the criteria for reading price lists. SeePriceProvider.readPriceLists(Node, BatchContext)
- Parameters:
products
- the products to build the filter forbatch
- the batch context- Returns:
- the criteria for reading price lists
-
getPricingProvider
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getProperties
-