Class 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeCartPredicateUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the cartPredicates of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeIsActiveUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the Boolean isActive values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeNameUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the LocalizedString names of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeRequiresDiscountCodeUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the Boolean requiresDiscountCode values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeSortOrderUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the sortOrder values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeStackingModeUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the StackingMode stacking modes of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeTargetUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the cart discount target values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeValueUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the cart discount values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetDescriptionUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the LocalizedString descriptions of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidDatesUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the ZonedDateTime validFrom and ZonedDateTime validUntil values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidFromUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the ZonedDateTime validFrom values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidUntilUpdateAction​(com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount, com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
      Compares the ZonedDateTime validUntil values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • buildChangeValueUpdateAction

        @Nonnull
        public static java.util.Optional<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeValueUpdateAction​(@Nonnull
                                                                                                                                           com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                           @Nonnull
                                                                                                                                           com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the cart discount values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same cart discount value, then no update action is needed and hence an empty Optional is returned.

        Note: Order is not significant when comparing CartDiscountValueAbsolutes

        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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeCartPredicateUpdateAction​(@Nonnull
                                                                                                                                                   com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                                   @Nonnull
                                                                                                                                                   com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the cartPredicates of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same cartPredicate, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeTargetUpdateAction​(@Nonnull
                                                                                                                                            com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                            @Nonnull
                                                                                                                                            com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the cart discount target values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same cart discount target, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeIsActiveUpdateAction​(@Nonnull
                                                                                                                                              com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                              @Nonnull
                                                                                                                                              com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the Boolean isActive values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same 'isActive' value, then no update action is needed and hence an empty Optional is returned.

        Note: A null isActive value in the CartDiscount is treated as a true 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeNameUpdateAction​(@Nonnull
                                                                                                                                          com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                          @Nonnull
                                                                                                                                          com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the LocalizedString names of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same name, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetDescriptionUpdateAction​(@Nonnull
                                                                                                                                              com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                              @Nonnull
                                                                                                                                              com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the LocalizedString descriptions of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same description, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeSortOrderUpdateAction​(@Nonnull
                                                                                                                                               com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                               @Nonnull
                                                                                                                                               com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the sortOrder values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same sortOrder, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeRequiresDiscountCodeUpdateAction​(@Nonnull
                                                                                                                                                          com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                                          @Nonnull
                                                                                                                                                          com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the Boolean requiresDiscountCode values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same requiresDiscountCode value, then no update action is needed and hence an empty Optional is returned.

        Note: A null requiresDiscountCode value in the CartDiscount is treated as a false 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidFromUpdateAction​(@Nonnull
                                                                                                                                            com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                            @Nonnull
                                                                                                                                            com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the ZonedDateTime validFrom values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same validFrom, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidUntilUpdateAction​(@Nonnull
                                                                                                                                             com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                             @Nonnull
                                                                                                                                             com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the ZonedDateTime validUntil values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same validUntil, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildSetValidDatesUpdateAction​(@Nonnull
                                                                                                                                             com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                             @Nonnull
                                                                                                                                             com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the ZonedDateTime validFrom and ZonedDateTime validUntil values of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. - If both the CartDiscount and the CartDiscountDraft have different validFrom and same validUntil values, then 'setValidFrom' update action returned. - If both the CartDiscount and the CartDiscountDraft have the same validFrom and different validUntil values, then 'setValidUntil' update action returned. - If both the CartDiscount and the CartDiscountDraft have different validFrom and different validUntil values, then 'setValidFromAndUntil' update action returned. - If both the CartDiscount and the CartDiscountDraft have same validFrom and validUntil values, then no update action is needed and hence an empty Optional 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<com.commercetools.api.models.cart_discount.CartDiscountUpdateAction> buildChangeStackingModeUpdateAction​(@Nonnull
                                                                                                                                                  com.commercetools.api.models.cart_discount.CartDiscount oldCartDiscount,
                                                                                                                                                  @Nonnull
                                                                                                                                                  com.commercetools.api.models.cart_discount.CartDiscountDraft newCartDiscount)
        Compares the StackingMode stacking modes of a CartDiscount and a CartDiscountDraft and returns an CartDiscountUpdateAction as a result in an Optional. If both the CartDiscount and the CartDiscountDraft have the same stacking mode, then no update action is needed and hence an empty Optional is returned.

        Note: A null stackingMode value in the CartDiscount is treated as a StackingMode.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.