public class PromotionContext
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM Copyright
|
Constructor and Description |
---|
PromotionContext(PromotionEngine aEngine, PromotionExecutionAgenda aAgenda, PromotionArgument aArgument)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void | addPromotionExecutionRecord(PromotionExecutionRecord record)
Append a promotion execution record to the list of current promotion execution records.
|
void | addPromotionExecutionRecordToArgument(PromotionExecutionRecord record)
Appends a promotion execution record to PromotionArgument.
|
ProtectedContextAttribute | addProtectedContextAttribute(java.lang.String name, ProtectedContextAttribute attr)
Adds a named protected context attribute.
|
void | addRewardOptionForPromotion(PromotionKey aPromotionKey, RewardOption aRewardOption)
Adds a RewardOption for a specific promotion.
|
java.lang.Object | addUnprotectedContextAttribute(java.lang.String name, java.lang.Object attr)
Adds a named un-protected context attribute.
|
com.ibm.commerce.marketing.promotion.coupon.Coupon | allocateCoupon(Promotion promotion)
Allocates an available coupon for a promotion
|
void | appendPromotionErrorReport(PromotionErrorReport report)
Appends a promotion error report to a list of error reports
|
java.lang.Object | clone() |
void | commitPCB(PromotionContext context)
Commits all the changes in the current promotion execution control block.
|
PromotionExecutionAgenda | getAgenda()
Gets the PromotionExecutionAgenda for the PromotionContext.
|
java.util.Enumeration | getApplicablePolicies(Promotion promotion)
Returns a list of promotion policies applicable to a promotion according to the PromotionExecutionAgenda.
|
PromotionArgument | getArgument()
Returns the argument.
|
java.lang.String | getCodeFor(Promotion promotion)
Returns the code entered for a promotion
|
java.util.Hashtable | getCodeToPromotionMap()
Returns the codeToPromotionMap.
|
com.ibm.commerce.marketing.promotion.coupon.Coupon[] | getCouponFor(Promotion promotion)
Returns an array of coupons entered for a promotion
|
java.util.Hashtable | getCouponToPromotionMap()
Returns the map between promotions and coupons
|
PriceConverter | getCurrencyConverter()
Returns a currency converter
|
PromotionExecutionRecord | getCurrentPromotionExecutionRecord()
Gets the current PromotionExecutionRecord object.
|
PromotionExecutionRecord[] | getCurrentResults()
Returns the currentResults.
|
PromotionEngine | getEngine()
Returns the engine.
|
java.util.Enumeration | getGovernedPromotions(PromotionPolicy policy)
Returns a list of promotions governed by a promotion policy according to the PromotionExecutionAgenda.
|
com.ibm.commerce.marketing.promotion.group.PromotionGroup[] | getGroups()
Returns all the promotion groups be evaluated in this invocation
|
LineItemSet | getLineItemsCanBeAffectedByCurrentPromotion()
Returns a LineItemSet of associated order items that can be affected by the current promotion.
|
LineItemSet | getLineItemsCanBeTargetedByCurrentPromotion()
Returns a LineItemSet of associated order items that can be targeted by the current promotion.
|
LineItemSet | getLineItemsCanNotBeAffectedByCurrentPromotion()
Returns a LineItemSet of associated order items that can no longer be affected by the current promotion.
|
LineItemSet | getLineItemsCanNotBeTargetedByCurrentPromotion()
Returns a LineItemSet of associated order items that can no longer be targeted by the current promotion.
|
Order | getOrder()
Returns the order to which promotions will be applied
|
LineItemSet | getOrderAsALineItemSet()
Returns the original order as an LineItemSet
|
java.lang.String | getOrderCurrency()
Returns the currency of the order
|
java.math.BigDecimal | getOrderQualifyingTotal(int types)
Returns the current order qualifying total for a combination of any of the four values: price, shipping, shipping tax, and tax.
|
java.math.BigDecimal | getOrderRunningTotal(int type)
Returns the running total for the order with which this OrderRunningTotalController was initialized.
|
Promotion | getPromotionCurrentlyUnderEvaluation()
Returns the current promotion under evaluation
|
PromotionErrorReport[] | getPromotionErrorReports()
Returns all the promotion error reports accumulated so far.
|
ProtectedContextAttribute | getProtectedContextAttribute(java.lang.String name)
Returns a protected context attribute object.
|
OrderQualifyingTotal | getQualifyingTotalObject()
Returns the qualifying total object on the context object
|
int | getRedemptionCountForThisPromotion(Promotion promotion)
Returns the number of times a promotion has been redeemed
|
int | getRedemptionCountForThisPromotionForCurrentShopper(Promotion promotion)
Returns the number of times a promotion has been redeemed by a shopper
|
int | getRedemptionCountForThisPromotionInCurrentOrder(Promotion promotion)
Returns the number of times a promotion has been redeemed in this order
|
java.util.List | getRewardOptionForPromotion(PromotionKey aPromotionKey)
Gets list of RewardOption object for a specific promotion.
|
java.util.Map | getRewardOptions()
Gets the RewardOption map object.
|
Rounding | getRounding()
Returns a rounding
|
java.math.BigDecimal | getRunningTotalFor(AssociatedOrderItem[] items, int type)
Returns the running total for an array of order items or portions of them as identified by the AssociatedOrderItem array parameter.
|
java.math.BigDecimal | getRunningTotalFor(AssociatedOrderItem anItem, int type)
Returns the running total for an order item or a portion of it as identified by the AssociatedOrderItem parameter.
|
java.math.BigDecimal | getRunningTotalFor(LineItemSet set, int type)
Returns the running total for everything in a LineItemSet.
|
java.math.BigDecimal | getRunningTotalFor(OrderItem item, int type)
Returns the running total for an order item.
|
OrderRunningTotal | getRunningTotalObject()
Returns the running total object on the context object
|
java.util.Vector | getSequence()
Returns the sequence.
|
java.util.Map<java.lang.String,java.lang.String> | getSimulatedPromotionEvaluationConfigurations()
Gets the Map object that contains the optional evaluation configurations as name value pairs.
|
StoreKey | getStoreKey()
Returns the key of the store
|
java.lang.Object | getUnprotectedContextAttribute(java.lang.String name)
Returns an un-protected context attribute object.
|
boolean | hasNextPromotion()
Returns true if there are more promotions to be evaluated in the promotion evaluation sequence
|
void | initPCB(PromotionContext context)
Initializes the promotion execution control block
|
boolean | isCodeEnteredFor(Promotion promotion)
Checks if promotion code is entered for a promotion or not
|
boolean | isCouponAddedFor(Promotion promotion)
Checks to see if coupon has been added for a promotion
|
boolean | isPricePresent()
Indicates if price is calculated when this template is invoked.
|
boolean | isShippingChargePresent()
Indicates if shipping charge is calculated when this template is invoked.
|
boolean | isShippingTaxPresent()
Indicates if shipping tax is calculated when this template is invoked.
|
boolean | isTaxPresent()
Indicates if tax is calculated when this template is invoked.
|
boolean | isUnderSimulatedPromotionEvaluationMode()
Return true or false that indicates the promotion engine is evaluating under simulated mode.
|
java.util.Enumeration | listAllPromotionPolicies()
Lists all promotion policies in the execution agenda
|
java.util.Enumeration | listAllPromotions()
Lists all promotions in the execution agenda
|
void | markLineItemsNotToBeAffectedByPromotionAtCurrentGroupLevel(LineItemSet items)
Temporarily marks line items to be ineligible to receive any adjustments.
|
void | markLineItemsNotToBeAffectedByPromotionAtGlobalLevel(LineItemSet items)
Temporarily marks a set of order items as can no longer be affected by any promotion.
|
void | markLineItemsNotToBeTargetedByPromotionAtCurrentGroupLevel(LineItemSet items)
Temporarily marks line items to be not targetable by promotions in the same group as the promotion currently under evaluation.
|
void | markLineItemsNotToBeTargetedByPromotionAtGlobalLevel(LineItemSet items)
Temporarily marks a set of order items as no longer targetable by any promotion.
|
void | markPromotionAsNotApplicable(Promotion promotion)
Temporarily marks a promotion as no longer applicable to the current order.
|
Promotion | nextPromotion()
Returns next promotion in the promotion evaluation sequence.
|
void | reduceOrderQualifyingTotal(java.math.BigDecimal amount, int types)
Reduces the amount and type of order qualifying total
|
void | releaseCoupon(com.ibm.commerce.marketing.promotion.coupon.Coupon coupon)
Releases a coupon to the pool of available coupons
|
protected void | removePromotionFromSequence(Promotion promotion)
Marks a promotion on the promotion evaluation sequence as no longer applicable to the current order.
|
void | resetRewardOptions()
Reset RewardOption map object to its original state.
|
void | rollbackPCB(PromotionContext context)
Rolls back all the changes in the current promotion execution control block.
|
void | setAgenda(PromotionExecutionAgenda aAgenda)
Sets the PromotionExecutionAgenda for the PromotionContext.
|
void | setArgument(PromotionArgument aArgument)
Sets the argument.
|
void | setCodeToPromotionMap(java.util.Hashtable aCodeToPromotionMap)
Sets the codeToPromotionMap.
|
void | setCouponToPromotionMap(java.util.Hashtable hashtable)
Sets the promotion to coupon map.
|
void | setCurrencyConverter(PriceConverter converter)
Sets the currency converter
|
void | setCurrentPromotionExecutionRecord(PromotionExecutionRecord aPromotionExecutionRecord)
Sets the PromotionExecutionRecord object.
|
void | setCurrentResults(PromotionExecutionRecord[] aCurrentResults)
Sets the currentResult.
|
void | setMask(boolean[] aMask)
Sets the mask.
|
void | setOrder(Order aOrder)
Sets the order to which promotions will be applied
|
void | setRewardOptions(java.util.Map aMap)
Sets the RewardOption map object.
|
void | setRounding(Rounding newRounding)
Sets the currency rounding tool
|
void | setSequence(java.util.Vector aSequence)
Sets the sequence.
|
void | setStoreKey(StoreKey key)
Sets the store key
|
int | tentativelyApplyMonetaryAdjustment(PromotionExecutionRecord record)
Calculates monetary adjustments as a result of applying a promotion, updates the running total accordingly.
|
public static final java.lang.String COPYRIGHT
public PromotionContext(PromotionEngine aEngine, PromotionExecutionAgenda aAgenda, PromotionArgument aArgument)
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public boolean hasNextPromotion()
public Promotion getPromotionCurrentlyUnderEvaluation()
public Promotion nextPromotion()
public void markPromotionAsNotApplicable(Promotion promotion)
protected void removePromotionFromSequence(Promotion promotion)
public java.util.Enumeration getApplicablePolicies(Promotion promotion)
public java.util.Enumeration getGovernedPromotions(PromotionPolicy policy)
public LineItemSet getLineItemsCanBeTargetedByCurrentPromotion()
public LineItemSet getLineItemsCanBeAffectedByCurrentPromotion()
public LineItemSet getLineItemsCanNotBeTargetedByCurrentPromotion()
public LineItemSet getLineItemsCanNotBeAffectedByCurrentPromotion()
public void markLineItemsNotToBeTargetedByPromotionAtGlobalLevel(LineItemSet items)
public void markLineItemsNotToBeAffectedByPromotionAtGlobalLevel(LineItemSet items)
public void markLineItemsNotToBeTargetedByPromotionAtCurrentGroupLevel(LineItemSet items)
public void markLineItemsNotToBeAffectedByPromotionAtCurrentGroupLevel(LineItemSet items)
public PromotionEngine getEngine()
public boolean isCodeEnteredFor(Promotion promotion)
public java.lang.String getCodeFor(Promotion promotion)
public PromotionExecutionRecord[] getCurrentResults()
public void setCurrentResults(PromotionExecutionRecord[] aCurrentResults)
public PromotionArgument getArgument()
public void setArgument(PromotionArgument aArgument)
public void addPromotionExecutionRecordToArgument(PromotionExecutionRecord record)
public void addPromotionExecutionRecord(PromotionExecutionRecord record)
public java.util.Hashtable getCodeToPromotionMap()
public java.util.Vector getSequence()
public void setCodeToPromotionMap(java.util.Hashtable aCodeToPromotionMap)
public void setSequence(java.util.Vector aSequence)
public void setMask(boolean[] aMask)
public int getRedemptionCountForThisPromotionInCurrentOrder(Promotion promotion)
public int getRedemptionCountForThisPromotionForCurrentShopper(Promotion promotion)
public int getRedemptionCountForThisPromotion(Promotion promotion)
public com.ibm.commerce.marketing.promotion.group.PromotionGroup[] getGroups()
public void commitPCB(PromotionContext context)
public void rollbackPCB(PromotionContext context)
public void initPCB(PromotionContext context)
public java.util.Hashtable getCouponToPromotionMap()
public void setCouponToPromotionMap(java.util.Hashtable hashtable)
public com.ibm.commerce.marketing.promotion.coupon.Coupon[] getCouponFor(Promotion promotion)
public boolean isCouponAddedFor(Promotion promotion)
public com.ibm.commerce.marketing.promotion.coupon.Coupon allocateCoupon(Promotion promotion)
public void releaseCoupon(com.ibm.commerce.marketing.promotion.coupon.Coupon coupon)
public java.math.BigDecimal getOrderQualifyingTotal(int types)
public java.math.BigDecimal getRunningTotalFor(AssociatedOrderItem anItem, int type)
public java.math.BigDecimal getRunningTotalFor(AssociatedOrderItem[] items, int type)
public java.math.BigDecimal getRunningTotalFor(LineItemSet set, int type)
public java.math.BigDecimal getOrderRunningTotal(int type)
public java.math.BigDecimal getRunningTotalFor(OrderItem item, int type)
public int tentativelyApplyMonetaryAdjustment(PromotionExecutionRecord record)
public Order getOrder()
public LineItemSet getOrderAsALineItemSet()
public PriceConverter getCurrencyConverter()
public Rounding getRounding()
public StoreKey getStoreKey()
public void setOrder(Order aOrder)
public void setCurrencyConverter(PriceConverter converter)
public void setRounding(Rounding newRounding)
public void setStoreKey(StoreKey key)
public java.lang.String getOrderCurrency()
public OrderRunningTotal getRunningTotalObject()
public OrderQualifyingTotal getQualifyingTotalObject()
public boolean isPricePresent()
public boolean isShippingChargePresent()
public boolean isShippingTaxPresent()
public boolean isTaxPresent()
public java.util.Enumeration listAllPromotions()
public java.util.Enumeration listAllPromotionPolicies()
public void appendPromotionErrorReport(PromotionErrorReport report)
public PromotionErrorReport[] getPromotionErrorReports()
public ProtectedContextAttribute addProtectedContextAttribute(java.lang.String name, ProtectedContextAttribute attr)
public ProtectedContextAttribute getProtectedContextAttribute(java.lang.String name)
public java.lang.Object addUnprotectedContextAttribute(java.lang.String name, java.lang.Object attr)
public java.lang.Object getUnprotectedContextAttribute(java.lang.String name)
public void reduceOrderQualifyingTotal(java.math.BigDecimal amount, int types)
public void setRewardOptions(java.util.Map aMap)
public void resetRewardOptions()
public java.util.Map getRewardOptions()
public java.util.List getRewardOptionForPromotion(PromotionKey aPromotionKey)
public void addRewardOptionForPromotion(PromotionKey aPromotionKey, RewardOption aRewardOption)
public PromotionExecutionAgenda getAgenda()
public void setAgenda(PromotionExecutionAgenda aAgenda)
public PromotionExecutionRecord getCurrentPromotionExecutionRecord()
public void setCurrentPromotionExecutionRecord(PromotionExecutionRecord aPromotionExecutionRecord)
public boolean isUnderSimulatedPromotionEvaluationMode()
public java.util.Map<java.lang.String,java.lang.String> getSimulatedPromotionEvaluationConfigurations()