public class DefaultReward extends java.lang.Object implements Reward
DefaultReward
class provides default implementation for
Reward
interface. XML Snippet for reward.
<p> <Reward impl="com.ibm.commerce.marketing.promotion.reward.DefaultReward"> <!-- Multiple AdjustmentFunctions can be specified --> <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction"> <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain"> <!-- Multiple Filters can be specified --> <Filter></Filter> </FilterChain> <Adjustment></Adjustment> </AdjustmentFunction> </Reward> </p>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
REWARD_POLICY_ALL
The reward is qualified only if all defined AdjustmentFunctions apply.
|
static java.lang.String |
REWARD_POLICY_ANY
The reward is qualified if any AdjustmentFunctions applies.
|
Constructor and Description |
---|
DefaultReward()
Constructor for DefaultReward.
|
Modifier and Type | Method and Description |
---|---|
boolean |
computeReward(PromotionContext context,
PromotionExecutionRecord record)
computeReward method applies the adjustments to the
targeted line items. |
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
AdjustmentFunction[] |
getAdjustmentFunctions()
This method gets the list of
AdjustmentFunction for this
Reward. |
java.lang.String |
getRewardPolicy()
Gets the reward policy value.
|
void |
setAdjustmentFunctions(AdjustmentFunction[] adjustmentList)
This method sets the list of
AdjustmentFunction for this
Reward. |
void |
setRewardPolicy(java.lang.String rewardPolicy)
Sets the reward policy value.
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String REWARD_POLICY_ALL
public static final java.lang.String REWARD_POLICY_ANY
public AdjustmentFunction[] getAdjustmentFunctions()
AdjustmentFunction
for this
Reward.getAdjustmentFunctions
in interface Reward
AdjustmentFunction
public void setAdjustmentFunctions(AdjustmentFunction[] adjustmentList)
AdjustmentFunction
for this
Reward.setAdjustmentFunctions
in interface Reward
adjustmentList
- list of AdjustmentFunction
public boolean computeReward(PromotionContext context, PromotionExecutionRecord record) throws PromotionRewardCalcuationException
Reward
computeReward
method applies the adjustments to the
targeted line items. It gets the targeted items from
PromotionExecutionRecord
. For each
AdjustmentFunction
, it finds affected items by applying
filters to the targetted line items.
PromotionExecutionRecord
that is passed as argument is
populated with all the adjustments and affected line items. This record
is appended to PromotionContext
.computeReward
in interface Reward
context
- PromotionContext
.record
- PromotionExecutionRecord
.PromotionRewardCalcuationException
Reward.computeReward(PromotionContext,
PromotionExecutionRecord)
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.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 failsXMLizable.fromXML(Node)
public java.lang.String getRewardPolicy()
public void setRewardPolicy(java.lang.String rewardPolicy)
rewardPolicy
- The reward policy value.