Class SyncSingleLocale


  • public final class SyncSingleLocale
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.commercetools.api.models.product.ProductDraft filterFrenchLocales​(com.commercetools.api.models.product.ProductDraft productDraft)
      Takes a ProductDraft and filters out any localization other than Locale.FRENCH from LocalizedString fields of the supplied ProductDraft.
      static java.util.List<com.commercetools.api.models.product.ProductUpdateAction> syncFrenchDataOnly​(java.util.List<com.commercetools.api.models.product.ProductUpdateAction> updateActions, com.commercetools.api.models.product.ProductDraft newProductDraft, com.commercetools.api.models.product.ProductProjection oldProduct)
      Takes in a List of product update actions that was built from comparing a newProductDraft and an oldProduct and maps the update actions so that only localizations with value Locale.FRENCH are synced and all the other locales are left untouched.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • syncFrenchDataOnly

        @Nonnull
        public static java.util.List<com.commercetools.api.models.product.ProductUpdateAction> syncFrenchDataOnly​(@Nonnull
                                                                                                                  java.util.List<com.commercetools.api.models.product.ProductUpdateAction> updateActions,
                                                                                                                  @Nonnull
                                                                                                                  com.commercetools.api.models.product.ProductDraft newProductDraft,
                                                                                                                  @Nonnull
                                                                                                                  com.commercetools.api.models.product.ProductProjection oldProduct)
        Takes in a List of product update actions that was built from comparing a newProductDraft and an oldProduct and maps the update actions so that only localizations with value Locale.FRENCH are synced and all the other locales are left untouched.
        Parameters:
        updateActions - the update actions built from comparing newProductDraft and oldProduct.
        newProductDraft - the new ProductDraft being synced.
        oldProduct - the old existing Product.
        Returns:
        a new list of update actions that corresponds to changes on French localizations only.
      • filterFrenchLocales

        @Nonnull
        public static com.commercetools.api.models.product.ProductDraft filterFrenchLocales​(@Nonnull
                                                                                            com.commercetools.api.models.product.ProductDraft productDraft)
        Takes a ProductDraft and filters out any localization other than Locale.FRENCH from LocalizedString fields of the supplied ProductDraft. Note: This method will only filter the LocalizedString fields on the ProductDraft level, so it will not filter out LocalizedString fields on the variant level.
        Parameters:
        productDraft - the product draft to filter the localizations from.
        Returns:
        a new product draft with LocalizedString fields that have only entries of the Locale.FRENCH locale.