Class SyncSingleLocale


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static io.sphere.sdk.products.ProductDraft filterFrenchLocales​(io.sphere.sdk.products.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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> syncFrenchDataOnly​(java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> updateActions, io.sphere.sdk.products.ProductDraft newProductDraft, io.sphere.sdk.products.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<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> syncFrenchDataOnly​(@Nonnull
                                                                                                                             java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> updateActions,
                                                                                                                             @Nonnull
                                                                                                                             io.sphere.sdk.products.ProductDraft newProductDraft,
                                                                                                                             @Nonnull
                                                                                                                             io.sphere.sdk.products.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 io.sphere.sdk.products.ProductDraft filterFrenchLocales​(@Nonnull
                                                                              io.sphere.sdk.products.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.