public class CustomerSync extends BaseSync<io.sphere.sdk.customers.CustomerDraft,CustomerSyncStatistics,CustomerSyncOptions>
statistics, syncOptions
Modifier | Constructor and Description |
---|---|
|
CustomerSync(CustomerSyncOptions customerSyncOptions)
Takes a
CustomerSyncOptions to instantiate a new CustomerSync instance that
could be used to sync customer drafts in the CTP project specified in the injected CustomerSync instance. |
protected |
CustomerSync(CustomerSyncOptions customerSyncOptions,
CustomerService customerService,
TypeService typeService,
CustomerGroupService customerGroupService)
Takes a
CustomerSyncOptions and service instances to instantiate a new CustomerSync instance that could be used to sync customer drafts in the CTP project specified
in the injected CustomerSyncOptions instance. |
Modifier and Type | Method and Description |
---|---|
protected java.util.concurrent.CompletionStage<CustomerSyncStatistics> |
process(java.util.List<io.sphere.sdk.customers.CustomerDraft> customerDrafts)
Iterates through the whole
customerDrafts list and accumulates its valid drafts to
batches. |
protected java.util.concurrent.CompletionStage<CustomerSyncStatistics> |
processBatch(java.util.List<io.sphere.sdk.customers.CustomerDraft> batch) |
executeSupplierIfConcurrentModificationException, getStatistics, getSyncOptions, sync, syncBatches
public CustomerSync(@Nonnull CustomerSyncOptions customerSyncOptions)
CustomerSyncOptions
to instantiate a new CustomerSync
instance that
could be used to sync customer drafts in the CTP project specified in the injected CustomerSync
instance.customerSyncOptions
- the container of all the options of the sync process including the
CTP project client and/or configuration and other sync-specific options.protected CustomerSync(@Nonnull CustomerSyncOptions customerSyncOptions, @Nonnull CustomerService customerService, @Nonnull TypeService typeService, @Nonnull CustomerGroupService customerGroupService)
CustomerSyncOptions
and service instances to instantiate a new CustomerSync
instance that could be used to sync customer drafts in the CTP project specified
in the injected CustomerSyncOptions
instance.
NOTE: This constructor is mainly to be used for tests where the services can be mocked and passed to.
customerSyncOptions
- the container of all the options of the sync process including the
CTP project client and/or configuration and other sync-specific options.customerService
- the customer service which is responsible for fetching/caching the
Customers from the CTP project.typeService
- the type service which is responsible for fetching/caching the Types from
the CTP project.customerGroupService
- the customer group service which is responsible for
fetching/caching the CustomerGroups from the CTP project.protected java.util.concurrent.CompletionStage<CustomerSyncStatistics> process(@Nonnull java.util.List<io.sphere.sdk.customers.CustomerDraft> customerDrafts)
customerDrafts
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.customers.CustomerDraft,CustomerSyncStatistics,CustomerSyncOptions>
customerDrafts
- List
of CustomerDraft
's that would be synced into CTP
project.CompletionStage
with CustomerSyncStatistics
holding statistics of all
sync processes performed by this sync instance.protected java.util.concurrent.CompletionStage<CustomerSyncStatistics> processBatch(@Nonnull java.util.List<io.sphere.sdk.customers.CustomerDraft> batch)
processBatch
in class BaseSync<io.sphere.sdk.customers.CustomerDraft,CustomerSyncStatistics,CustomerSyncOptions>