Class ProductVariantPriceUpdateActionUtils
- java.lang.Object
 - 
- com.commercetools.sync.products.utils.ProductVariantPriceUpdateActionUtils
 
 
- 
public final class ProductVariantPriceUpdateActionUtils 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.ProductDraft newProduct, java.lang.Integer variantId, io.sphere.sdk.products.Price oldPrice, io.sphere.sdk.products.PriceDraft newPrice, ProductSyncOptions syncOptions)Compares all the fields of aPriceand aPriceDraftand returns a list ofUpdateAction<Product> as a result.static java.util.Optional<io.sphere.sdk.products.commands.updateactions.ChangePrice>buildChangePriceUpdateAction(io.sphere.sdk.products.Price oldPrice, io.sphere.sdk.products.PriceDraft newPrice, ProductSyncOptions syncOptions)Builds aChangePriceaction based on the comparison of the following fields of the suppliedPriceandPriceDraft:Price.getValue()andPriceDraft.getValue()Price.getTiers()andPriceDraft.getTiers()static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>>buildCustomUpdateActions(io.sphere.sdk.products.ProductDraft newProduct, java.lang.Integer variantId, io.sphere.sdk.products.Price oldPrice, io.sphere.sdk.products.PriceDraft newPrice, ProductSyncOptions syncOptions)Compares the custom fields and custom types of aPriceand aPriceDraftand returns a list ofUpdateAction<Product> as a result. 
 - 
 
- 
- 
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.ProductDraft newProduct, @Nonnull java.lang.Integer variantId, @Nonnull io.sphere.sdk.products.Price oldPrice, @Nonnull io.sphere.sdk.products.PriceDraft newPrice, @Nonnull ProductSyncOptions syncOptions)Compares all the fields of aPriceand aPriceDraftand returns a list ofUpdateAction<Product> as a result. If both thePriceand thePriceDrafthave identical fields, then no update action is needed and hence an emptyListis returned.- Parameters:
 newProduct- new product draft, which provides the prices to update.variantId- the variantId needed for building the update action.oldPrice- the price which should be updated.newPrice- the price draft where we get the new fields.syncOptions- responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.- Returns:
 - A list with the update actions or an empty list if the price fields are identical.
 
 
- 
buildChangePriceUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.products.commands.updateactions.ChangePrice> buildChangePriceUpdateAction(@Nonnull io.sphere.sdk.products.Price oldPrice, @Nonnull io.sphere.sdk.products.PriceDraft newPrice, @Nonnull ProductSyncOptions syncOptions)Builds aChangePriceaction based on the comparison of the following fields of the suppliedPriceandPriceDraft:Price.getValue()andPriceDraft.getValue()Price.getTiers()andPriceDraft.getTiers()
If any of the aforementioned fields are different a
ChangePriceupdate action will be returned in anOptional, otherwise if both are identical in thePriceand thePriceDraft, then no update action is needed and hence an emptyOptionalis returned.- Parameters:
 oldPrice- the price which should be updated.newPrice- the price draft where we get the new name.syncOptions- responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.- Returns:
 - A filled optional with the update action or an empty optional if the names are identical.
 
 
- 
buildCustomUpdateActions
@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.products.Product>> buildCustomUpdateActions(@Nonnull io.sphere.sdk.products.ProductDraft newProduct, @Nonnull java.lang.Integer variantId, @Nonnull io.sphere.sdk.products.Price oldPrice, @Nonnull io.sphere.sdk.products.PriceDraft newPrice, @Nonnull ProductSyncOptions syncOptions)Compares the custom fields and custom types of aPriceand aPriceDraftand returns a list ofUpdateAction<Product> as a result. If both thePriceand thePriceDrafthave identical custom fields and types, then no update action is needed and hence an emptyListis returned.- Parameters:
 newProduct- new product draft, which provides the prices to update.variantId- the variantId needed for building the update action.oldPrice- the price which should be updated.newPrice- the price draft where we get the new custom fields and types.syncOptions- responsible for supplying the sync options to the sync utility method. It is used for triggering the error callback within the utility, in case of errors.- Returns:
 - A list with the custom field/type update actions or an empty list if the custom fields/types are identical.
 
 
 - 
 
 -