Class ProductSyncUtils
- java.lang.Object
-
- com.commercetools.sync.products.utils.ProductSyncUtils
-
public final class ProductSyncUtils extends java.lang.Object
-
-
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>>
buildActions(io.sphere.sdk.products.Product oldProduct, io.sphere.sdk.products.ProductDraft newProduct, ProductSyncOptions syncOptions, java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)
Compares all the fields (including the variants seeProductUpdateActionUtils.buildVariantsUpdateActions(Product, ProductDraft, ProductSyncOptions, Map)
) of aProduct
and aProductDraft
, given that each of these fields pass the specifiedSyncFilter
.static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>>
buildCategoryActions(io.sphere.sdk.products.Product oldProduct, io.sphere.sdk.products.ProductDraft newProduct)
Compares the categories of aProduct
and aProductDraft
.
-
-
-
Method Detail
-
buildActions
@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildActions(@Nonnull io.sphere.sdk.products.Product oldProduct, @Nonnull io.sphere.sdk.products.ProductDraft newProduct, @Nonnull ProductSyncOptions syncOptions, @Nonnull java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)
Compares all the fields (including the variants seeProductUpdateActionUtils.buildVariantsUpdateActions(Product, ProductDraft, ProductSyncOptions, Map)
) of aProduct
and aProductDraft
, given that each of these fields pass the specifiedSyncFilter
. It returns aList
ofUpdateAction
<Product
> as a result. If no update action is needed, for example in case where both theProduct
and theProductDraft
have the same names, an emptyList
is returned. Then it applies a specified filter function in theProductSyncOptions
instance on the resultant list and returns this result.- Parameters:
oldProduct
- the product which should be updated.newProduct
- the product draft where we get the new data.syncOptions
- the sync options wrapper which contains options related to the sync process supplied by the user. For example, custom callbacks to call in case of warnings or errors occurring on the build update action process. And other options (SeeProductSyncOptions
for more info).attributesMetaData
- a map of attribute name ->AttributeMetaData
; which defines each attribute's information: its name and whether it has the constraint "SameForAll" or not.- Returns:
- A list of product-specific update actions.
-
buildCategoryActions
@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildCategoryActions(@Nonnull io.sphere.sdk.products.Product oldProduct, @Nonnull io.sphere.sdk.products.ProductDraft newProduct)
Compares the categories of aProduct
and aProductDraft
. It returns aList
ofUpdateAction
<Product
> as a result. If no update action is needed, for example in case where both theProduct
and theProductDraft
have the identical categories, an emptyList
is returned.- Parameters:
oldProduct
- the product which should be updated.newProduct
- the product draft where we get the new data.- Returns:
- A list of product category-related update actions.
-
-