Class TaxCategorySync
- java.lang.Object
-
- com.commercetools.sync.commons.BaseSync<com.commercetools.api.models.tax_category.TaxCategory,com.commercetools.api.models.tax_category.TaxCategoryDraft,com.commercetools.api.models.tax_category.TaxCategoryUpdateAction,TaxCategorySyncStatistics,TaxCategorySyncOptions>
-
- com.commercetools.sync.taxcategories.TaxCategorySync
-
public class TaxCategorySync extends BaseSync<com.commercetools.api.models.tax_category.TaxCategory,com.commercetools.api.models.tax_category.TaxCategoryDraft,com.commercetools.api.models.tax_category.TaxCategoryUpdateAction,TaxCategorySyncStatistics,TaxCategorySyncOptions>
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.commons.BaseSync
statistics, syncOptions
-
-
Constructor Summary
Constructors Constructor Description TaxCategorySync(TaxCategorySyncOptions taxCategorySyncOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<TaxCategorySyncStatistics>
process(java.util.List<com.commercetools.api.models.tax_category.TaxCategoryDraft> resourceDrafts)
Given a list of resource (e.g.protected java.util.concurrent.CompletionStage<TaxCategorySyncStatistics>
processBatch(java.util.List<com.commercetools.api.models.tax_category.TaxCategoryDraft> batch)
This method first creates a newSet
of validTaxCategoryDraft
elements.-
Methods inherited from class com.commercetools.sync.commons.BaseSync
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, handleError, sync, syncBatches
-
-
-
-
Constructor Detail
-
TaxCategorySync
public TaxCategorySync(@Nonnull TaxCategorySyncOptions taxCategorySyncOptions)
-
-
Method Detail
-
process
protected java.util.concurrent.CompletionStage<TaxCategorySyncStatistics> process(@Nonnull java.util.List<com.commercetools.api.models.tax_category.TaxCategoryDraft> 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.tax_category.TaxCategory,com.commercetools.api.models.tax_category.TaxCategoryDraft,com.commercetools.api.models.tax_category.TaxCategoryUpdateAction,TaxCategorySyncStatistics,TaxCategorySyncOptions>
- 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<TaxCategorySyncStatistics> processBatch(@Nonnull java.util.List<com.commercetools.api.models.tax_category.TaxCategoryDraft> batch)
This method first creates a newSet
of validTaxCategoryDraft
elements. For more on the rules of validation, check:TaxCategoryBatchValidator.validateAndCollectReferencedKeys(List)
. Using the resulting set ofvalidTaxCategoryDrafts
, the matching tax categories in the target CTP project are fetched then the methodsyncBatch(Set, Set)
is called to perform the sync (update or create requests accordingly) on the target project.In case of error during of fetching of existing tax categories, the error callback will be triggered. And the sync process would stop for the given batch.
- Specified by:
processBatch
in classBaseSync<com.commercetools.api.models.tax_category.TaxCategory,com.commercetools.api.models.tax_category.TaxCategoryDraft,com.commercetools.api.models.tax_category.TaxCategoryUpdateAction,TaxCategorySyncStatistics,TaxCategorySyncOptions>
- Parameters:
batch
- batch of drafts that need to be synced- Returns:
- a
CompletionStage
containing an instance ofTaxCategorySyncStatistics
which contains information about the result of syncing the supplied batch to the target project.
-
-