public final class ProductSyncUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> |
buildActions(io.sphere.sdk.products.ProductProjection oldProduct,
io.sphere.sdk.products.ProductDraft newProduct,
ProductSyncOptions syncOptions,
java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)
Compares all the fields (including the variants see
ProductUpdateActionUtils.buildVariantsUpdateActions(ProductProjection, ProductDraft,
ProductSyncOptions, Map) ) of a ProductProjection and a ProductDraft , given
that each of these fields pass the specified SyncFilter . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> |
buildCategoryActions(io.sphere.sdk.products.ProductProjection oldProduct,
io.sphere.sdk.products.ProductDraft newProduct)
Compares the categories of a
ProductProjection and a ProductDraft . |
@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildActions(@Nonnull io.sphere.sdk.products.ProductProjection oldProduct, @Nonnull io.sphere.sdk.products.ProductDraft newProduct, @Nonnull ProductSyncOptions syncOptions, @Nonnull java.util.Map<java.lang.String,AttributeMetaData> attributesMetaData)
ProductUpdateActionUtils.buildVariantsUpdateActions(ProductProjection, ProductDraft,
ProductSyncOptions, Map)
) of a ProductProjection
and a ProductDraft
, given
that each of these fields pass the specified SyncFilter
. It returns a List
of
UpdateAction
<Product
> as a result. If no update action is needed, for
example in case where both the ProductProjection
and the ProductDraft
have the
same names, an empty List
is returned. Then it applies a specified filter function in
the ProductSyncOptions
instance on the resultant list and returns this result.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 (See ProductSyncOptions
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.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildCategoryActions(@Nonnull io.sphere.sdk.products.ProductProjection oldProduct, @Nonnull io.sphere.sdk.products.ProductDraft newProduct)
ProductProjection
and a ProductDraft
. It returns a
List
of UpdateAction
<Product
> as a result. If no update action is
needed, for example in case where both the ProductProjection
and the ProductDraft
have the identical categories, an empty List
is returned.oldProduct
- the productprojection which should be updated.newProduct
- the product draft where we get the new data.