org.broadleafcommerce.core.offer.domain
Class CandidateItemOfferImpl
java.lang.Object
org.broadleafcommerce.core.offer.domain.CandidateQualifiedOfferImpl
org.broadleafcommerce.core.offer.domain.CandidateItemOfferImpl
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, CandidateItemOffer, CandidateOffer, CandidateQualifiedOffer
@Entity
public class CandidateItemOfferImpl
- extends CandidateQualifiedOfferImpl
- implements CandidateItemOffer, java.lang.Cloneable
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
LOG
public static final org.apache.commons.logging.Log LOG
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
id
protected java.lang.Long id
orderItem
protected OrderItem orderItem
offer
protected Offer offer
potentialSavings
protected Money potentialSavings
CandidateItemOfferImpl
public CandidateItemOfferImpl()
getId
public java.lang.Long getId()
- Specified by:
getId in interface CandidateOffer
setId
public void setId(java.lang.Long id)
- Specified by:
setId in interface CandidateOffer
getOrderItem
public OrderItem getOrderItem()
- Specified by:
getOrderItem in interface CandidateItemOffer
setOrderItem
public void setOrderItem(OrderItem orderItem)
- Specified by:
setOrderItem in interface CandidateItemOffer
setOffer
public void setOffer(Offer offer)
- Specified by:
setOffer in interface CandidateOffer
getPriority
public int getPriority()
- Specified by:
getPriority in interface CandidateOffer
getOffer
public Offer getOffer()
- Specified by:
getOffer in interface CandidateOffer
getPotentialSavings
public Money getPotentialSavings()
- Specified by:
getPotentialSavings in interface CandidateItemOffer
calculatePotentialSavings
protected Money calculatePotentialSavings()
- This method determines how much the customer might save using this promotion for the
purpose of sorting promotions with the same priority. The assumption is that any possible
target specified for BOGO style offers are of equal or lesser value. We are using
a calculation based on the qualifiers here strictly for rough comparative purposes.
If two promotions have the same priority, the one with the highest potential savings
will be used as the tie-breaker to determine the order to apply promotions.
This method makes a good approximation of the promotion value as determining the exact value
would require all permutations of promotions to be run resulting in a costly
operation.
- Returns:
calculateMaximumNumberOfUses
protected int calculateMaximumNumberOfUses()
- Determines the maximum number of times this promotion can be used based on the
ItemCriteria and promotion's maxQty setting.
calculateMaxUsesForItemCriteria
protected int calculateMaxUsesForItemCriteria(OfferItemCriteria itemCriteria,
Offer promotion)
checkCloneable
public void checkCloneable(CandidateItemOffer itemOffer)
throws java.lang.CloneNotSupportedException,
java.lang.SecurityException,
java.lang.NoSuchMethodException
- Throws:
java.lang.CloneNotSupportedException
java.lang.SecurityException
java.lang.NoSuchMethodException
clone
public CandidateItemOffer clone()
- Specified by:
clone in interface CandidateItemOffer- Overrides:
clone in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals in class java.lang.Object
Copyright © 2011. All Rights Reserved.