public final class ProductVariantPriceUpdateActionUtils
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.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 a
Price and a PriceDraft and returns a list of
UpdateAction <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 a
ChangePrice action based on the comparison of the following fields of the
supplied Price and PriceDraft :
Price.getValue() and PriceDraft.getValue()
Price.getTiers() and PriceDraft.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 a
Price and a PriceDraft and
returns a list of UpdateAction <Product > as a result. |
@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)
Price
and a PriceDraft
and returns a list of
UpdateAction
<Product
> as a result. If both the Price
and the
PriceDraft
have identical fields, then no update action is needed and hence an empty
List
is returned.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.@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)
ChangePrice
action based on the comparison of the following fields of the
supplied Price
and PriceDraft
:
Price.getValue()
and PriceDraft.getValue()
Price.getTiers()
and PriceDraft.getTiers()
If any of the aforementioned fields are different a ChangePrice
update action will
be returned in an Optional
, otherwise if both are identical in the Price
and
the PriceDraft
, then no update action is needed and hence an empty Optional
is
returned.
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.@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)
Price
and a PriceDraft
and
returns a list of UpdateAction
<Product
> as a result. If both the Price
and the PriceDraft
have identical custom fields and types, then no update action
is needed and hence an empty List
is returned.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.