public class TypeSync extends BaseSync<io.sphere.sdk.types.TypeDraft,TypeSyncStatistics,TypeSyncOptions>
statistics, syncOptions| Constructor and Description |
|---|
TypeSync(TypeSyncOptions typeSyncOptions) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.concurrent.CompletionStage<TypeSyncStatistics> |
process(java.util.List<io.sphere.sdk.types.TypeDraft> typeDrafts)
Iterates through the whole
typeDrafts list and accumulates its valid drafts to batches. |
protected java.util.concurrent.CompletionStage<TypeSyncStatistics> |
processBatch(java.util.List<io.sphere.sdk.types.TypeDraft> batch)
This method first creates a new
Set of valid TypeDraft elements. |
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, sync, syncBatchespublic TypeSync(@Nonnull
TypeSyncOptions typeSyncOptions)
protected java.util.concurrent.CompletionStage<TypeSyncStatistics> process(@Nonnull java.util.List<io.sphere.sdk.types.TypeDraft> typeDrafts)
typeDrafts list and accumulates its valid drafts to batches.
Every batch is then processed by processBatch(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.
process in class BaseSync<io.sphere.sdk.types.TypeDraft,TypeSyncStatistics,TypeSyncOptions>typeDrafts - List of TypeDraft's that would be synced into CTP project.CompletionStage with TypeSyncStatistics holding statistics of all sync
processes performed by this sync instance.protected java.util.concurrent.CompletionStage<TypeSyncStatistics> processBatch(@Nonnull java.util.List<io.sphere.sdk.types.TypeDraft> batch)
Set of valid TypeDraft elements. For more on
the rules of validation, check: TypeBatchValidator.validateAndCollectReferencedKeys(List). Using the resulting set of validTypeDrafts, the matching types in the target CTP project are fetched then the method
syncBatch(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 types, the error callback will be triggered. And the sync process would stop for the given batch.
processBatch in class BaseSync<io.sphere.sdk.types.TypeDraft,TypeSyncStatistics,TypeSyncOptions>batch - batch of drafts that need to be syncedCompletionStage containing an instance of TypeSyncStatistics which
contains information about the result of syncing the supplied batch to the target project.