com.ibm.commerce.price.beans

Class DiscountDataBean

  • java.lang.Object
    • com.ibm.commerce.price.beans.DiscountDataBean
  • All Implemented Interfaces:
    com.ibm.commerce.beans.DataBean, com.ibm.commerce.beans.InputDataBean, com.ibm.commerce.beans.SmartDataBean, DiscountInputDataBean, DiscountSmartDataBean, java.io.Serializable


    public class DiscountDataBean
    extends java.lang.Object
    implements DiscountInputDataBean, DiscountSmartDataBean
    This data bean represents a Discount Data Bean object. When retrieving discount for a catalog entry id, the data bean will be called. Discount, a price incentive offered to customers to promote a purchase. You can set one or an array of catalog entry ids and get one or an array of discount values. Sets catalog entry id in order to populate the bean.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      The IBM copyright notice field.
      • Fields inherited from interface com.ibm.commerce.beans.DataBean

        emptyString
    • Constructor Summary

      Constructors 
      Constructor and Description
      DiscountDataBean()
      Constructs DiscountDataBean object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      com.ibm.commerce.command.CommandContext getCommandContext()
      Returns command context
      java.math.BigDecimal getDiscountValue()
      Returns the first catalog entry's total adjustment that applies at the catalog entry level.
      java.math.BigDecimal[] getDiscountValues()
      Returns the total adjustment for all catalog entries that apply at the catalog entry level.
      com.ibm.commerce.datatype.TypedProperty getRequestProperties()
      Returns request properties
      void populate()
      This method is used to retrieve data from the database.
      void setCatalogEntryId(java.lang.Long catEntryId)
      sets catalog entry id.
      void setCatalogEntryId(java.lang.Long[] catEntryId)
      sets an array of catalog entry ids.
      void setCatalogEntryId(java.lang.String catEntryId)
      sets catalog entry id.
      void setCatalogEntryId(java.lang.String[] catEntryId)
      sets an array of catalog entry ids.
      void setCommandContext(com.ibm.commerce.command.CommandContext context)
      sets command context
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty param)
      sets request properties
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

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

      • DiscountDataBean

        public DiscountDataBean()
        Constructs DiscountDataBean object.
    • Method Detail

      • getCommandContext

        public com.ibm.commerce.command.CommandContext getCommandContext()
        Returns command context
        Specified by:
        getCommandContext in interface com.ibm.commerce.beans.SmartDataBean
        Returns:
        commandContext
      • getDiscountValue

        public java.math.BigDecimal getDiscountValue()
        Returns the first catalog entry's total adjustment that applies at the catalog entry level. For example, if the catalog entry has a 20% markdown, -0.2 will be returned. The returned value could also be a fixed price adjustment. The type of adjustment must be determined from the promotion component.

        If only one catalog entry ID was set using DiscountInputDataBean.setCatalogEntryId(Long), then the returned value is for that. Otherwise the returned value corresponds to the first catalog entry ID that was set using DiscountInputDataBean.setCatalogEntryId(Long[]). (Similar for the String-based set methods.)

        Specified by:
        getDiscountValue in interface DiscountSmartDataBean
        Returns:
        The adjustment for the catalog entry ID.
      • getDiscountValues

        public java.math.BigDecimal[] getDiscountValues()
        Returns the total adjustment for all catalog entries that apply at the catalog entry level. For example, if two catalog entries have a 20% markdown and a 15% markup, {-0.2, 0.15} will be returned. The returned values could also be fixed price adjustments. The type of adjustment must be determined from the promotion component.

        The returned values correspond to the catalog entry IDs given by DiscountInputDataBean.setCatalogEntryId(Long[]). If DiscountInputDataBean.setCatalogEntryId(Long) was used to set the catalog entry IDs, the returned array will have a length of 1. (Similar for the String-based set methods.)

        Specified by:
        getDiscountValues in interface DiscountSmartDataBean
        Returns:
        The adjustments for the catalog entry IDs.
      • getRequestProperties

        public com.ibm.commerce.datatype.TypedProperty getRequestProperties()
        Returns request properties
        Specified by:
        getRequestProperties in interface com.ibm.commerce.beans.InputDataBean
        Returns:
        null
      • populate

        public void populate()
                      throws java.lang.Exception
        This method is used to retrieve data from the database. Loads data into the data bean when the DataBeanManager.activate() runs.
        Specified by:
        populate in interface com.ibm.commerce.beans.SmartDataBean
        Throws:
        java.lang.Exception
      • setCatalogEntryId

        public void setCatalogEntryId(java.lang.Long catEntryId)
        sets catalog entry id.
        Specified by:
        setCatalogEntryId in interface DiscountInputDataBean
        Parameters:
        catEntryId -
      • setCatalogEntryId

        public void setCatalogEntryId(java.lang.Long[] catEntryId)
        sets an array of catalog entry ids.
        Specified by:
        setCatalogEntryId in interface DiscountInputDataBean
        Parameters:
        catEntryId - []
      • setCatalogEntryId

        public void setCatalogEntryId(java.lang.String catEntryId)
        sets catalog entry id.
        Specified by:
        setCatalogEntryId in interface DiscountInputDataBean
        Parameters:
        catEntryId -
      • setCatalogEntryId

        public void setCatalogEntryId(java.lang.String[] catEntryId)
        sets an array of catalog entry ids.
        Specified by:
        setCatalogEntryId in interface DiscountInputDataBean
        Parameters:
        catEntryId - []
      • setCommandContext

        public void setCommandContext(com.ibm.commerce.command.CommandContext context)
        sets command context
        Specified by:
        setCommandContext in interface com.ibm.commerce.beans.SmartDataBean
        Parameters:
        context -
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty param)
        sets request properties
        Specified by:
        setRequestProperties in interface com.ibm.commerce.beans.InputDataBean
        Parameters:
        param -