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.ProductDraftfilterFrenchLocales(io.sphere.sdk.products.ProductDraft productDraft)Takes aProductDraftand filters out any localization other thanLocale.FRENCHfromLocalizedStringfields 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 aListof product update actions that was built from comparing anewProductDraftand anoldProductand maps the update actions so that only localizations with valueLocale.FRENCHare 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 aListof product update actions that was built from comparing anewProductDraftand anoldProductand maps the update actions so that only localizations with valueLocale.FRENCHare synced and all the other locales are left untouched.- Parameters:
updateActions- the update actions built from comparingnewProductDraftandoldProduct.newProductDraft- the newProductDraftbeing 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 aProductDraftand filters out any localization other thanLocale.FRENCHfromLocalizedStringfields of the suppliedProductDraft. Note: This method will only filter theLocalizedStringfields on theProductDraftlevel, so it will not filter outLocalizedStringfields on the variant level.- Parameters:
productDraft- the product draft to filter the localizations from.- Returns:
- a new product draft with
LocalizedStringfields that have only entries of theLocale.FRENCHlocale.
-
-