com.ibm.commerce.returns.commands
Class AutoApproveReturnItemByDaysPolicyCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.command.BusinessPolicyCommandImpl
                    |
                    +--com.ibm.commerce.returns.commands.AutoApproveReturnItemByDaysPolicyCmdImpl
All Implemented Interfaces:
AutoApproveReturnItemPolicyCmd, BusinessPolicyCommand, ECCommand, TaskCommand

public class AutoApproveReturnItemByDaysPolicyCmdImpl
extends BusinessPolicyCommandImpl
implements AutoApproveReturnItemPolicyCmd

This is an automatic approval policy implementation based on the number of days since the item was shipped. The property passed to this policy may be of the following form:

In this case, the returns period is 30 days (that is, an item can be placed on a RMA up to and including 30 days after the item was shipped). If it has been more than the specified number of days allowed, the item is not automatically approved. If no days property is specified then all items will pass this approval check (that is, there would be no limitation on when items could be returned).

If the ship date of the item cannot be determined (from the ORDSHIPHST table) then the item will fail this test and not be automatically approved.

If this automatic approval test is unsuccessful then the deny reason 'EXCDATE' will be logged for the RMA item.


Fields inherited from class com.ibm.commerce.command.BusinessPolicyCommandImpl
policyId, requestProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.returns.commands.AutoApproveReturnItemPolicyCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
AutoApproveReturnItemByDaysPolicyCmdImpl()
          AutoApproveReturnItemByDaysPolicyCmdImpl constructor.
 
Method Summary
protected  void autoApproveRMAItem()
          Calculate whether the RMA item can be approved programatically based on the number of days since the item was shipped.
protected  void determineDenyReason(java.lang.String denyCode)
          Log a reason for autoapprove denial.
protected  java.lang.Integer getDays()
          Get the number of days in the return period.
 java.util.List getRMAItemDenyReasonList()
          Get the deny reason list.
 void performExecute()
          Execute the command.
 void reset()
          This method is called after a command has been executed to reset its states variables.
 void setRequestProperties(TypedProperty requestProperties)
          Set the request properties for the policy.
 void setRMAItemAB(RMAItemAccessBean RMAItemAB)
          Set the RMA item being accessed.
 void setRMAItemDenyReasonList(java.util.List newRMAItemDenyReasons)
          Set the list of deny reason codes for this RMA item.
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.BusinessPolicyCommandImpl
getPolicyId, getRequestProperties, setPolicyId
 
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.BusinessPolicyCommand
getPolicyId, getRequestProperties, setPolicyId
 
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

AutoApproveReturnItemByDaysPolicyCmdImpl

public AutoApproveReturnItemByDaysPolicyCmdImpl()
AutoApproveReturnItemByDaysPolicyCmdImpl constructor.
Method Detail

autoApproveRMAItem

protected void autoApproveRMAItem()
                           throws javax.ejb.FinderException,
                                  java.rmi.RemoteException,
                                  javax.naming.NamingException,
                                  javax.ejb.CreateException,
                                  ECException
Calculate whether the RMA item can be approved programatically based on the number of days since the item was shipped. If not, the deny reason 'EXCDATE' is added to the deny reason list.

determineDenyReason

protected void determineDenyReason(java.lang.String denyCode)
Log a reason for autoapprove denial.
Parameters:
denyCode - Code, generic across stores, of the deny reason

getDays

protected java.lang.Integer getDays()
Get the number of days in the return period.
Returns:
The number of days.

getRMAItemDenyReasonList

public java.util.List getRMAItemDenyReasonList()
Get the deny reason list.
Specified by:
getRMAItemDenyReasonList in interface AutoApproveReturnItemPolicyCmd
Returns:
List The list of deny reason codes.

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

setRequestProperties

public void setRequestProperties(TypedProperty requestProperties)
Set the request properties for the policy.
Specified by:
setRequestProperties in interface BusinessPolicyCommand
Overrides:
setRequestProperties in class BusinessPolicyCommandImpl
Parameters:
requestProperties - The request properties.

setRMAItemAB

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

setRMAItemDenyReasonList

public void setRMAItemDenyReasonList(java.util.List newRMAItemDenyReasons)
Set the list of deny reason codes for this RMA item.
Specified by:
setRMAItemDenyReasonList in interface AutoApproveReturnItemPolicyCmd
Parameters:
newRMAItemDenyReasons - The list of deny reason codes 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. -