com.ibm.commerce.returns.commands
Class CalculateReturnItemAdjustmentCreditCmdImpl

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

public class CalculateReturnItemAdjustmentCreditCmdImpl
extends TaskCommandImpl
implements CalculateReturnItemAdjustmentCreditCmd

Default implementation of the CalculateReturnItemAdjustmentCreditCmd interface. 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.

Utilizes these access beans

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands. CalculateReturnItemAdjustmentCreditCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
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. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
ECException

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.
ECException

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 AbstractECTargetableCommand
ECException

removeOldAdjustmentCredits

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

reset

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

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. Checks the following parameters:

Parameters

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECApplicationException - If there is no StoreAccessBean or there is no RMAItemAccessBean or there is no OrderItemAccessBean or a quantity has not be specified , throws com.ibm.commerce.exception.ECApplicationException with ECMessage._ERR_BAD_MISSING_CMD_PARAMETER
ECException