Class OfferDiscount
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.web.context.info.OfferDiscount
-
- All Implemented Interfaces:
Serializable
public class OfferDiscount extends Object implements Serializable
Additional info for all theofferstreating anEnhancedLineItemas a target. WhileItemOfferAdjustmentstrack the price adjustment effects of targeting offers, "offer discounts" track whichOffer.getTargetItemCriteria()matched theEnhancedLineItemand how many were matched.- Author:
- Nathan Moore (nathanmoore).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OfferDiscount()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OfferDiscountcopy(com.broadleafcommerce.common.extension.TypeFactory offerFactory)Creates a copy of this offer discount.CandidateItemOffergetCandidateItemOffer()TheCandidateItemOfferDTO related tooffer.intgetFinalizedQuantity()The actual item quantity of anEnhancedLineItemmatched to theoffer.LineItemOfferDetailgetLineItemOfferDetail()OffergetOffer()intgetQuantity()The potential item quantity of anEnhancedLineItemthat matched theoffer.ItemCriteriaRulegetTargetItemCriteria()TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.intincrementQuantity(int incrementQuantity)Increments thequantityby the given amount.voidsetCandidateItemOffer(CandidateItemOffer candidateItemOffer)TheCandidateItemOfferDTO related tooffer.voidsetFinalizedQuantity(int finalizedQuantity)The actual item quantity of anEnhancedLineItemmatched to theoffer.voidsetLineItemOfferDetail(LineItemOfferDetail lod)voidsetOffer(Offer offer)TheOffertargeting someEnhancedLineItem.voidsetQuantity(int quantity)The potential item quantity of anEnhancedLineItemthat matched theoffer.voidsetTargetItemCriteria(ItemCriteriaRule targetItemCriteria)TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.Optional<OfferDiscount>split(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int splitQty)Checks to see that the discount quantities match the target quantities.StringtoString()
-
-
-
Method Detail
-
setLineItemOfferDetail
public void setLineItemOfferDetail(LineItemOfferDetail lod)
-
getOffer
public Offer getOffer()
-
incrementQuantity
public int incrementQuantity(int incrementQuantity)
Increments thequantityby the given amount.- Parameters:
incrementQuantity- amount by which to incrementquantity- Returns:
- the new quantity
-
split
@NonNull public Optional<OfferDiscount> split(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory, int splitQty)
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
protected OfferDiscount copy(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
Creates a copy of this offer discount.- Parameters:
offerFactory- theTypeFactoryrequired to create a new instance- Returns:
- the copied instance
-
setOffer
public void setOffer(Offer offer)
TheOffertargeting someEnhancedLineItem.- Parameters:
offer- TheOffertargeting someEnhancedLineItem.
-
getCandidateItemOffer
public CandidateItemOffer getCandidateItemOffer()
TheCandidateItemOfferDTO related tooffer.- Returns:
- The
CandidateItemOfferDTO related tooffer.
-
setCandidateItemOffer
public void setCandidateItemOffer(CandidateItemOffer candidateItemOffer)
TheCandidateItemOfferDTO related tooffer.- Parameters:
candidateItemOffer- TheCandidateItemOfferDTO related tooffer.
-
getTargetItemCriteria
public ItemCriteriaRule getTargetItemCriteria()
TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.- Returns:
- The
Offer.getTargetItemCriteria()that anEnhancedLineItemmatched.
-
setTargetItemCriteria
public void setTargetItemCriteria(ItemCriteriaRule targetItemCriteria)
TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.- Parameters:
targetItemCriteria- TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.
-
getQuantity
public int getQuantity()
The potential item quantity of anEnhancedLineItemthat matched theoffer.- Returns:
- The potential item quantity of an
EnhancedLineItemthat matched theoffer.
-
setQuantity
public void setQuantity(int quantity)
The potential item quantity of anEnhancedLineItemthat matched theoffer.- Parameters:
quantity- The potential item quantity of anEnhancedLineItemthat matched theoffer.
-
getFinalizedQuantity
public int getFinalizedQuantity()
The actual item quantity of anEnhancedLineItemmatched to theoffer.- Returns:
- The actual item quantity of an
EnhancedLineItemmatched to theoffer.
-
setFinalizedQuantity
public void setFinalizedQuantity(int finalizedQuantity)
The actual item quantity of anEnhancedLineItemmatched to theoffer.- Parameters:
quantity- The actual item quantity of anEnhancedLineItemmatched to theoffer.
-
getLineItemOfferDetail
public LineItemOfferDetail getLineItemOfferDetail()
-
-