Class CartDiscountUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.cartdiscounts.utils.CartDiscountUpdateActionUtils
-
public final class CartDiscountUpdateActionUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeCartPredicateUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cartPredicates of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeIsActiveUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theBoolean
isActive values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeNameUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theLocalizedString
names of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeRequiresDiscountCodeUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theBoolean
requiresDiscountCode values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeSortOrderUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the sortOrder values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeStackingModeUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theStackingMode
stacking modes of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeTargetUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cart discount target values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildChangeValueUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cart discount values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildSetDescriptionUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theLocalizedString
descriptions of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildSetValidDatesUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validFrom andZonedDateTime
validUntil values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildSetValidFromUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validFrom values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>>
buildSetValidUntilUpdateAction(io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validUntil values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
.
-
-
-
Method Detail
-
buildChangeValueUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeValueUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cart discount values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same cart discount value, then no update action is needed and hence an emptyOptional
is returned.Note: Order is not significant when comparing
AbsoluteCartDiscountValue
s- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new cart discount value.- Returns:
- A filled optional with the update action or an empty optional if the cart discount values are identical.
-
buildChangeCartPredicateUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeCartPredicateUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cartPredicates of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same cartPredicate, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new cartPredicate.- Returns:
- A filled optional with the update action or an empty optional if the cartPredicates are identical.
-
buildChangeTargetUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeTargetUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the cart discount target values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same cart discount target, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new cart discount target.- Returns:
- A filled optional with the update action or an empty optional if the cart discount targets are identical.
-
buildChangeIsActiveUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeIsActiveUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theBoolean
isActive values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same 'isActive' value, then no update action is needed and hence an emptyOptional
is returned.Note: A
null
isActive
value in theCartDiscount
is treated as atrue
value which is the default value of CTP.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new isActive.- Returns:
- A filled optional with the update action or an empty optional if the isActive values are identical.
-
buildChangeNameUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeNameUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theLocalizedString
names of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same name, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new name.- Returns:
- A filled optional with the update action or an empty optional if the names are identical.
-
buildSetDescriptionUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildSetDescriptionUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theLocalizedString
descriptions of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same description, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new description.- Returns:
- A filled optional with the update action or an empty optional if the descriptions are identical.
-
buildChangeSortOrderUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeSortOrderUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares the sortOrder values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same sortOrder, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new sortOrder.- Returns:
- A filled optional with the update action or an empty optional if the sortOrders are identical.
-
buildChangeRequiresDiscountCodeUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeRequiresDiscountCodeUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theBoolean
requiresDiscountCode values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same requiresDiscountCode value, then no update action is needed and hence an emptyOptional
is returned.Note: A
null
requiresDiscountCode
value in theCartDiscount
is treated as afalse
value which is the default value of CTP.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new 'requiresDiscountCode'.- Returns:
- A filled optional with the update action or an empty optional if the 'requiresDiscountCode' values are identical.
-
buildSetValidFromUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildSetValidFromUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validFrom values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same validFrom, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new validFrom.- Returns:
- A filled optional with the update action or an empty optional if the validFrom values are identical.
-
buildSetValidUntilUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildSetValidUntilUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validUntil values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same validUntil, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new validUntil.- Returns:
- A filled optional with the update action or an empty optional if the validUntil values are identical.
-
buildSetValidDatesUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildSetValidDatesUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theZonedDateTime
validFrom andZonedDateTime
validUntil values of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. - If both theCartDiscount
and theCartDiscountDraft
have different validFrom and same validUntil values, then 'setValidFrom' update action returned. - If both theCartDiscount
and theCartDiscountDraft
have the same validFrom and different validUntil values, then 'setValidUntil' update action returned. - If both theCartDiscount
and theCartDiscountDraft
have different validFrom and different validUntil values, then 'setValidFromAndUntil' update action returned. - If both theCartDiscount
and theCartDiscountDraft
have same validFrom and validUntil values, then no update action is needed and hence an emptyOptional
is returned.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new validFrom and validUntil.- Returns:
- A filled optional with the update action or an empty optional if the validFrom and validUntil values are identical.
-
buildChangeStackingModeUpdateAction
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.cartdiscounts.CartDiscount>> buildChangeStackingModeUpdateAction(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscount oldCartDiscount, @Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft newCartDiscount)
Compares theStackingMode
stacking modes of aCartDiscount
and aCartDiscountDraft
and returns anUpdateAction
<CartDiscount
> as a result in anOptional
. If both theCartDiscount
and theCartDiscountDraft
have the same stacking mode, then no update action is needed and hence an emptyOptional
is returned.Note: A
null
stackingMode
value in theCartDiscount
is treated as aStackingMode.STACKING
value which is the default value of CTP.- Parameters:
oldCartDiscount
- the cart discount which should be updated.newCartDiscount
- the cart discount draft where we get the new stacking mode.- Returns:
- A filled optional with the update action or an empty optional if the stacking modes are identical.
-
-