com.ibm.commerce.returns.commands
Class CalculateReturnItemAdjustmentCreditCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.returns.commands.CalculateReturnItemAdjustmentCreditCmdImpl
All Implemented Interfaces:
CalculateReturnItemAdjustmentCreditCmd, ECCommand, TaskCommand

public class CalculateReturnItemAdjustmentCreditCmdImpl
extends TaskCommandImpl
implements CalculateReturnItemAdjustmentCreditCmd

Calculate the adjustment credit for a return mechandise authorization (RMA) item. Entries in the RMAIADJCRD table are first removed then re-calculated for the rma item based on the adjustments of the order item. Each order item adjustment is pro-rated based on the RMA quantity. This command also sets the total adjustment credit which the calling command can retrieve.


Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands.CalculateReturnItemAdjustmentCreditCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
CalculateReturnItemAdjustmentCreditCmdImpl()
          CalculateReturnItemAdjustmentCreditCmdImpl constructor.
 
Method Summary
protected  java.math.BigDecimal calcSpecificAdjustmentCredit(OrderItemAccessBean anOrderItemAB, OrderItemAdjustmentAccessBean anOrderItemAdjAB)
          Calculate the adjustment credit for a specific order item adjustment.
 java.math.BigDecimal getAdjustmentCredit()
          Get the total calculated adjustment credit for the returned/refunded item.
protected  java.math.BigDecimal getLimitAmount(OrderItemAdjustmentAccessBean anOrderItemAdjAB)
          Return an amount that the adjustment credit will be limited to.
protected  OrderItemAccessBean getOrderItemAB()
          Get the access bean of the order item being returned.
protected  RMAItemAccessBean getRMAItemAB()
          Get the RMA item access bean for which the adjustment credit is being calculated.
 void performExecute()
          Execute the command.
protected  void removeOldAdjustmentCredits()
          Remove existing adjustment credits for the rma item being processed.
 void reset()
          Reset the command.
protected  void setAdjustmentCredit(java.math.BigDecimal newAdjustmentCredit)
          Set the total adjustment credit for the rma item.
 void setOrderItemAB(OrderItemAccessBean anOrderItemAB)
          Set the orderItem being returned/refunded.
 void setQuantity(java.lang.Double aQuantity)
          Set the quantity to be credited.
 void setRMAItemAB(RMAItemAccessBean anRMAItemAB)
          Set the RMA Item access bean which will have its adjustment credit updated.
 void validateParameters()
          Check mandatory parameters.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Constructor Detail

CalculateReturnItemAdjustmentCreditCmdImpl

public CalculateReturnItemAdjustmentCreditCmdImpl()
CalculateReturnItemAdjustmentCreditCmdImpl constructor.
Method Detail

calcSpecificAdjustmentCredit

protected java.math.BigDecimal calcSpecificAdjustmentCredit(OrderItemAccessBean anOrderItemAB,
                                                            OrderItemAdjustmentAccessBean anOrderItemAdjAB)
                                                     throws ECException
Calculate the adjustment credit for a specific order item adjustment. This implementation pro-rates the order item adjustment based on the quantity.
Parameters:
anOrderItemAB - The access bean of the order item being examined.
anOrderItemAdjAB - The access bean of the order item adjustment being examined.
Returns:
The adjustment credit amount.

getAdjustmentCredit

public java.math.BigDecimal getAdjustmentCredit()
Get the total calculated adjustment credit for the returned/refunded item.
Specified by:
getAdjustmentCredit in interface CalculateReturnItemAdjustmentCreditCmd
Returns:
The total amount of the credit (in the same currency of the orderItem).

getLimitAmount

protected java.math.BigDecimal getLimitAmount(OrderItemAdjustmentAccessBean anOrderItemAdjAB)
                                       throws ECException
Return an amount that the adjustment credit will be limited to. This amount should be in the same currency as the adjustment credit. This implementation returns null.
Parameters:
anOrderItemAdjAB - The access bean of the order item adjustment being examined.
Returns:
The limit amount. If there is no limit, null is returned.

getOrderItemAB

protected OrderItemAccessBean getOrderItemAB()
Get the access bean of the order item being returned.
Returns:
The order item access bean.

getRMAItemAB

protected RMAItemAccessBean getRMAItemAB()
Get the RMA item access bean for which the adjustment credit is being calculated.
Returns:
The RMA item access bean.

performExecute

public void performExecute()
                    throws ECException
Execute the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

removeOldAdjustmentCredits

protected void removeOldAdjustmentCredits()
                                   throws ECSystemException
Remove existing adjustment credits for the rma item being processed.

reset

public void reset()
Reset the command.
Overrides:
reset in class AbstractECCommand

setAdjustmentCredit

protected void setAdjustmentCredit(java.math.BigDecimal newAdjustmentCredit)
Set the total adjustment credit for the rma item.
Parameters:
newAdjustmentCredit - The total adjustment credit amount.

setOrderItemAB

public void setOrderItemAB(OrderItemAccessBean anOrderItemAB)
Set the orderItem being returned/refunded.
Specified by:
setOrderItemAB in interface CalculateReturnItemAdjustmentCreditCmd
Parameters:
anOrderItemAB - The orderItem access bean.

setQuantity

public void setQuantity(java.lang.Double aQuantity)
Set the quantity to be credited.
Specified by:
setQuantity in interface CalculateReturnItemAdjustmentCreditCmd
Parameters:
aQuantity - The quantity to be credited.

setRMAItemAB

public void setRMAItemAB(RMAItemAccessBean anRMAItemAB)
Set the RMA Item access bean which will have its adjustment credit updated.
Specified by:
setRMAItemAB in interface CalculateReturnItemAdjustmentCreditCmd
Parameters:
anRMAItemAB - The RMA item access bean.

validateParameters

public void validateParameters()
                        throws ECException
Check mandatory parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -