Class CartItemOfferUtils

java.lang.Object
com.broadleafcommerce.cartoperation.service.util.offer.CartItemOfferUtils

public class CartItemOfferUtils extends Object
Utility class to aid in processing CartItems regarding offers.
Author:
Sunny Yu
  • Constructor Summary

    Constructors
    Constructor
    Description
    CartItemOfferUtils(com.fasterxml.jackson.databind.ObjectMapper mapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.order.common.domain.Adjustment
    Converts the given Object to an Adjustment.
    com.broadleafcommerce.order.common.domain.Adjustment
    getFreeGiftAdjustment(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Gets the temporarily stored Adjustment for the free gift item.
    protected com.fasterxml.jackson.databind.ObjectMapper
     
    getOriginOfferId(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Gets the id of the offer that this CartItem was a target of.
    List<com.broadleafcommerce.order.common.domain.OfferItemDetail>
    getQualifierCartItemDetails(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Gets the offer qualifier OfferItemDetails that the given CartItem was a target of.
    getQualifierCartItemIds(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    The ids of the offer qualifier CartItems that the given CartItem was added from.
    boolean
    isFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Identifies if the given CartItem is a free gift item.
    void
    removeIsFreeGiftItemFlag(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Removes the CartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM attribute from the given CartItem.getInternalAttributes().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CartItemOfferUtils

      public CartItemOfferUtils(com.fasterxml.jackson.databind.ObjectMapper mapper)
  • Method Details

    • isFreeGiftItem

      public boolean isFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Identifies if the given CartItem is a free gift item.
      Parameters:
      cartItem - CartItem to check against
      Returns:
      true if the given CartItem is a free gift item, otherwise false
    • removeIsFreeGiftItemFlag

      public void removeIsFreeGiftItemFlag(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Removes the CartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM attribute from the given CartItem.getInternalAttributes().
      Parameters:
      cartItem - CartItem to remove the CartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM from
    • getFreeGiftAdjustment

      public com.broadleafcommerce.order.common.domain.Adjustment getFreeGiftAdjustment(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Gets the temporarily stored Adjustment for the free gift item.
      See Also:
    • getQualifierCartItemIds

      public List<String> getQualifierCartItemIds(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      The ids of the offer qualifier CartItems that the given CartItem was added from.
      Parameters:
      cartItem - CartItem to get the offer qualifier cart item ids from
      Returns:
      The ids of the offer qualifier CartItems that the given CartItem was added from
    • getQualifierCartItemDetails

      public List<com.broadleafcommerce.order.common.domain.OfferItemDetail> getQualifierCartItemDetails(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Gets the offer qualifier OfferItemDetails that the given CartItem was a target of.
      Parameters:
      cartItem - the CartItem to get the offer qualifier OfferItemDetails from
      Returns:
      the offer qualifier OfferItemDetails that the given CartItem was a target of
    • convertAdjustment

      protected com.broadleafcommerce.order.common.domain.Adjustment convertAdjustment(Object adjustment)
      Converts the given Object to an Adjustment.
      Parameters:
      adjustment - the Object to convert from
      Returns:
      an Adjustment converted from Object
    • getOriginOfferId

      public String getOriginOfferId(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Gets the id of the offer that this CartItem was a target of. In other words, this id identifies which offer this CartItem was added from.
      Parameters:
      cartItem - CartItem to get the target offer id from
      Returns:
      the id of the offer that this CartItem was a target of
      See Also:
    • getMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getMapper()