public class PromotionalPriceDataBean extends SmartDataBeanImpl
AdvancedPromotionEngine
. If found, it invokes the engine; else it returns
the original price of the item. The evaluation of the promotional price
for the item is based on the promotion agenda builder that is pre-configured
for the promotion engine.
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, which is the default setting, 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 price 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 all of the products in the bundle include only one item each, then the same logic is followed and an order is created with the item for the products in the bundle and returns one evaluated price. If any of the products that are in the bundle include multiple items, then no promotional price is set.
This databean does not evaluate the promotional price for dynamic or predefined dynamic kits.
Several other parameters may be specified to control behavior:
templateForEvaluation
- This is used to control which promotions
are evaluated based on the promotion groups that they belong to. For
example, a template contains only 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
ProductDataBean
and has several ItemDataBeans
under it, this flag indicates whether all the children of the
catalog entry should be evaluated separately and return the highest and
lowest prices. Otherwise only the first child is evaluated.
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".
|
emptyString
Constructor and Description |
---|
PromotionalPriceDataBean() |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
getCatalogEntryId()
Gets the catalog entry Id.
|
FormattedMonetaryAmountDataBean |
getHighestPriceAmount()
Gets FormattedMonetaryAmountDataBean object of the highest price.
|
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.
|
void |
setIncludePublicCodePromotions(boolean aFlag)
Sets the flag to indicate whether promotions with public codes to be
included for evaluation.
|
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.
|
fulfills, getCommandContext, getHttpRequest, getHttpResponse, getResources, getViewCommandContext, setHttpRequest, setHttpResponse, setViewCommandContext
getRequestProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRequestProperties
public static final java.lang.String COPYRIGHT
public static final java.lang.String DEFAULT_PROMOTION_TEMPLATE
public void setRequestProperties(TypedProperty param)
DataBeanManager
during the activate method.setRequestProperties
in interface InputDataBean
setRequestProperties
in class InputDataBeanImpl
param
- The set of properties passed to the JSP page that invokes this
data bean.public void setCommandContext(CommandContext cc)
DataBeanManager
during the activate method.setCommandContext
in interface SmartDataBean
setCommandContext
in class SmartDataBeanImpl
cc
- The command context passed to the JSP page that invokes this
databean.public void setTemplateForEvaluation(java.lang.String aTemplateName)
aTemplateName
- The Promotion template name.public void setCatalogEntryId(java.lang.Long aCatEntryId)
aCatEntryId
- The ID of the catalog entry to set for evaluation.public void setUseGenericUserForEvaluation(boolean aFlag)
aFlag
- boolean value; true indicates that the generic user should be
used for evaluation.public void setEvaluateAllChildItems(boolean aFlag)
aFlag
- boolean value; true indicate that all the items of a product
must be evaluated.public void setIncludePublicCodePromotions(boolean aFlag)
aFlag
- boolean value; true indicate that promotions with public
codes are to be included for evaluation.public void populate()
AdvancedPromotionEngine
. If found, it invokes the engine; else it
returns the original price of the item.
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 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.
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.
populate
in interface SmartDataBean
populate
in class SmartDataBeanImpl
SmartDataBean.populate()
public java.lang.String getTemplateForEvaluation()
public boolean isEvaluateAllChildItems()
public java.lang.Long getCatalogEntryId()
public boolean isUseGenericUserForEvaluation()
public FormattedMonetaryAmountDataBean getHighestPriceAmount()
public FormattedMonetaryAmountDataBean getLowestPriceAmount()