public class Pattern
extends java.lang.Object
implements com.ibm.commerce.marketing.promotion.condition.GenericPattern
GenericPattern
interface used by PurchaseCondition
. <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern"> <!-- The line item sets should be kept unique between multiple constraints in the pattern. The default value is false. --> <UniqueConstraints>false</UniqueConstraints> <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 as 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; they are applied in a contiguous fashion, that is, connected using a logical "and". --> <!-- The dummy filter returns anything passed to it, it effectively selects everything --> <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> </Pattern>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
TAG_UNIQUE_CONSTRAINTS
XML tag - "UniqueConstraints"
|
Constructor and Description |
---|
Pattern()
Constructor for Pattern.
|
Modifier and Type | Method and Description |
---|---|
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
Constraint[] |
getConstraints()
Returns the array of Constraints that make up the pattern definition
|
static boolean |
isLeastExpensiveItemsFirst()
A get method to return the value of config flag
which determines if promotion is set to apply to least expensive items first
|
boolean |
isUniqueConstraints()
Gets the flag indicating whether the line item sets should be
kept unique between multiple constraints in the pattern.
|
LineItemSet[] |
match(LineItemSet order,
PromotionContext context)
This function uses the constraints that make up the pattern to spot as
many matched items as possible in a single test.
|
void |
setConstraints(Constraint[] aConstraints)
Sets the array of Constraints that make up the pattern definition
|
void |
setUniqueConstraints(boolean aUniqueConstraints)
Sets the flag that indicates whether the line item sets should be
kept unique between multiple constraints in the pattern.
|
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 TAG_UNIQUE_CONSTRAINTS
public static boolean isLeastExpensiveItemsFirst()
public LineItemSet[] match(LineItemSet order, PromotionContext context) throws PromotionRuntimeException
match
in interface com.ibm.commerce.marketing.promotion.condition.GenericPattern
order
- LineItemSet
context
- PromotionContext
LineItemSet
PromotionRuntimeException
- is thrown when the system encounters an errorpublic 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 Constraint[] getConstraints()
public void setConstraints(Constraint[] aConstraints)
aConstraints
- public boolean isUniqueConstraints()
public void setUniqueConstraints(boolean aUniqueConstraints)
aUniqueConstraints
- The value to set.