Class DefaultComprehensiveProductExchangeService<T extends ComprehensiveProduct>
java.lang.Object
com.broadleafcommerce.dataexchange.service.AbstractDataExchangeService<T>
com.broadleafcommerce.dataexchange.service.catalog.DefaultComprehensiveProductExchangeService<T>
- Type Parameters:
T-
- All Implemented Interfaces:
ComprehensiveProductExchangeService<T>,DataExchangeService<T>
public class DefaultComprehensiveProductExchangeService<T extends ComprehensiveProduct>
extends AbstractDataExchangeService<T>
implements ComprehensiveProductExchangeService<T>
Default service to handle composite data exchange of
comprehensive
products.- Author:
- Kelly Tisdell (ktisdell)
-
Field Summary
Fields inherited from interface com.broadleafcommerce.dataexchange.service.catalog.ComprehensiveProductExchangeService
FETCHED_EXISTING_PRODUCTS_LIST_KEY, FETCHED_EXISTING_VARIANTS_MAP_KEY -
Constructor Summary
ConstructorsConstructorDescriptionDefaultComprehensiveProductExchangeService(CatalogProvider<T, Variant> catalogProvider, DataExchangeProperties properties, org.springframework.core.task.AsyncTaskExecutor executor, org.springframework.retry.support.RetryTemplate retryTemplate, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProductBatchItemHandler<T> productBatchItemHandler, List<BatchExtensionProcessor> batchExtensionProcessors) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<CompletableFuture<Void>>createProductSaveCompletableFutures(BatchContext<T> batchContext) Creates a list ofCompletableFuture, one for eachComprehensiveProduct, such that each product can be saved individually in an asynchronous way.protected voidfetchExistingProductData(BatchContext<T> batchContext) protected voidfetchExistingProducts(List<T> originalProductList, BatchContext<T> batchContext) protected voidfetchExistingVariants(BatchContext<T> batchContext) protected CatalogProvider<T,Variant> getOriginalProductList(BatchContext<T> batchContext) protected ProductBatchItemHandler<T>protected voidsaveAll(BatchContext<T> batchContext) This is the entry point for subclasses to inject logic to handle the structure that has been passed in.Methods inherited from class com.broadleafcommerce.dataexchange.service.AbstractDataExchangeService
aggregate, createCompletableFuture, createCompletableFuture, exceedMaxBatchSizeError, getDataExchangeErrorSupplier, getDefaultRetryTemplate, getExecutor, getProperties, getTypeFactory, retryableCallable, retryableCallable, retryableRunnable, retryableRunnable, retryableSupplier, retryableSupplier, saveAll, splitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.dataexchange.service.DataExchangeService
saveAll
-
Constructor Details
-
DefaultComprehensiveProductExchangeService
public DefaultComprehensiveProductExchangeService(CatalogProvider<T, Variant> catalogProvider, DataExchangeProperties properties, org.springframework.core.task.AsyncTaskExecutor executor, org.springframework.retry.support.RetryTemplate retryTemplate, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProductBatchItemHandler<T> productBatchItemHandler, List<BatchExtensionProcessor> batchExtensionProcessors)
-
-
Method Details
-
saveAll
Description copied from class:AbstractDataExchangeServiceThis is the entry point for subclasses to inject logic to handle the structure that has been passed in. This may be called in a differentThreadthan the calling thread. Typically, the containing object needs to be processed first to ensure that the correct references (e.g. contextIds, pricing keys, etc. are available). It is expected that the values in the Map will be updated when they are created or saved, allowing the aggregate method to aggregate the details.- Specified by:
saveAllin classAbstractDataExchangeService<T extends ComprehensiveProduct>- Parameters:
batchContext- the batch context- See Also:
-
createProductSaveCompletableFutures
protected List<CompletableFuture<Void>> createProductSaveCompletableFutures(BatchContext<T> batchContext) Creates a list ofCompletableFuture, one for eachComprehensiveProduct, such that each product can be saved individually in an asynchronous way. The list that is returned can be used to compose more complicated interactions, including savingtranslations,prices, etc., also in an asynchronous way that is coordinated and orchestrated.- Parameters:
batchContext- the batch context- Returns:
- a list of
CompletableFuturethat will save each product asynchronously
-
fetchExistingProductData
-
fetchExistingVariants
-
fetchExistingProducts
-
getOriginalProductList
-
getCatalogProvider
-
getProductBatchItemHandler
-