Class CartDiscountSync
- java.lang.Object
-
- com.commercetools.sync.commons.BaseSync<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscount,CartDiscountSyncStatistics,CartDiscountSyncOptions>
-
- com.commercetools.sync.cartdiscounts.CartDiscountSync
-
public class CartDiscountSync extends BaseSync<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscount,CartDiscountSyncStatistics,CartDiscountSyncOptions>
This class syncs cart discount drafts with the corresponding cart discounts in the CTP project.
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.commons.BaseSync
statistics, syncOptions
-
-
Constructor Summary
Constructors Constructor Description CartDiscountSync(CartDiscountSyncOptions cartDiscountSyncOptions)
Takes aCartDiscountSyncOptions
to instantiate a newCartDiscountSync
instance that could be used to sync cart discount drafts in the CTP project specified in the injectedCartDiscountSyncOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<CartDiscountSyncStatistics>
process(java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft> cartDiscountDrafts)
Iterates through the wholecartDiscountDrafts
list and accumulates its valid drafts to batches.protected java.util.concurrent.CompletionStage<CartDiscountSyncStatistics>
processBatch(java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft> batch)
-
Methods inherited from class com.commercetools.sync.commons.BaseSync
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, handleError, sync, syncBatches
-
-
-
-
Constructor Detail
-
CartDiscountSync
public CartDiscountSync(@Nonnull CartDiscountSyncOptions cartDiscountSyncOptions)
Takes aCartDiscountSyncOptions
to instantiate a newCartDiscountSync
instance that could be used to sync cart discount drafts in the CTP project specified in the injectedCartDiscountSyncOptions
instance.- Parameters:
cartDiscountSyncOptions
- 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<CartDiscountSyncStatistics> process(@Nonnull java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft> cartDiscountDrafts)
Iterates through the wholecartDiscountDrafts
list and accumulates its valid drafts to batches. Every batch is then processed byprocessBatch(List)
.Inherited doc: 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<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscount,CartDiscountSyncStatistics,CartDiscountSyncOptions>
- Parameters:
cartDiscountDrafts
-List
ofCartDiscountDraft
's that would be synced into CTP project.- Returns:
CompletionStage
withCartDiscountSyncStatistics
holding statistics of all sync processes performed by this sync instance.
-
processBatch
protected java.util.concurrent.CompletionStage<CartDiscountSyncStatistics> processBatch(@Nonnull java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft> batch)
- Specified by:
processBatch
in classBaseSync<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscount,CartDiscountSyncStatistics,CartDiscountSyncOptions>
-
-