public class FixedAmountOffShippingAdjustment extends java.lang.Object implements MonetaryAdjustment
FixedAmountOffShippingAdjustment
offers fixed amount off the
shipping charges. It provides implementation for FixedAmountOffShipping type
of adjustment. This class extends Adjustment
interface. XML
Snippet for this type of Adjustment
<Adjustment impl="com.ibm.commerce.marketing.promotion.reward.FixedAmountOffShippingAdjustment"> <AmountOff>15</AmountOff> <Currency>CAD</Currency> <!-- wholeOrder or AllAffectedItems or IndividualAffectedItems --> <AdjustmentType>wholeOrder</AdjustmentType> </Adjustment>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
MAX_SCALE_FOR_DIVIDE, PRICE, SHIPPING, SHIPPING_TAX, TAX, ZERO
ALL_AFFECTED_ITEMS, INDIVIDUAL_AFFECTED_ITEMS, WHOLE_ORDER
Constructor and Description |
---|
FixedAmountOffShippingAdjustment()
Constructor for FixedAmountOffShippingAdjustment.
|
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.math.BigDecimal |
getAmountOff()
Returns the amount of value to be given as discount.
|
java.lang.String |
getCurrency()
Returns the currency.
|
java.math.BigDecimal |
getPerUnitAdjustment(AssociatedOrderItem one,
AssociatedOrderItem[] all,
PromotionContext context)
This method returns the monetary adjustment that needs to be applied to each
unit.
|
int |
getTheTypeOfMonetaryValueToBeAdjusted()
Returns the value of SHIPPING=2
|
void |
setAdjustmentType(java.lang.Integer _adjustmentType)
This method sets the type of Adjustment.
|
void |
setAmountOff(java.math.BigDecimal tempAmountOff)
This method sets the amount value to be given as discount
|
void |
setCurrency(java.lang.String newCurrency)
This method sets Currency.
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public FixedAmountOffShippingAdjustment()
public java.math.BigDecimal getAmountOff()
public java.lang.String getCurrency()
public void setAmountOff(java.math.BigDecimal tempAmountOff)
tempAmountOff
- The amount off to set.public void setCurrency(java.lang.String newCurrency)
newCurrency
- The currency to set.public java.lang.Integer getAdjustmentType()
Adjustment
getAdjustmentType
in interface Adjustment
WHOLE_ORDER
, ALL_AFFECTED_ITEMS
or INDIVIDUAL_AFFECTED_ITEMS
.Adjustment.getAdjustmentType()
public void setAdjustmentType(java.lang.Integer _adjustmentType)
Adjustment
WHOLE_ORDER
, ALL_AFFECTED_ITEMS
or INDIVIDUAL_AFFECTED_ITEMS
.setAdjustmentType
in interface Adjustment
Adjustment.setAdjustmentType(Integer)
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.toXML()
public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
anXMLNode
- The node that represents an XMLizable objectDeXMLizationException
- when this process failsXMLizable.fromXML(Node)
public java.lang.Object clone()
CloneNotSupportedException
is thrown.clone
in interface Adjustment
clone
in class java.lang.Object
Object.clone()
public int getTheTypeOfMonetaryValueToBeAdjusted()
getTheTypeOfMonetaryValueToBeAdjusted
in interface MonetaryAdjustment
com.ibm.commerce.marketing.promotion.reward.MonetaryAdjustment#getAdjustmentTarget()
public java.math.BigDecimal getPerUnitAdjustment(AssociatedOrderItem one, AssociatedOrderItem[] all, PromotionContext context)
MonetaryAdjustment
AssociationOrderItem
). It is guaranteed that all units in
one
have been adjusted by exactly the same set of
monetary adjustments.getPerUnitAdjustment
in interface MonetaryAdjustment
one
- the order item or portion of an order item for which a per unit adjustment
amount needs to be calculated.all
- all of the AssociatedOrderItems to which this adjustment applies.context
- PromotionContextMonetaryAdjustment.getPerUnitAdjustment(AssociatedOrderItem, AssociatedOrderItem[], PromotionContext)
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
Adjustment
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
.apply
in interface Adjustment
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.PromotionRuntimeException
- when the computation encounters a problem.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)