Class TaxCategorySync

    • Constructor Detail

    • Method Detail

      • process

        protected java.util.concurrent.CompletionStage<TaxCategorySyncStatistics> process​(@Nonnull
                                                                                          java.util.List<io.sphere.sdk.taxcategories.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 class BaseSync<io.sphere.sdk.taxcategories.TaxCategoryDraft,​TaxCategorySyncStatistics,​TaxCategorySyncOptions>
        Parameters:
        resourceDrafts - the list of new resources as drafts.
        Returns:
        an instance of CompletionStage<U> which contains as a result an instance of U which is a subclass of BaseSyncStatistics representing the statistics instance attribute of this BaseSync.
      • processBatch

        protected java.util.concurrent.CompletionStage<TaxCategorySyncStatistics> processBatch​(@Nonnull
                                                                                               java.util.List<io.sphere.sdk.taxcategories.TaxCategoryDraft> batch)
        This method first creates a new Set of valid TaxCategoryDraft elements. For more on the rules of validation, check: TaxCategoryBatchValidator.validateAndCollectReferencedKeys(List). Using the resulting set of validTaxCategoryDrafts, the matching tax categories 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 tax categories, the error callback will be triggered. And the sync process would stop for the given batch.

        Specified by:
        processBatch in class BaseSync<io.sphere.sdk.taxcategories.TaxCategoryDraft,​TaxCategorySyncStatistics,​TaxCategorySyncOptions>
        Parameters:
        batch - batch of drafts that need to be synced
        Returns:
        a CompletionStage containing an instance of TaxCategorySyncStatistics which contains information about the result of syncing the supplied batch to the target project.