Package com.commercetools.sync.products
Class ProductSync
- java.lang.Object
-
- com.commercetools.sync.commons.BaseSync<com.commercetools.api.models.product.ProductProjection,com.commercetools.api.models.product.ProductDraft,com.commercetools.api.models.product.ProductUpdateAction,ProductSyncStatistics,ProductSyncOptions>
-
- com.commercetools.sync.products.ProductSync
-
public class ProductSync extends BaseSync<com.commercetools.api.models.product.ProductProjection,com.commercetools.api.models.product.ProductDraft,com.commercetools.api.models.product.ProductUpdateAction,ProductSyncStatistics,ProductSyncOptions>
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.commons.BaseSync
statistics, syncOptions
-
-
Constructor Summary
Constructors Constructor Description ProductSync(ProductSyncOptions productSyncOptions)
Takes aProductSyncOptions
instance to instantiate a newProductSync
instance that could be used to sync ProductProjection drafts with the given products in the CTP project specified in the injectedProductSyncOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<ProductSyncStatistics>
process(java.util.List<com.commercetools.api.models.product.ProductDraft> resourceDrafts)
Given a list of resource (e.g.protected java.util.concurrent.CompletionStage<ProductSyncStatistics>
processBatch(java.util.List<com.commercetools.api.models.product.ProductDraft> batch)
-
Methods inherited from class com.commercetools.sync.commons.BaseSync
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, handleError, sync, syncBatches
-
-
-
-
Constructor Detail
-
ProductSync
public ProductSync(@Nonnull ProductSyncOptions productSyncOptions)
Takes aProductSyncOptions
instance to instantiate a newProductSync
instance that could be used to sync ProductProjection drafts with the given products in the CTP project specified in the injectedProductSyncOptions
instance.- Parameters:
productSyncOptions
- the container of all the options of the sync process including the CTP project client and/or configuration and other sync-specific options.
-
-
Method Detail
-
process
protected java.util.concurrent.CompletionStage<ProductSyncStatistics> process(@Nonnull java.util.List<com.commercetools.api.models.product.ProductDraft> resourceDrafts)
Description copied from class:BaseSync
Given a list of resource (e.g. categories, products, etc..) drafts. This method compares each new resource in this list with it's corresponding old resource in a given CTP project, and in turn it either issues update actions on the existing resource if it exists or create it if it doesn't.- Specified by:
process
in classBaseSync<com.commercetools.api.models.product.ProductProjection,com.commercetools.api.models.product.ProductDraft,com.commercetools.api.models.product.ProductUpdateAction,ProductSyncStatistics,ProductSyncOptions>
- Parameters:
resourceDrafts
- the list of new resources as drafts.- Returns:
- an instance of
CompletionStage
<SyncStatisticsT
> which contains as a result an instance ofSyncStatisticsT
which is a subclass ofBaseSyncStatistics
representing thestatistics
instance attribute ofthis
BaseSync
.
-
processBatch
protected java.util.concurrent.CompletionStage<ProductSyncStatistics> processBatch(@Nonnull java.util.List<com.commercetools.api.models.product.ProductDraft> batch)
- Specified by:
processBatch
in classBaseSync<com.commercetools.api.models.product.ProductProjection,com.commercetools.api.models.product.ProductDraft,com.commercetools.api.models.product.ProductUpdateAction,ProductSyncStatistics,ProductSyncOptions>
-
-