Class SyncSingleLocale
- java.lang.Object
-
- com.commercetools.sync.products.templates.beforeupdatecallback.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 aProductDraft
and filters out any localization other thanLocale.FRENCH
fromLocalizedString
fields of the suppliedProductDraft
.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 aList
of product update actions that was built from comparing anewProductDraft
and anoldProduct
and maps the update actions so that only localizations with valueLocale.FRENCH
are synced and all the other locales are left untouched.
-
-
-
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 aList
of product update actions that was built from comparing anewProductDraft
and anoldProduct
and maps the update actions so that only localizations with valueLocale.FRENCH
are synced and all the other locales are left untouched.- Parameters:
updateActions
- the update actions built from comparingnewProductDraft
andoldProduct
.newProductDraft
- the newProductDraft
being synced.oldProduct
- the old existingProduct
.- 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 aProductDraft
and filters out any localization other thanLocale.FRENCH
fromLocalizedString
fields of the suppliedProductDraft
. Note: This method will only filter theLocalizedString
fields on theProductDraft
level, so it will not filter outLocalizedString
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 theLocale.FRENCH
locale.
-
-