Class ProductSyncUtils
- java.lang.Object
-
- com.commercetools.sync.products.utils.ProductSyncUtils
-
public final class ProductSyncUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTEMPORARY_MASTER_SKU_SUFFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<com.commercetools.api.models.product.ProductUpdateAction>buildActions(com.commercetools.api.models.product.ProductProjection oldProduct, com.commercetools.api.models.product.ProductDraft newProduct, ProductSyncOptions syncOptions, java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)Compares all the fields (including the variants seeProductUpdateActionUtils.buildVariantsUpdateActions(ProductProjection, ProductDraft, com.commercetools.sync.products.ProductSyncOptions, Map)) of aProductProjectionand aProductDraft, given that each of these fields pass the specifiedSyncFilter.static java.util.List<com.commercetools.api.models.product.ProductUpdateAction>buildCategoryActions(com.commercetools.api.models.product.ProductProjection oldProduct, com.commercetools.api.models.product.ProductDraft newProduct)Compares the categories of aProductProjectionand aProductDraft.
-
-
-
Field Detail
-
TEMPORARY_MASTER_SKU_SUFFIX
public static final java.lang.String TEMPORARY_MASTER_SKU_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildActions
@Nonnull public static java.util.List<com.commercetools.api.models.product.ProductUpdateAction> buildActions(@Nonnull com.commercetools.api.models.product.ProductProjection oldProduct, @Nonnull com.commercetools.api.models.product.ProductDraft newProduct, @Nonnull ProductSyncOptions syncOptions, @Nonnull java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)Compares all the fields (including the variants seeProductUpdateActionUtils.buildVariantsUpdateActions(ProductProjection, ProductDraft, com.commercetools.sync.products.ProductSyncOptions, Map)) of aProductProjectionand aProductDraft, given that each of these fields pass the specifiedSyncFilter. It returns aListofProductUpdateAction<Product> as a result. If no update action is needed, for example in case where both theProductProjectionand theProductDrafthave the same names, an emptyListis returned. Then it applies a specified filter function in theProductSyncOptionsinstance on the resultant list and returns this result.- Parameters:
oldProduct- the productprojection 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 (SeeProductSyncOptionsfor 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<com.commercetools.api.models.product.ProductUpdateAction> buildCategoryActions(@Nonnull com.commercetools.api.models.product.ProductProjection oldProduct, @Nonnull com.commercetools.api.models.product.ProductDraft newProduct)Compares the categories of aProductProjectionand aProductDraft. It returns aListofProductUpdateAction<Product> as a result. If no update action is needed, for example in case where both theProductProjectionand theProductDrafthave the identical categories, an emptyListis returned.- Parameters:
oldProduct- the productprojection which should be updated.newProduct- the product draft where we get the new data.- Returns:
- A list of product category-related update actions.
-
-