java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.info.OfferQualifier
All Implemented Interfaces:
Serializable

public class OfferQualifier extends Object implements Serializable
DTO containing information about the order items used by an Offer as item qualifiers. This includes the quantity used and and the Offer.getItemQualifierCriteria() an order item matched.
Author:
Nathan Moore (nathanmoore).
See Also:
  • Constructor Details

    • OfferQualifier

      public OfferQualifier()
  • Method Details

    • incrementQuantity

      public int incrementQuantity(int incrementQuantity)
      Increments the quantity by the given amount.
      Parameters:
      incrementQuantity - amount by which to increment quantity
      Returns:
      the new quantity
    • split

      @NonNull public OfferQualifier split(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory, int splitItemQty)
      Checks to see that the discount quantities match the target quantities. If not, splits this item into two.
      Returns:
      the item created by splitting
    • copy

      public OfferQualifier copy(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
      Creates a copy of this offer discount.
      Parameters:
      offerFactory - the TypeFactory required to create a new instance
      Returns:
      the copied instance
    • getOffer

      public Offer getOffer()
      The Offer using some EnhancedLineItem as an item qualifier.
      Returns:
      The Offer using some EnhancedLineItem as an item qualifier.
    • getItemQualifierCriteria

      public ItemCriteriaRule getItemQualifierCriteria()
      Returns:
      The Offer.getItemQualifierCriteria() that an EnhancedLineItem matched.
    • getLineNumber

      public String getLineNumber()
      The line item number of the EnhancedLineItem that this qualifier represents.
      Returns:
      The line item number of the EnhancedLineItem that this qualifier represents.
    • getUsageDetails

      public Map<String,Integer> getUsageDetails()
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this qualifier.
      Returns:
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this qualifier.
    • getQuantity

      public int getQuantity()
      The potential item quantity of an EnhancedLineItem that matched the offer.
      Returns:
      The potential item quantity of an EnhancedLineItem that matched the offer.
    • getFinalizedQuantity

      public int getFinalizedQuantity()
      The actual item quantity of an EnhancedLineItem matched to the offer.
      Returns:
      The actual item quantity of an EnhancedLineItem matched to the offer.
    • getPrice

      public javax.money.MonetaryAmount getPrice()
      Tracks the discount amount of the related item qualifier. The discount amount will be 0 if this item was only used as a qualifier.
    • setOffer

      public void setOffer(Offer offer)
      The Offer using some EnhancedLineItem as an item qualifier.
      Parameters:
      offer - The Offer using some EnhancedLineItem as an item qualifier.
    • setItemQualifierCriteria

      public void setItemQualifierCriteria(ItemCriteriaRule itemQualifierCriteria)
      Parameters:
      itemQualifierCriteria - The Offer.getItemQualifierCriteria() that an EnhancedLineItem matched.
    • setLineNumber

      public void setLineNumber(String lineNumber)
      The line item number of the EnhancedLineItem that this qualifier represents.
      Parameters:
      quantity - The line item number of the EnhancedLineItem that this qualifier represents.
    • setUsageDetails

      public void setUsageDetails(Map<String,Integer> usageDetails)
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this qualifier.
      Parameters:
      quantity - A map of usageIds to quantity of the EnhancedLineItem for the usages of this qualifier.
    • setQuantity

      public void setQuantity(int quantity)
      The potential item quantity of an EnhancedLineItem that matched the offer.
      Parameters:
      quantity - The potential item quantity of an EnhancedLineItem that matched the offer.
    • setFinalizedQuantity

      public void setFinalizedQuantity(int finalizedQuantity)
      The actual item quantity of an EnhancedLineItem matched to the offer.
      Parameters:
      quantity - The actual item quantity of an EnhancedLineItem matched to the offer.
    • setPrice

      public void setPrice(javax.money.MonetaryAmount price)
      Tracks the discount amount of the related item qualifier. The discount amount will be 0 if this item was only used as a qualifier.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object