com.ibm.commerce.marketing.databeans

Class PromotionalPriceDataBean

  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, java.io.Serializable


    public class PromotionalPriceDataBean
    extends SmartDataBeanImpl
    This databean is used to return the promotional price of catalog entries. It looks for the existence of the 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.

    Before invoking the populate method on this bean, you must invoke the setCatEntryId method.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • DEFAULT_PROMOTION_TEMPLATE

        public static final java.lang.String DEFAULT_PROMOTION_TEMPLATE
        Default template to use for evaluation - "All Promotions".
        See Also:
        Constant Field Values
    • Constructor Detail

      • PromotionalPriceDataBean

        public PromotionalPriceDataBean()
    • Method Detail

      • setRequestProperties

        public void setRequestProperties(TypedProperty param)
        Sets the request properties associated with the data bean. This is called by the DataBeanManager during the activate method.
        Specified by:
        setRequestProperties in interface InputDataBean
        Overrides:
        setRequestProperties in class InputDataBeanImpl
        Parameters:
        param - The set of properties passed to the JSP page that invokes this data bean.
      • setCommandContext

        public void setCommandContext(CommandContext cc)
        Sets the command context associated with the data bean. This is called by the DataBeanManager during the activate method.
        Specified by:
        setCommandContext in interface SmartDataBean
        Overrides:
        setCommandContext in class SmartDataBeanImpl
        Parameters:
        cc - The command context passed to the JSP page that invokes this databean.
      • setTemplateForEvaluation

        public void setTemplateForEvaluation(java.lang.String aTemplateName)
        Sets the promotion template to be evaluated. The template is defined in the WCSPromotionEngineConfig.xml file and indicates the promotion groups that are involved for evaluation.
        Parameters:
        aTemplateName - The Promotion template name.
      • setCatalogEntryId

        public void setCatalogEntryId(java.lang.Long aCatEntryId)
        Sets the catalog entry ID.
        Parameters:
        aCatEntryId - The ID of the catalog entry to set for evaluation.
      • setUseGenericUserForEvaluation

        public void setUseGenericUserForEvaluation(boolean aFlag)
        Sets the flag to indicate whether the current user or the generic user should be used for evaluation.
        Parameters:
        aFlag - boolean value; true indicates that the generic user should be used for evaluation.
      • setEvaluateAllChildItems

        public void setEvaluateAllChildItems(boolean aFlag)
        Sets the flag to indicate whether all child items of a product catalog entry must be evaluated.
        Parameters:
        aFlag - boolean value; true indicate that all the items of a product must be evaluated.
      • setIncludePublicCodePromotions

        public void setIncludePublicCodePromotions(boolean aFlag)
        Sets the flag to indicate whether promotions with public codes to be included for evaluation.
        Parameters:
        aFlag - boolean value; true indicate that promotions with public codes are to be included for evaluation.
      • populate

        public void populate()
        Used to evaluate and set the promotional price of a catalog entry. It looks for the existence of the 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 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.

        Specified by:
        populate in interface SmartDataBean
        Overrides:
        populate in class SmartDataBeanImpl
        See Also:
        SmartDataBean.populate()
      • getTemplateForEvaluation

        public java.lang.String getTemplateForEvaluation()
        Gets the promotion template name. If not specified, the default template name of "All Promotions" will be used.
        Returns:
        The promotion template name.
      • isEvaluateAllChildItems

        public boolean isEvaluateAllChildItems()
        Return true or false that indicates if all children of a product needs to be evaluated or not.
        Returns:
        Returns true or false.
      • getCatalogEntryId

        public java.lang.Long getCatalogEntryId()
        Gets the catalog entry Id.
        Returns:
        Returns the catalog entry Id.
      • isUseGenericUserForEvaluation

        public boolean isUseGenericUserForEvaluation()
        Gets true or false indicates if the evaluation should be using the generic user or not.
        Returns:
        Returns true or false.
      • getHighestPriceAmount

        public FormattedMonetaryAmountDataBean getHighestPriceAmount()
        Gets FormattedMonetaryAmountDataBean object of the highest price.
        Returns:
        A FormattedMonetaryAmountDataBean object
      • getLowestPriceAmount

        public FormattedMonetaryAmountDataBean getLowestPriceAmount()
        Gets FormattedMonetaryAmountDataBean object of the lowest price.
        Returns:
        A FormattedMonetaryAmountDataBean object