Class KeepOtherVariantsSync
- java.lang.Object
-
- com.commercetools.sync.products.templates.beforeupdatecallback.KeepOtherVariantsSync
-
public class KeepOtherVariantsSync extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description KeepOtherVariantsSync()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>>
keepOtherVariants(java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> updateActions, io.sphere.sdk.products.ProductDraft newProductDraft, io.sphere.sdk.products.Product oldProduct)
Takes product update actions, a newProductDraft
, an old existingProduct
.
-
-
-
Method Detail
-
keepOtherVariants
public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> keepOtherVariants(@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.Product oldProduct)
Takes product update actions, a newProductDraft
, an old existingProduct
. This method filters out the update action if it is aRemoveVariant
update action.Using this method as a BeforeUpdateCallback would prevent the removal of not existing variants in the target product.
- Parameters:
updateActions
- the update action built from comparingnewProductDraft
andoldProduct
.newProductDraft
- the newProductDraft
being synced.oldProduct
- the old existingProduct
.- Returns:
- the same list of supplied
updateActions
withoutRemoveVariant
update actions.
-
-