public class Constraint extends java.lang.Object implements XMLizable
XML Snippet of Constraint:
<Constraint impl= "com.ibm.commerce.marketing.promotion.condition.Constraint"> <!-- Quantity requirement of this constraint --> <WeightedRange impl= "com.ibm.commerce.marketing.promotion.condition.WeightedRange"> <!-- Minimum number of items is 1 --> <LowerBound>1</LowerBound> <!-- Maximum number of items is not limited --> <UpperBound>-1</UpperBound> <!-- Match as many items that satisfy the criteria defined in the filter chain next --> <Weight>1</Weight> </WeightedRange> <!-- Selection criteria --> <FilterChain impl= "com.ibm.commerce.marketing.promotion.condition.FilterChain"> <!-- Multiple filters can be specified, the are applied in a contiguous fashion, that is, connected using a logical "and". --> <!-- The dummy filter returns anything passed to it, it effectively selects anything --> <Filter impl= "com.ibm.commerce.marketing.promotion.condition.DummyFilter" /> </FilterChain> <!-- The combination of the quantity requirement and the filter chain would return everything present in the shopcart as one big matched pattern --> </Constraint>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
Constraint()
Constructor for Constraint.
|
Modifier and Type | Method and Description |
---|---|
int |
apply(LineItemSet input,
java.util.Vector output,
PromotionContext context)
Apply the filters from the FilterChain and the quantity requirements from
the WeightedRange of the constraint, to the input LineItemSet and
determine if and how many times the constraint has been satisfied.
|
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
FilterChain[] |
getFilterChains()
Returns the filter chains that make up this constraint
|
WeightedRange |
getWeightedRange()
Returns a weighted range that is part of the definition of this constraint
|
void |
setFilterChains(FilterChain[] chains)
Sets the filter chains that are part of the definition of this constraint
|
void |
setWeightedRange(WeightedRange range)
Sets the weighted range that is part of the definition of this constraint
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
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 int apply(LineItemSet input, java.util.Vector output, PromotionContext context)
input
- LineItemSet
output
- a vector of matched LineItemSetscontext
- PromotionContext
public FilterChain[] getFilterChains()
public WeightedRange getWeightedRange()
public void setFilterChains(FilterChain[] chains)
chains
- an array of FilterChainspublic void setWeightedRange(WeightedRange range)
range
- the WeightedRange to set.