com.ibm.commerce.marketing.promotion.reward

Class ItemUpgradeAtExtraCostAdjustment

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.reward.ItemUpgradeAtExtraCostAdjustment
  • All Implemented Interfaces:
    Adjustment, XMLizable, java.io.Serializable, java.lang.Cloneable


    public class ItemUpgradeAtExtraCostAdjustment
    extends java.lang.Object
    implements Adjustment
    ItemUpgradeAtExtraCostAdjustment offers a replacement of an order item at an optional additional fixed charge. It provides implementation for ItemUpgradeAtExtraCost type of adjustment. This class extends Adjustment interface. XML Snippet for this type of Adjustment:
     

    <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.ItemUpgradeAtExtraCostAdjustment"> <UpgradedItem> <CatalogEntryKey> <SKU>SKU-20101099</SKU> <DN>o=Root Organization</DN> </CatalogEntryKey> </UpgradedItem> <ExtraCost>3</ExtraCost> <Currency>CAD</Currency> <!-- wholeOrder or AllAffectedItems or IndividualAffectedItems --> <AdjustmentType>IndividualAffectedItems</AdjustmentType> </Adjustment>

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean apply(LineItemSet targeted, java.math.BigDecimal targetedAmount, int targetedAmountTypes, LineItemSet affected, java.util.Vector affectedVector, java.util.Vector adjustmentVector, PromotionContext context)
      This method evaluates the targeted order items to see if they fulfill the conditions of this adjustment ( for example, if the quantity of the order items falls into one of the ranges of the adjustment).
      java.lang.Object clone()
      Returns null if the CloneNotSupportedException is thrown.
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      java.lang.Integer getAdjustmentType()
      This method gets the type of Adjustment.
      java.lang.String getCurrency()
      This method gets the Currency.
      java.math.BigDecimal getExtraCost()
      This method gets the extra cost to upgrade the item.
      CatalogEntryKey getUpGradedItem()
      This method gets the UpGraded Item.
      void setAdjustmentType(java.lang.Integer _adjustmentType)
      This method sets the type of Adjustment.
      void setCurrency(java.lang.String newCurrency)
      This method sets Currency.
      void setExtraCost(java.math.BigDecimal _extraCost)
      This method sets the extra cost to upgrade the item.
      void setUpGradedItem(CatalogEntryKey newItem)
      This method sets the UpGraded Item.
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • 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
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ItemUpgradeAtExtraCostAdjustment

        public ItemUpgradeAtExtraCostAdjustment()
        Constructor for ItemUpgradeAtExtraCostAdjustment.
    • Method Detail

      • getUpGradedItem

        public CatalogEntryKey getUpGradedItem()
        This method gets the UpGraded Item.
        Returns:
        CatalogEntryKey CatalogEntryKey of the UpGraded Item
      • getExtraCost

        public java.math.BigDecimal getExtraCost()
        This method gets the extra cost to upgrade the item.
        Returns:
        java.math.BigDecimal Extra cost to upgrade the item
      • getCurrency

        public java.lang.String getCurrency()
        This method gets the Currency.
        Returns:
        java.lang.String
      • setUpGradedItem

        public void setUpGradedItem(CatalogEntryKey newItem)
        This method sets the UpGraded Item.
        Parameters:
        newItem - The CatalogEntryKey of the UpGraded Item
      • setExtraCost

        public void setExtraCost(java.math.BigDecimal _extraCost)
        This method sets the extra cost to upgrade the item.
        Parameters:
        _extraCost - The extra cost to set.
      • setCurrency

        public void setCurrency(java.lang.String newCurrency)
        This method sets Currency.
        Parameters:
        newCurrency - The currency to set.
      • getAdjustmentType

        public java.lang.Integer getAdjustmentType()
        Description copied from interface: Adjustment
        This method gets the type of Adjustment. An adjustment can be of the following types: for the whole Order, for All the Affected Items, or for Individual Affected Items.
        Specified by:
        getAdjustmentType in interface Adjustment
        Returns:
        one of the defined constants of WHOLE_ORDER, ALL_AFFECTED_ITEMS or INDIVIDUAL_AFFECTED_ITEMS.
        See Also:
        Adjustment.getAdjustmentType()
      • setAdjustmentType

        public void setAdjustmentType(java.lang.Integer _adjustmentType)
        Description copied from interface: Adjustment
        This method sets the type of Adjustment. An adjustment can be of the following types for whole Order, for All Affected Items, and for Individual Affected Items. Set adjustmentType to one of the defined constants of WHOLE_ORDER, ALL_AFFECTED_ITEMS or INDIVIDUAL_AFFECTED_ITEMS.
        Specified by:
        setAdjustmentType in interface Adjustment
        See Also:
        Adjustment.setAdjustmentType(Integer)
      • clone

        public java.lang.Object clone()
        Returns null if the CloneNotSupportedException is thrown.
        Specified by:
        clone in interface Adjustment
        Overrides:
        clone in class java.lang.Object
        See Also:
        Object.clone()
      • apply

        public boolean apply(LineItemSet targeted,
                             java.math.BigDecimal targetedAmount,
                             int targetedAmountTypes,
                             LineItemSet affected,
                             java.util.Vector affectedVector,
                             java.util.Vector adjustmentVector,
                             PromotionContext context)
                      throws PromotionRuntimeException
        Description copied from interface: Adjustment
        This method evaluates the targeted order items to see if they fulfill the conditions of this adjustment ( for example, if the quantity of the order items falls into one of the ranges of the adjustment). Depending upon if and what conditions are fulfilled, an Adjustment object is added to the adjustmentVector Vector object passed as a parameter. The affectedVector Vector object passed as a parameter is updated by adding the affected order items. This method is called in the invoke(LineItemSet, BigDecimal, int, Vector, Vector, PromotionContext) method of AdjustmentFunction.
        Specified by:
        apply in interface Adjustment
        Parameters:
        targeted - The targeted order items. This is a set of order items (or portions of order items) that are used to qualify for the promotion of which this adjustment is a part.
        affected - The affected order items. This is a set of order items, identified by the promotion, to which this adjustment will be attached.
        affectedVector - A Vector which contains the affected LineItemSets.
        adjustmentVector - A Vector which contains the Adjustment objects.
        context - The PromotionContext object which may be used to build the Adjustment to add to the adjustmentVector parameter.
        Returns:
        A boolean value indicating whether the conditions of the adjustment were fulfilled successfully or not. A true value indicates that the conditions of the adjustment were fulfilled successully, otherwise a false value is returned.
        Throws:
        PromotionRuntimeException - when the computation encounters a problem.
        See Also:
        com.ibm.commerce.marketing.promotion.reward.Adjustment#apply(com.ibm.commerce.marketing.promotion.runtime.LineItemSet, com.ibm.commerce.marketing.promotion.runtime.LineItemSet, com.ibm.commerce.marketing.promotion.runtime.PromotionContext)