public class FreeGiftPurchaseCondition extends java.lang.Object implements Condition
XML Snippet for FreeGiftPurchaseCondition:
<PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.FreeGiftPurchaseCondition"> <BaseItemSelection> <Quantity>5</Quantity> <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain"> <Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter"> <IncludeCatEntryKey> <CatalogEntryKey> <SKU>ABCD-01</SKU> <DN>sample distinguished name</DN> </CatalogEntryKey> </IncludeCatEntryKey> </Filter> </FilterChain> </BaseItemSelection> <GiftQuantity>2</GiftQuantity> <Gift> <CatalogEntryKey> <SKU>DCBA-01</SKU> <DN>sample distinguished name</DN> </CatalogEntryKey> </Gift> <AddStrategy>1</AddStrategy> </PurchaseCondition>
Modifier and Type | Field and Description |
---|---|
static int | ADD_WHEN_NEEDED
Add gift to the shop cart if shop cart does not contain one
|
static int | ALWAYS_ADD
Always add gift to the shop cart
|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
static java.lang.String | TAG_ADD_STRATEGY
XML tag - AddStrategy
|
static java.lang.String | TAG_MERGE_PATTERN
XML tag - MergePattern
|
Constructor and Description |
---|
FreeGiftPurchaseCondition()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean | evaluate(PromotionContext context)
This function finds all the line items that can be targeted by current promotion and groups them into line item sets.
|
void | fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
int | getAddStrategy()
Gets gift add strategy.
|
FilterChain | getBaseItemFilterChain()
This method returns the base item filter chain in the condition.
|
java.math.BigDecimal | getBaseItemQuantity()
This method returns the base item quantity in the condition.
|
CatalogEntryKey | getGiftKey()
This method returns the CatalogEntryKey of the gift item in the condition.
|
java.math.BigDecimal | getGiftQuantity()
This method returns the gift quantity in the condition.
|
boolean | isMergePattern()
Gets the merge pattern flag.
|
void | setAddStrategy(int aAddStrategy)
Sets the gift add strategy.
|
void | setBaseItemFilterChain(FilterChain aBaseItemFilters)
This method sets the base item filter chain in the condition to the passed parameter.
|
void | setBaseItemQuantity(java.math.BigDecimal aBaseItemQuantity)
This method sets the base item quantity in the condition to the passed parameter.
|
void | setGiftKey(CatalogEntryKey aGiftKey)
This method sets the CatalogEntryKey of the gift item in the condition.
|
void | setGiftQuantity(java.math.BigDecimal aGiftQuantity)
This method sets the gift quantity in the condition to the passed parameter.
|
void | setMergePattern(boolean mergePattern)
Sets the merge pattern flag.
|
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_ADD_STRATEGY
public static final java.lang.String TAG_MERGE_PATTERN
public static final int ADD_WHEN_NEEDED
public static final int ALWAYS_ADD
public int getAddStrategy()
public void setAddStrategy(int aAddStrategy)
public boolean evaluate(PromotionContext context) throws PromotionRuntimeException
If the promotion does not have redemption limits and is not a coupon promotion, the MergePattern flag is used to improve overall performance by merging all matched items into a single pattern and increase the gift quantity according to number of times this promotion can be applied to the current order. If the business requirement needs to track individual redemption information, the MergePattern flag can be turn off by setting its value to false.
public java.lang.String toXML() throws XMLizationException
public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
public FilterChain getBaseItemFilterChain()
public void setBaseItemFilterChain(FilterChain aBaseItemFilters)
public java.math.BigDecimal getBaseItemQuantity()
public void setBaseItemQuantity(java.math.BigDecimal aBaseItemQuantity)
public CatalogEntryKey getGiftKey()
public void setGiftKey(CatalogEntryKey aGiftKey)
public java.math.BigDecimal getGiftQuantity()
public void setGiftQuantity(java.math.BigDecimal aGiftQuantity)
public boolean isMergePattern()
public void setMergePattern(boolean mergePattern)