com.ibm.commerce.returns.commands
Class AutoApproveReturnItemStandardChecksCmdImpl

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

public class AutoApproveReturnItemStandardChecksCmdImpl
extends TaskCommandImpl
implements AutoApproveReturnItemStandardChecksCmd

Command used for the base evaluation of whether a return mechandise authorization (RMA) item may be approved programatically. Checks that item creditable (STOREITEM.CREDITABLE). Checks that all components of RMA item are expected for receipt (RMAITEMCMP.SHOULDRECEIVE = Y) or that based on an item setting (STOREITEM.RETURNNOTDESIRED) the merchant doesn't want physical merchandise to be returned (RMAITEMCMP.SHOULDRECEIVE = S). Checks if this RMA item were approved, would the total quantity approved still be within the quantity shipped for the order item (ORDSHIPHST.QYTSHIPPED); Each component is evaluated seperately. Checks if this RMA item were approved, would amount approved for credit still be within the amount deposited against the payment; the order payment is compared to all RMA items from that same order. For each failed test a deny reason is logged against the RMA item. The deny reason codes are ITMNOTCRED, PRODREQ, EXCSHIP, EXCPAY. These are translated to the corresponding store return reason id, before they are logged in RMAIDNYRSN.


Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands.AutoApproveReturnItemStandardChecksCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
AutoApproveReturnItemStandardChecksCmdImpl()
          AutoApproveReturnItemStandardChecksCmdImpl constructor.
 
Method Summary
protected  boolean areAllComponentsBeingReturned(java.util.Vector vRMAItemCmps, OrderItemAccessBean orderItemAccessBean, java.lang.Long itemSpecID)
          Checks if any RMA item components are marked as the customer does not intend to return the merchandise.
protected  void doStandardChecks()
          Performs the non-policy driven logic of auto-approval
 java.util.List getRMAItemDenyReasonList()
          Get the list of deny reasons for this RMA item
protected  boolean isItemCreditable(java.lang.Long itemSpecID)
          Check if baseitem represented in RMAitem is creditable
protected  boolean isThisWithinAmountPaid(java.util.Vector vRMAItemCmps, OrderItemAccessBean orderItemAccessBean, com.ibm.commerce.returns.commands.OrderManagementJDBCHelperAccessBean rmaHelperAB)
          Checks if this RMA item were approved, would amount approved for credit still be within the amount deposited against the payment; the order payment is compared to all RMA items from that same order.
protected  boolean isThisWithinQuantityShipped(java.util.Vector vRMAItemCmps, OrderItemAccessBean orderItemAccessBean, com.ibm.commerce.returns.commands.OrderManagementJDBCHelperAccessBean rmaHelperAB)
          Checks if this RMA item were approved, would the total quantity approved still be within the quantity shipped for the order item; Each component is evaluated seperately.
 void performExecute()
          Execute the command.
 void reset()
          This method is called after a command has been executed to reset its states variables.
 void setRMAItemAB(RMAItemAccessBean RMAItemAB)
          Set the RMA item being accessed.
 void setRMAItemDenyReasonList(java.util.List RMAItemDenyReasonList)
          Set the list of deny reason id for this RMA item
 void validateParameters()
          Performs server side parameter checking.
 
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

AutoApproveReturnItemStandardChecksCmdImpl

public AutoApproveReturnItemStandardChecksCmdImpl()
AutoApproveReturnItemStandardChecksCmdImpl constructor.
Method Detail

areAllComponentsBeingReturned

protected boolean areAllComponentsBeingReturned(java.util.Vector vRMAItemCmps,
                                                OrderItemAccessBean orderItemAccessBean,
                                                java.lang.Long itemSpecID)
                                         throws javax.ejb.FinderException,
                                                java.rmi.RemoteException,
                                                javax.naming.NamingException,
                                                javax.ejb.CreateException
Checks if any RMA item components are marked as the customer does not intend to return the merchandise. Excludes components which the merchant does not want physically returned.
Parameters:
vRMAItemCmps - Vector if RMA item components
orderItemAccessBean - Order item access bean
itemSpecID - Item Specification Id
Returns:
true if all items desired by merchant are going to be physically returned; false otherwise.

doStandardChecks

protected void doStandardChecks()
                         throws javax.ejb.FinderException,
                                java.rmi.RemoteException,
                                javax.naming.NamingException,
                                javax.ejb.CreateException,
                                ECException
Performs the non-policy driven logic of auto-approval

getRMAItemDenyReasonList

public java.util.List getRMAItemDenyReasonList()
Get the list of deny reasons for this RMA item
Specified by:
getRMAItemDenyReasonList in interface AutoApproveReturnItemStandardChecksCmd
Returns:
List of applicable deny reason codes

isItemCreditable

protected boolean isItemCreditable(java.lang.Long itemSpecID)
                            throws javax.ejb.FinderException,
                                   java.rmi.RemoteException,
                                   javax.naming.NamingException,
                                   javax.ejb.CreateException,
                                   ECException
Check if baseitem represented in RMAitem is creditable
Parameters:
itemSpecID - item specification Id
Returns:
true if item is marked to allow credits by default; false otherwise.

isThisWithinAmountPaid

protected boolean isThisWithinAmountPaid(java.util.Vector vRMAItemCmps,
                                         OrderItemAccessBean orderItemAccessBean,
                                         com.ibm.commerce.returns.commands.OrderManagementJDBCHelperAccessBean rmaHelperAB)
                                  throws javax.ejb.FinderException,
                                         java.rmi.RemoteException,
                                         javax.naming.NamingException,
                                         javax.ejb.CreateException,
                                         java.sql.SQLException
Checks if this RMA item were approved, would amount approved for credit still be within the amount deposited against the payment; the order payment is compared to all RMA items from that same order.
Parameters:
vRMAItemCmps - Vector of the RMA Item's components
orderItemAccessBean - access bean of the order item associated with this RMA item, if any.
rmaHelperAB - Initialized instance of the return processing helper
Returns:
true if approving this RMAitem would not make total approved amount exceed amount deposited; false otherwise.

isThisWithinQuantityShipped

protected boolean isThisWithinQuantityShipped(java.util.Vector vRMAItemCmps,
                                              OrderItemAccessBean orderItemAccessBean,
                                              com.ibm.commerce.returns.commands.OrderManagementJDBCHelperAccessBean rmaHelperAB)
                                       throws javax.ejb.FinderException,
                                              java.rmi.RemoteException,
                                              javax.naming.NamingException,
                                              javax.ejb.CreateException,
                                              java.sql.SQLException
Checks if this RMA item were approved, would the total quantity approved still be within the quantity shipped for the order item; Each component is evaluated seperately.
Parameters:
vRMAItemCmps - Vector of the RMA Item's components
orderItemAccessBean - access bean of the order item associated with this RMA item, if any.
rmaHelperAB - Initialized instance of the return processing helper
Returns:
true if approving this RMAitem would not make total approved quantity exceed quantity shipped; false otherwise.

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.

reset

public void reset()
Description copied from class: AbstractECCommand
This method is called after a command has been executed to reset its states variables. After the call to reset, we should be able to execute the command again.
Overrides:
reset in class AbstractECCommand

setRMAItemAB

public void setRMAItemAB(RMAItemAccessBean RMAItemAB)
Set the RMA item being accessed.
Specified by:
setRMAItemAB in interface AutoApproveReturnItemStandardChecksCmd
Parameters:
RMAitemAB - the RMA item access bean.

setRMAItemDenyReasonList

public void setRMAItemDenyReasonList(java.util.List RMAItemDenyReasonList)
Set the list of deny reason id for this RMA item
Specified by:
setRMAItemDenyReasonList in interface AutoApproveReturnItemStandardChecksCmd
Parameters:
RMAItemDenyReasonList - List of deny reason ids applicable to this RMA item

validateParameters

public void validateParameters()
                        throws ECException
Description copied from interface: ECCommand
Performs server side parameter checking. This method replaces the checkParameters() method in a previous version of the code.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -