public class PromotionExecutionRecord extends java.lang.Object implements XMLizable, java.lang.Cloneable
XML Snippet for PromotionExecutionRecord:
<PromotionExecutionRecord impl="com.ibm.commerce.marketing.promotion.runtime.PromotionExecutionRecord"> <EngineName>Promotion engine name</EngineName> <Code>abcd</Code> <OrderKey><OrderId>1234</OrderId></OrderKey> <PromotionKey> <PromotionName>DollarsOffPromotionOne</PromotionName> <StoreKey> <DN>o=Root Organization</DN> <Identifier>BlueStore 201</Identifier> </StoreKey> <Version>0</Version> <Revision>0</Revision> </PromotionKey> <State>ELIMINATED</State> <PromotionPolicyKey> <PolicyName>A policy</PolicyName> <StoreKey> <DN>o=root organization</DN> <Identifier>BlueStore 202</Identifier> </StoreKey> </PromotionPolicyKey> <TargetedItems> <LineItemSet> <AssociatedOrderItem impl="com.ibm.commerce.marketing.promotion.runtime.AssociatedOrderItem" > <OrderItemKey> <OrderItemId>1234</OrderItemId> </OrderItemKey> <StartIndex>2</StartIndex> <Quantity>4</Quantity> </AssociatedOrderItem> <AssociatedOrderItem impl="com.ibm.commerce.marketing.promotion.runtime.AssociatedOrderItem" > <OrderItemKey> <OrderItemId>3456</OrderItemId> </OrderItemKey> <StartIndex>1</StartIndex> <Quantity>9</Quantity> </AssociatedOrderItem> </LineItemSet> </TargetedItems> <TargetedAmount>500</TargetedAmount> <!-- The types of monetary value targeted by the this promotion, see the 4 constants of MonetaryAdjustment PRICE, SHIPPING, SHIPPING_TAX, and TAX --> <TargetedAmountTypes>1</TargetedAmountTypes> <AppliedAdjustments> <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffAdjustment"> <AmountOff>15</AmountOff> <Currency>CAD</Currency> <!-- wholeOrder or AllAffectedItems or IndividualAffectedItems --> <AdjustmentType>wholeOrder</AdjustmentType> </Adjustment> <AffectedItems> <LineItemSet> <AssociatedOrderItem impl="com.ibm.commerce.marketing.promotion.runtime.AssociatedOrderItem" > <OrderItemKey> <OrderItemId>1234</OrderItemId> </OrderItemKey> <StartIndex>2</StartIndex> <Quantity>4</Quantity> </AssociatedOrderItem> <AssociatedOrderItem impl="com.ibm.commerce.marketing.promotion.runtime.AssociatedOrderItem" > <OrderItemKey> <OrderItemId>3456</OrderItemId> </OrderItemKey> <StartIndex>1</StartIndex> <Quantity>9</Quantity> </AssociatedOrderItem> </LineItemSet> </AffectedItems> </AppliedAdjustments> </PromotionExecutionRecord>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright
|
static int |
STATE_APPLIED
Actual changes are made to the order and the order should be fulfilled.
|
static int |
STATE_ASSESSED
A promotion is applicable to the current order.
|
static int |
STATE_ELIMINATED
A promotion is applicable to the current order, but due to policy
violations it should not be applied
|
static int |
STATE_EXPIRED
Reward has expired, either due to the order to which it is applicable to
has changed or a session has started
|
static int |
STATE_INIT
A PromotionExecutionRecord has just been created, initial state
|
static int |
STATE_QUALIFIED
A promotion is applicable to the current order.
|
static int |
STATE_REJECTED
User declined this reward.
|
static int |
STATE_WAIT_FOR_USER_CHOICE
A promotion is applicable but there are more than one choices available.
|
Constructor and Description |
---|
PromotionExecutionRecord(PromotionEngine aEngine)
Constructor for the PromotionExecutionRecord.
|
PromotionExecutionRecord(PromotionExecutionRecord aPreviousInChain)
Constructor for the PromotionExecutionRecord.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomeValue(java.lang.String name,
XMLizable value)
Sets a custom value on PromotionExecutionRecord
|
void |
applied()
Sets the state of this record to STATE_APPLIED, raises a
PromotionAppliedEvent . |
void |
assessed()
Sets the state of this record to STATE_ASSESSED and raise a
PromotionAssessedEvent |
java.lang.Object |
clone() |
void |
eliminated()
Sets the state of this record to STATE_ELIMINATED, raises a
PromotionEliminatedEvent . |
void |
fromXML(org.w3c.dom.Node node)
Transforms the XML node into its corresponding real Object.
|
Adjustment[] |
getAdjustments()
Returns the adjustments associated with the PromotionExecutionRecord.
|
LineItemSet[] |
getAffectedItems()
Returns the list of order items to which the adjustment will be applied.
|
java.lang.Long[] |
getAffectedOrderItemIDs(int type)
Deprecated.
not for general public use. For order subsystem only in the
V5.6 release, no future support for this is planned.
|
AssociatedOrderItem[] |
getAffectedOrderItems(Adjustment adjustment)
Returns all the order items (or portions of order items) affected by a
particular adjustment
|
java.lang.String |
getCode()
Returns the promotion code.
|
com.ibm.commerce.marketing.promotion.coupon.Coupon |
getCoupon()
Returns the coupon redeemed in this promotion
|
com.ibm.commerce.marketing.promotion.coupon.CouponKey |
getCouponKey()
Returns the coupon key of the promotion
|
java.util.Date |
getCouponValTime()
Gets time to validate coupon
|
XMLizable |
getCustomValue(java.lang.String name)
Getter for a custom value saved in the PromotionExecutionRecord
|
PromotionEngine |
getEngine()
Returns the associated promotion engine.
|
java.lang.String |
getEngineName()
Returns the name of the PromotionEngine which created this promotion
execution record
|
java.math.BigDecimal |
getMonetaryAdjustmentForOrder(int type)
Returns all the monetary adjustment on "type" (that is price, shipping
charge, tax, shipping tax).
|
java.math.BigDecimal |
getMonetaryAdjustmentTotalForOrderItem(java.lang.Long orderItemID,
int type)
Deprecated.
not for general public use. For order subsystem only in the
V5.6 release, no future support for this is planned.
|
PromotionExecutionRecord |
getNextChoice()
In the case of a choice of rewards, it returns the next option.
|
Order |
getOrder()
Returns the order to which the reward applies.
|
OrderKey |
getOrderKey()
Returns the order key of the promotion
|
Promotion |
getPromotion()
Returns the promotion of the PromotionExecutionRecord.
|
PromotionKey |
getPromotionKey()
Returns the unique promotion key for the promotion
|
java.util.List |
getRewardOptions()
Gets a list of RewardOption objects that are associated with this record.
|
int |
getState()
Returns the state of the PromotionExecutionRecord namely one of the
values of the constants STATE_INIT, STATE_WAIT_FOR_USER_CHOICE,
STATE_ELIMINATED, STATE_ASSESSED, STATE_EXPIRED, STATE_QUALIFIED,
STATE_REJECTED or STATE_APPLIED.
|
java.math.BigDecimal |
getTargetedAmount()
Returns the targeted monetary amount used to qualify for this promotion,
in order currency.
|
int |
getTargetedAmountTypes()
Return the targeted monetary value types, if this promotion targets order
qualifying total
|
LineItemSet |
getTargetedItems()
Returns the targeted items of the promotion in the
PromotionExecutionRecord.
|
AssociatedOrderItem[] |
getTargetedOrderItems()
Returns all the order items (or portions of order items) targeted by this
promotion
|
PromotionPolicy |
getViolatedPolicy()
Returns the policy that is violated by this promotion, if it has been
violated; else return null.
|
PromotionPolicyKey |
getViolatedPolicyKey()
Returns the violated promotion policy key
|
boolean |
isCodeEntered()
Checks to see if a promotion code is entered for the
PromotionExecutionRecord.
|
void |
pendingSelection()
Sets the state of this record to STATE_WAIT_FOR_USER_CHOICE and raise a
PromotionAssessedEvent also for each available option This
method is intended for customization only, and is not supported by
default Promotion engine implementation. |
void |
qualified()
Sets the state of this record to STATE_QUALIFIED, raises a
PromotionQualifiedEvent . |
void |
recordMonetaryAdjustmentForOrderItem(java.lang.Long orderItemID,
java.math.BigDecimal value,
int type)
Records a monetary adjustment on an order item.
|
void |
rejected()
Sets the state of this record to STATE_REJECTED, raises a
PromotionRejectedEvent.
|
void |
setAdjustments(Adjustment[] aAdjustments)
Sets the adjustments associated with the PromotionExecutionRecord.
|
void |
setAffectedItems(LineItemSet[] aAffectedItems)
Sets the list of order items to which the adjustment will be applied.
|
void |
setCode(java.lang.String aCode)
Sets the promotion code.
|
void |
setCodeEntered(boolean aCodeEntered)
Sets a boolean value to indicate if promotion code has been entered for
the PromotionExecutionRecord.
|
void |
setCoupon(com.ibm.commerce.marketing.promotion.coupon.Coupon aCoupon)
Sets the coupon that is redeemed in this promotion
|
void |
setCouponValTime(java.util.Date date)
Sets time to validate coupon
|
void |
setEngine(PromotionEngine aEngine)
Sets the promotion engine.
|
void |
setEngineName(java.lang.String string)
Sets the name of the promotion engine which created this promotion
execution record
|
void |
setNextChoice(PromotionExecutionRecord aNextInGroup)
In the case of a choice of rewards, it sets the next option.
|
void |
setOrder(Order aOrder)
Sets the order to which this reward applies.
|
void |
setPromotion(Promotion aPromotion)
Sets the promotion of the PromotionExecutionRecord.
|
void |
setState(int aState)
Sets the state of the PromotionExecutionRecord.
|
void |
setTargetedAmount(java.math.BigDecimal amount)
Sets the targeted monetary amount used to qualify for this promotion, in
order currency.
|
void |
setTargetedAmountTypes(int i)
Set the targeted monetary value types bit pattern.
|
void |
setTargetedItems(LineItemSet aTtargetedItems)
Sets the targeted Items for the promotion.
|
void |
setViolatedPolicy(PromotionPolicy aViolatedPolicy)
Sets the promotion policy that is violated by this promotion.
|
java.lang.String |
toString() |
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public static final int STATE_INIT
public static final int STATE_WAIT_FOR_USER_CHOICE
public static final int STATE_ELIMINATED
public static final int STATE_ASSESSED
public static final int STATE_EXPIRED
public static final int STATE_QUALIFIED
public static final int STATE_REJECTED
public static final int STATE_APPLIED
public PromotionExecutionRecord(PromotionEngine aEngine)
aEngine
- the promotion engine.public PromotionExecutionRecord(PromotionExecutionRecord aPreviousInChain)
aPreviousInChain
- in the case when user's choice of promotions is needed, a
chain of promotion records will be returned. This is a
convenience constructor for creating promotion execution
record in that scenario.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
Object.clone()
public int getState()
public LineItemSet getTargetedItems()
public java.math.BigDecimal getTargetedAmount()
public void setState(int aState)
aState
- The state to setpublic void setTargetedItems(LineItemSet aTtargetedItems)
aTtargetedItems
- The targetedItems to setpublic void setTargetedAmount(java.math.BigDecimal amount)
amount
- the new targeted amount.public Order getOrder()
public Promotion getPromotion()
public PromotionPolicy getViolatedPolicy()
public void setOrder(Order aOrder)
aOrder
- The order to setpublic void setPromotion(Promotion aPromotion)
aPromotion
- The promotion to setpublic void setViolatedPolicy(PromotionPolicy aViolatedPolicy)
aViolatedPolicy
- The violated promotion policy to setpublic PromotionExecutionRecord getNextChoice()
public void setNextChoice(PromotionExecutionRecord aNextInGroup)
aNextInGroup
- The next in group PromotionExecutionRecord to setpublic boolean isCodeEntered()
public void setCodeEntered(boolean aCodeEntered)
aCodeEntered
- true to indicate that a promotion code has been set for the
PromotionExecutionRecord.public java.lang.String getCode()
public void setCode(java.lang.String aCode)
aCode
- The promotion code to setpublic void fromXML(org.w3c.dom.Node node) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
node
- The node that represents an XMLizable objectDeXMLizationException
- when this process failsXMLizable.fromXML(Node)
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.toXML()
public void assessed()
PromotionAssessedEvent
public void pendingSelection()
PromotionAssessedEvent
also for each available option This
method is intended for customization only, and is not supported by
default Promotion engine implementation.public void qualified()
PromotionQualifiedEvent
.public void eliminated()
PromotionEliminatedEvent
.public void applied()
PromotionAppliedEvent
.public void rejected()
public Adjustment[] getAdjustments()
public LineItemSet[] getAffectedItems()
public PromotionEngine getEngine()
public void setAdjustments(Adjustment[] aAdjustments)
aAdjustments
- The adjustments to setpublic void setAffectedItems(LineItemSet[] aAffectedItems)
aAffectedItems
- The affectedItems to setpublic void setEngine(PromotionEngine aEngine)
aEngine
- The engine to setpublic AssociatedOrderItem[] getTargetedOrderItems()
public AssociatedOrderItem[] getAffectedOrderItems(Adjustment adjustment)
adjustment
- the adjustmentpublic com.ibm.commerce.marketing.promotion.coupon.Coupon getCoupon()
public void setCoupon(com.ibm.commerce.marketing.promotion.coupon.Coupon aCoupon)
aCoupon
- the couponpublic com.ibm.commerce.marketing.promotion.coupon.CouponKey getCouponKey()
public OrderKey getOrderKey()
public PromotionKey getPromotionKey()
public PromotionPolicyKey getViolatedPolicyKey()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.Long[] getAffectedOrderItemIDs(int type)
type
- the type of monetary value adjustment, for example, PRICE,
SHIPPING, TAX, SHIPPING TAX.public java.math.BigDecimal getMonetaryAdjustmentTotalForOrderItem(java.lang.Long orderItemID, int type)
orderItemID
- id of the order itemtype
- to which monetary value is the adjustment applied: price,
shipping, tax, shipping tax, see the constant attributes of
MonetaryAdjustment
public void recordMonetaryAdjustmentForOrderItem(java.lang.Long orderItemID, java.math.BigDecimal value, int type)
orderItemID
- id of the order item to which the adjustment will applyvalue
- the adjustment value.type
- to which monetary value is the adjustment applied: price,
shipping, tax, shipping tax, see the constant attributes of
MonetaryAdjustment
public java.math.BigDecimal getMonetaryAdjustmentForOrder(int type)
type
- to which monetary value is the adjustment applied: price,
shipping, tax, shipping tax, see the constant attributes of
MonetaryAdjustment
public java.lang.String getEngineName()
public void setEngineName(java.lang.String string)
string
- name of the enginepublic void addCustomeValue(java.lang.String name, XMLizable value)
name
- name of the custom valuevalue
- value of the custom value. It has to be an XMLizable objectpublic XMLizable getCustomValue(java.lang.String name)
name
- of the custom valuepublic int getTargetedAmountTypes()
public void setTargetedAmountTypes(int i)
i
- new targeted monetary value types patternpublic java.util.Date getCouponValTime()
public void setCouponValTime(java.util.Date date)
date
- Coupon validation timepublic java.util.List getRewardOptions()