public class PromotionArgument extends java.lang.Object implements XMLizable, java.lang.Cloneable
PromotionEngine
is invoked. As the input parameters, it
has all the input parameters used by promotion engine invocation. For example,
invocation template which has predefined promotion groups applied to a
particular store. The input parameters are used to keep record of what has
been processed by the promotion rule engine. As the evaluation results, the
PromotionArgument carries a list of PromotionExecutionRecord
s. A
PromotionExecutionRecord is the evidence that a promotion is applied to an
order once. If a promotion is applied to an order N times, N
PromotionExecutionRecords are appended. Each PromotionExecutionRecord
carries a large variety of information. PromotionArgument also includes a
list of PromotionErrorReport
s to indicate any errors that may have
arisen during promotion evaluation, for example incorrect or expired codes
and coupons.
XML Snippet for PromotionArgument:
<PromotionArgument impl="com.ibm.commerce.marketing.promotion.runtime.PromotionArgument"> <EngineName>Promotion Engine name</EngineName> <OrderKey><OrderId>1234</OrderId></OrderKey> <CustomerKey><LogonId>wcsadmin</LogonId></CustomerKey> <InvocationTemplate> <Template name="Store 201 Order Level Promotion"> <DefaultDN>Blue mall organization</DefaultDN> <DefaultStore>Store 201</DefaultStore> <PromotionGroups> <Group>OrderLevelPriceDiscounts</Group> <Group>OrderLevelShippingDiscounts</Group> <Group DN="root organization" Store="Default Store">SiteWideFreeGiftPromotionsForNewSignUps</Group> </PromotionGroups> </Template> </InvocationTemplate> <DiscardPreviousResult>false</DiscardPreviousResult> <SaveCurrentResult>true</SaveCurrentResult> <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> </PromotionArgument>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright
|
Constructor and Description |
---|
PromotionArgument()
Constructor for PromotionArgument.
|
PromotionArgument(Order aOrder,
Customer aCustomer,
java.lang.String aTemplate,
boolean aDiscard,
boolean aSave,
java.util.Hashtable aNVP)
Constructor used to create a PromotionArgument
|
Modifier and Type | Method and Description |
---|---|
void |
appendPromotionErrorReport(PromotionErrorReport report)
Appends a promotion error report to a list of error reports.
|
void |
appendPromotionExecutionRecord(PromotionExecutionRecord record)
Appends a promotion execution record
|
java.lang.Object |
clone() |
void |
finalizePromotionArgument()
Finalizes promotion argument, marks all applicable
PromotionExecutionRecords as applied and logs statistics.
|
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
java.lang.String |
getEngineName()
Returns the name of the promotion engine that is invoked.
|
java.lang.String |
getInvocationTemplate()
Returns the invocation Template.
|
Order |
getOrder()
Returns the order to which promotions will be applied
|
OrderKey |
getOrderKey()
Returns the key of an Order
|
Customer |
getOwner()
Returns the reference of Customer entity which belongs to the
PromotionArgument
|
CustomerKey |
getOwnerKey()
Returns the key of the Owner
|
java.lang.Object |
getParameter(java.lang.String name)
Returns object value from name and value pair stored in a Hashtable
containing any additional parameters to promotion engine and promotions.
|
PromotionErrorReport[] |
getPromotionErrorReports()
Returns all the promotion error reports accumulated so far.
|
java.util.Iterator |
getPromotionExecutionRecords()
Returns the list of all results from evaluation of promotions
|
OrderRunningTotal |
getRunningTotal()
Returns the order running total object.
|
java.util.Hashtable |
getRuntimeAttributes()
Returns a Hashtable containing the name-value pairs representing
additional parameters to promotion engine and promotions.
|
boolean |
hasApplicablePromotions()
This method determines if promotion argument contains any applicable
promotions.
|
boolean |
hasUnusedFreeGifts(PromotionExecutionRecord record)
Checks a promotion execution record to determine if this is a free gift promotion
where no free gift was selected.
|
boolean |
isCurrentResultSaved()
This method determines if the result of current session will be saved in
persistent storage or not.
|
boolean |
isPreviousResultDiscarded()
This method determines if previous promotion results will be discarded or
not.
|
void |
setAdditionalParameters(java.util.Hashtable aNVP)
This method is used to specify a Hashtable which contains additional
parameters to promotion engine and promotions, using a name-value pair
style.
|
void |
setCurrentResultSaved(boolean aCurrentResultSaved)
Sets whether the result of current session will be saved in persistent
storage or not.
|
void |
setEngineName(java.lang.String string)
Sets the name of the promotion engine that is invoked.
|
void |
setHasApplicablePromotions(boolean aHasApplicablePromotions)
Set to true if this PromotionArgument contains applicable promotions.
|
void |
setInvocationTemplate(java.lang.String aInvocationTemplate)
Sets the invocation template.
|
void |
setOrder(Order aOrder)
Sets the order.
|
void |
setOwner(Customer aOwner)
Sets the owner.
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Sets name/value pair in the hash table used for storing any additional
parameters to promotion engine and promotions.
|
void |
setPreviousResultDiscarded(boolean aPreviousResultDiscarded)
Sets whether previous promotion results will be discarded or not.
|
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 PromotionArgument()
public PromotionArgument(Order aOrder, Customer aCustomer, java.lang.String aTemplate, boolean aDiscard, boolean aSave, java.util.Hashtable aNVP)
aOrder
- The order to which promotion will be appliedaCustomer
- Owner of the orderaTemplate
- The name of the invocation template (point)aDiscard
- Whether previous promotion results will be discarded or notaSave
- Whether the result of current session will be saved in
persistent storage or notaNVP
- any additional parameters in name-value pair stylepublic java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
Object.clone()
public Order getOrder()
PromotionContext.getOrder()
public Customer getOwner()
public java.util.Iterator getPromotionExecutionRecords()
public void appendPromotionExecutionRecord(PromotionExecutionRecord record)
record
- the promotion execution record to appendpublic java.lang.Object getParameter(java.lang.String name)
name
- the name of the object to be fetchedpublic void setParameter(java.lang.String name, java.lang.Object value)
name
- the name of name and value pair stored in the hash tablevalue
- the value of name and value pair stored in the hash tablepublic java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failscom.ibm.commerce.marketing.common.XMLizable#toXML()
public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
anXMLNode
- The node that represents an XMLizable objectDeXMLizationException
- when this process failscom.ibm.commerce.marketing.common.XMLizable#fromXML(Node)
public void setOrder(Order aOrder)
aOrder
- The order to setpublic void setOwner(Customer aOwner)
aOwner
- The owner to setpublic java.lang.String getInvocationTemplate()
public void setInvocationTemplate(java.lang.String aInvocationTemplate)
aInvocationTemplate
- The invocation template to setpublic void setAdditionalParameters(java.util.Hashtable aNVP)
aNVP
- Hashtable containing the name-value pair style parameters to
promotion engine and promotions.public boolean isCurrentResultSaved()
public boolean isPreviousResultDiscarded()
public boolean hasApplicablePromotions()
public void setHasApplicablePromotions(boolean aHasApplicablePromotions)
aHasApplicablePromotions
- Set to true if there are any applicable promotions.public void setCurrentResultSaved(boolean aCurrentResultSaved)
aCurrentResultSaved
- Set to true if the current session should be saved to
persistent storage.public void setPreviousResultDiscarded(boolean aPreviousResultDiscarded)
aPreviousResultDiscarded
- Set to true if previous promotion results should be discarded.public OrderKey getOrderKey()
public CustomerKey getOwnerKey()
public boolean hasUnusedFreeGifts(PromotionExecutionRecord record)
record
- A promotion execution record to check for unused free gifts.public void finalizePromotionArgument() throws PromotionRuntimeException
PromotionRuntimeException
- when this process failspublic OrderRunningTotal getRunningTotal()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.util.Hashtable getRuntimeAttributes()
public java.lang.String getEngineName()
public void setEngineName(java.lang.String string)
string
- Name of the promotion engine to set.public void appendPromotionErrorReport(PromotionErrorReport report)
report
- The error report to be added.public PromotionErrorReport[] getPromotionErrorReports()