public class CategorySync extends BaseSync<io.sphere.sdk.categories.CategoryDraft,CategorySyncStatistics,CategorySyncOptions>
statistics, syncOptions| Constructor and Description |
|---|
CategorySync(CategorySyncOptions syncOptions)
Takes a
CategorySyncOptions instance to instantiate a new CategorySync instance
that could be used to sync category drafts with the given categories in the CTP project
specified in the injected CategorySyncOptions instance. |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.concurrent.CompletionStage<CategorySyncStatistics> |
process(java.util.List<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
Given a list of
CategoryDraft that represent a batch of category drafts, this method
for the first batch only caches a list of all the categories in the CTP project in a cached map
that representing each category's key to the id. |
protected java.util.concurrent.CompletionStage<CategorySyncStatistics> |
processBatch(java.util.List<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
Given a list of
CategoryDraft that represent a batch of category drafts, this method
for the first batch only caches a mapping of key to the id of all categories in the CTP
project. |
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, sync, syncBatchespublic CategorySync(@Nonnull
CategorySyncOptions syncOptions)
CategorySyncOptions instance to instantiate a new CategorySync instance
that could be used to sync category drafts with the given categories in the CTP project
specified in the injected CategorySyncOptions instance.syncOptions - the container of all the options of the sync process including the CTP
project client and/or configuration and other sync-specific options.protected java.util.concurrent.CompletionStage<CategorySyncStatistics> process(@Nonnull java.util.List<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
CategoryDraft that represent a batch of category drafts, this method
for the first batch only caches a list of all the categories in the CTP project in a cached map
that representing each category's key to the id. It then validates the category drafts, then
resolves all the references. Then it creates all categories that need to be created in parallel
while keeping track of the categories that have their non-existing parents. Then it does update
actions that don't require parent changes in parallel. Then in a blocking fashion issues update
actions that don't involve parent changes sequentially.
More on the exact implementation of how the sync works here: https://sphere.atlassian.net/wiki/spaces/PS/pages/145193124/Category+Parallelisation+Technical+Concept
process in class BaseSync<io.sphere.sdk.categories.CategoryDraft,CategorySyncStatistics,CategorySyncOptions>categoryDrafts - the list of new category drafts to sync to the CTP project.CompletionStage<CategorySyncStatistics> which
contains as a result an instance of CategorySyncStatistics representing the statistics instance attribute of this CategorySync.protected java.util.concurrent.CompletionStage<CategorySyncStatistics> processBatch(@Nonnull java.util.List<io.sphere.sdk.categories.CategoryDraft> categoryDrafts)
CategoryDraft that represent a batch of category drafts, this method
for the first batch only caches a mapping of key to the id of all categories in the CTP
project. It then validates the category drafts, then resolves all the references. Then it
creates all categories that need to be created in parallel while keeping track of the
categories that have their non-existing parents. Then it does update actions that don't require
parent changes in parallel. Then in a blocking fashion issues update actions that don't involve
parent changes sequentially.
In case of error during of fetch during the caching of category keys or during of fetching of existing categories, the error callback will be triggered. And the sync process would stop for the given batch.
More on the exact implementation of how the sync works here: https://github.com/commercetools/commercetools-sync-java/wiki/Category-Sync-Underlying-Concept
processBatch in class BaseSync<io.sphere.sdk.categories.CategoryDraft,CategorySyncStatistics,CategorySyncOptions>categoryDrafts - the list of new category drafts to sync to the CTP project.CompletionStage<CategorySyncStatistics> which
contains as a result an instance of CategorySyncStatistics representing the statistics instance attribute of this CategorySync.