public final class InventorySync extends BaseSync<io.sphere.sdk.inventory.InventoryEntryDraft,InventorySyncStatistics,InventorySyncOptions>
statistics, syncOptions| Constructor and Description |
|---|
InventorySync(InventorySyncOptions syncOptions)
Takes a
InventorySyncOptions instance to instantiate a new InventorySync
instance that could be used to sync inventory drafts with the given inventory entries in the
CTP project specified in the injected InventorySyncOptions instance. |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.concurrent.CompletionStage<InventorySyncStatistics> |
process(java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> inventoryEntryDrafts)
Iterates through the whole
inventories list and accumulates its valid drafts to
batches. |
protected java.util.concurrent.CompletionStage<InventorySyncStatistics> |
processBatch(java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> batch)
Fetches existing
InventoryEntry objects from CTP project that correspond to passed
batchOfDrafts. |
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, sync, syncBatchespublic InventorySync(@Nonnull
InventorySyncOptions syncOptions)
InventorySyncOptions instance to instantiate a new InventorySync
instance that could be used to sync inventory drafts with the given inventory entries in the
CTP project specified in the injected InventorySyncOptions 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.@Nonnull protected java.util.concurrent.CompletionStage<InventorySyncStatistics> process(@Nonnull java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> inventoryEntryDrafts)
inventories 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.inventory.InventoryEntryDraft,InventorySyncStatistics,InventorySyncOptions>inventoryEntryDrafts - List of InventoryEntryDraft resources that would be
synced into CTP project.CompletionStage with InventorySyncStatistics holding statistics of all
sync processes performed by this sync instanceprotected java.util.concurrent.CompletionStage<InventorySyncStatistics> processBatch(@Nonnull java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> batch)
InventoryEntry objects from CTP project that correspond to passed
batchOfDrafts. Having existing inventory entries fetched, batchOfDrafts is
compared and synced with fetched objects by syncBatch(Set, Set) function.
When fetching existing inventory entries results in an empty optional then batchOfDrafts isn't processed.processBatch in class BaseSync<io.sphere.sdk.inventory.InventoryEntryDraft,InventorySyncStatistics,InventorySyncOptions>batch - batch of drafts that need to be syncedCompletionStage of Void that indicates method progress.