public class Distribution
extends java.lang.Object
implements com.ibm.commerce.marketing.promotion.reward.GenericDistribution
Distribution
class provides default implementation for GenericDistribution
interface. After applying patterns to an order, it will result in zero or more matched patterns.
When a distribution is applied to all matched patterns, the cost based volumn or quantity based tiered
methodology will be used. As a result, adjustment can be properly applied to the order.
XML Snippet for Distribution
:
<Distribution impl="com.ibm.commerce.marketing.promotion.reward.Distribution"> <!-- Multiple Pattern Filters can go here --> <PatternFilter></PatternFilter> <!-- Volume or Tiered --> <Type>Volume</Type> <!-- Quantity or Cost --> <Base>Quantity</Base> <!-- Multiple Ranges can be specified --> <Range> <LowerBound>1</LowerBound> <UpperBound>5</UpperBound> <Reward></Reward> <Reward></Reward> </Range> <Range> <LowerBound>6</LowerBound> <UpperBound>10</UpperBound> <Reward></Reward> <Reward></Reward> </Range> </Distribution>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static int |
COST
The base of the distribution is Cost.
|
static int |
QUANTITY
The base of the distribution is Quantity.
|
static int |
TIERED
The type of the distribution is Tiered.
|
static int |
VOLUME
The type of the distribution is Volume.
|
Constructor and Description |
---|
Distribution()
Constructor for Distribution.
|
Modifier and Type | Method and Description |
---|---|
boolean |
distribute(LineItemSet[] inputItems,
PromotionContext context)
This method distributes the
LineItemSet s between different ranges and calculates
the rewards for all qualified LineItemSet s. |
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
int |
getBase()
This method gets the quantity-based or cost-based type of the Distribution.
|
java.lang.String |
getCurrency()
This method gets the Currency used for defining ranges in Cost based Distribution.
|
PatternFilter[] |
getPatternFilters()
This method gets the PatternFilters of the Distribution.
|
DistributionRange[] |
getRanges()
This method gets the Ranges of the Distribution.
|
int |
getType()
This method gets the type of the Distribution (either Volume or Tiered).
|
void |
setBase(int aBase)
This methods sets the base of the Distribution.
|
void |
setCurrency(java.lang.String aCurrency)
This method sets the Currency used for defining ranges in Cost based Distribution.
|
void |
setPatternFilters(PatternFilter[] filters)
This method sets the PatternFilters for the Distribution.
|
void |
setRanges(DistributionRange[] aRanges)
This method sets the Ranges of the Distribution.
|
void |
setType(int aType)
This methods sets the type of the Distribution.
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public static final int QUANTITY
public static final int COST
public static final int VOLUME
public static final int TIERED
public int getType()
public java.lang.String getCurrency()
public int getBase()
public PatternFilter[] getPatternFilters()
PatternFilter
s of the Distributionpublic void setPatternFilters(PatternFilter[] filters)
filters
- list of PatternFilter
s of the Distributionpublic void setType(int aType)
aType
- Type of Distribution. Set to one of the constants of VOLUME or TIERED.public void setBase(int aBase)
aBase
- Base of Distribution. Set to one of the constants of QUANTITY OR COST.public void setCurrency(java.lang.String aCurrency)
aCurrency
- The currency to set.public DistributionRange[] getRanges()
DistributionRange
public void setRanges(DistributionRange[] aRanges)
aRanges
- list of DistributionRange
public boolean distribute(LineItemSet[] inputItems, PromotionContext context)
LineItemSet
s between different ranges and calculates
the rewards for all qualified LineItemSet
s.distribute
in interface com.ibm.commerce.marketing.promotion.reward.GenericDistribution
inputItems
- List of LineItemSet
context
- PromotionContext
true
if successfully distributed,
false
otherwise;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)