public class PromotionalPriceDataBean extends SmartDataBeanImpl
For an item or a fully resolved package, it creates an order with the item or package containing resolved items and invokes the engine to determine its promotional price.
For a product, it creates an order for each item in the product and invokes the engine to determine the promotional prices of the items. If the AdvancedPromotionEngine is not found, then it sets the original price of the items. If the evaluateAllChildItems flag is set to true, it sets the highest and lowest prices from the items in the product. If however the evaluateAllChildItems flag is set to false, it sets the price of the first item it can find in the product. This is also set as the highest and lowest prices of the product.
For a bundle, if the bundle contains items or packages, then an order is created with all the items/packages of the bundle and the promotional price is returned on evaluation. If there are products in the bundle and if all products have only one item in it, then the same logic is followed of creating one order with all these items and returning one evaluated price. If there are products in the bundle and even if one product has multiple items in it, then no price is set.
Several other parameters may be specified to control behavior:
templateForEvaluation- This is used to control which promotions will be evaluated based on the promotion groups that they belong to. For example, a template only contains Product Level promotions. This flag is used by the PromotionExecutionAgendaBuilder logic to filter out unwanted promotion groups. By default, the value of this flag is set to "All Promotions".
useGenericUserForEvaluation- This flag is used to indicate whether the promotion must be evaluated under current user or should be switched to the WCS generic shopper.
evaluateAllChildItems- In the case where the catalog entry is a ProductDataBeanand has several ItemDataBeans under it, this flag indicates if all the children of the catalog entry should be evaluated separately and return the highest and lowest prices. Otherwise only the first child will be evaluated.
This databean does not evaluate the promotional price for dynamic or predefined dynamic kits.
Before invoking the populate method on this bean, you must invoke the setCatEntryId method.Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
static java.lang.String | DEFAULT_PROMOTION_TEMPLATE
Default template to use for evaluation - "All Promotions".
|
Constructor and Description |
---|
PromotionalPriceDataBean() |
Modifier and Type | Method and Description |
---|---|
protected CatalogEntryDataBean | createCatalogBean(java.lang.Long catEntryID)
Generates a CatalogEntryDataBeanobject according to the passed catalog entry ID catEntryID.
|
protected Order | createOrder(OrderKey key, java.util.List orderItems)
Creates an order object according to the input OrderKey key and list of WCSOrderItem orderItems objects.
|
protected Order | createSimulatedOrder(java.util.List aDataBean)
Creates a simulated order object according to the input CatalogEntryDataBeanaDataBean object.
|
protected OrderItem | createSimulatedOrderItem(OrderItemKey key, CatalogEntryDataBean bean)
Creates a simulated WCSOrderItem according to the input OrderItemKey key and CatalogEntryDataBean bean object.
|
protected void | evaluateBundlePromotionalPrice(CatalogEntryDataBean catEntryBean)
This method is used to evaluate the promotional price of a bundle.
|
protected void | evaluateItemPromotionalPrice(CatalogEntryDataBean catEntryBean)
This method is used to evaluate the promotional price of an item.
|
protected void | evaluatePackagePromotionalPrice(CatalogEntryDataBean catEntryBean)
This method is used to evaluate the promotional price of a fully resolved package.
|
protected void | evaluateProductPromotionalPrice(CatalogEntryDataBean catEntryBean)
This method is used to evaluate the promotional price of a product.
|
protected PromotionArgument | evaluatePromotion(Order aSimulatedOrder)
Evaluates the passed OrderaSimulatedOrder object by invoking the promotion engine and returning the resultant PromotionArgumentobject.
|
protected CatalogEntryKey | generateCatalogEntryKey(CatalogEntryDataBean bean)
Generates a CatalogEntryKeyobject according to the passed CatalogEntryDataBean bean object.
|
protected StoreKey | generateStoreKey(StoreAccessBean store)
Generates a StoreKeyobject according to the passed StoreAccessBeanstore object.
|
protected com.ibm.commerce.marketing.promotion.runtime.AdvancedPromotionEngine | getAdvancedPromotionEngine()
Gets the AdvancedPromotionEngineobject.
|
java.lang.Long | getCatalogEntryId()
Gets the catalog entry Id.
|
void | setIncludePublicCodePromotions(boolean aFlag)
Sets the flag to indicate whether promotions with public codes to be included for evaluation.
|
protected java.math.BigDecimal | getHighestPrice()
Return the highest price from the items of a product catalog entry.
|
FormattedMonetaryAmountDataBean | getHighestPriceAmount()
Gets FormattedMonetaryAmountDataBean object of the highest price.
|
protected java.math.BigDecimal | getLowestPrice()
Return the lowest price from the items of a product catalog entry.
|
FormattedMonetaryAmountDataBean | getLowestPriceAmount()
Gets FormattedMonetaryAmountDataBean object of the lowest price.
|
java.lang.String | getTemplateForEvaluation()
Gets the promotion template name.
|
boolean | isEvaluateAllChildItems()
Return true or false that indicates if all children of a product needs to be evaluated or not.
|
boolean | isUseGenericUserForEvaluation()
Gets true or false indicates if the evaluation should be using the generic user or not.
|
void | populate()
Used to evaluate and set the promotional price of a catalog entry.
|
void | setCatalogEntryId(java.lang.Long aCatEntryId)
Sets the catalog entry ID.
|
void | setCommandContext(CommandContext cc)
Sets the command context associated with the data bean.
|
void | setEvaluateAllChildItems(boolean aFlag)
Sets the flag to indicate whether all child items of a product catalog entry must be evaluated.
|
protected void | setHighestPrice(java.math.BigDecimal aHighestPrice)
Sets the highest price.
|
protected void | setLowestPrice(java.math.BigDecimal aLowestPrice)
Sets the lowest price.
|
void | setRequestProperties(TypedProperty param)
Sets the request properties associated with the data bean.
|
void | setTemplateForEvaluation(java.lang.String aTemplateName)
Sets the promotion template to be evaluated.
|
void | setUseGenericUserForEvaluation(boolean aFlag)
Sets the flag to indicate whether the current user or the generic user should be used for evaluation.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String DEFAULT_PROMOTION_TEMPLATE
public void setRequestProperties(TypedProperty param)
public void setCommandContext(CommandContext cc)
public void setTemplateForEvaluation(java.lang.String aTemplateName)
public void setCatalogEntryId(java.lang.Long aCatEntryId)
public void setUseGenericUserForEvaluation(boolean aFlag)
public void setEvaluateAllChildItems(boolean aFlag)
public void setIncludePublicCodePromotions(boolean aFlag)
protected java.math.BigDecimal getHighestPrice()
protected java.math.BigDecimal getLowestPrice()
public void populate()
For an item, it creates an order with an item and invokes the engine to determine the promotional price of the item.
For a product, it creates an order for each item in the product and invokes the engine to determine the promotional prices of the items. If the AdvancedPromotionEngineis not found, then it sets the original price of the items. If the evaluateAllChildItems flag is set to true, it sets the highest and lowest prices from the items in the product. If however the evaluateAllChildItems flag is set to false, it sets the price of the first item it can find in the product.
For a package, it must be fully resolved and is treated as an item. An order is created with the package and the promotional price of the package is returned if the AdvancedPromotionEngine is found; else the original price of the package is returned.
For a bundle, if the bundle contains items or packages, then an order is created with all the items/packages of the bundle and the price is returned on evaluation. If there are products in the bundle and if all products have only one item in it, then the same logic is followed of creating one order with all these items and returning one evaluated price. If there are products in the bundle and even if one product has multiple items in it, then no price is set.
protected void evaluatePackagePromotionalPrice(CatalogEntryDataBean catEntryBean) throws java.lang.Exception
protected void evaluateBundlePromotionalPrice(CatalogEntryDataBean catEntryBean) throws java.lang.Exception
protected void evaluateProductPromotionalPrice(CatalogEntryDataBean catEntryBean) throws java.lang.Exception
protected void evaluateItemPromotionalPrice(CatalogEntryDataBean catEntryBean) throws java.lang.Exception
public java.lang.String getTemplateForEvaluation()
protected com.ibm.commerce.marketing.promotion.runtime.AdvancedPromotionEngine getAdvancedPromotionEngine()
protected OrderItem createSimulatedOrderItem(OrderItemKey key, CatalogEntryDataBean bean) throws java.lang.Exception
protected StoreKey generateStoreKey(StoreAccessBean store) throws java.lang.Exception
protected CatalogEntryKey generateCatalogEntryKey(CatalogEntryDataBean bean) throws java.lang.Exception
protected CatalogEntryDataBean createCatalogBean(java.lang.Long catEntryID) throws java.lang.Exception
protected Order createSimulatedOrder(java.util.List aDataBean) throws java.lang.Exception
protected Order createOrder(OrderKey key, java.util.List orderItems) throws java.lang.Exception
protected PromotionArgument evaluatePromotion(Order aSimulatedOrder)
protected void setHighestPrice(java.math.BigDecimal aHighestPrice)
protected void setLowestPrice(java.math.BigDecimal aLowestPrice)
public boolean isEvaluateAllChildItems()
public java.lang.Long getCatalogEntryId()
public boolean isUseGenericUserForEvaluation()
public FormattedMonetaryAmountDataBean getHighestPriceAmount()
public FormattedMonetaryAmountDataBean getLowestPriceAmount()