com.ibm.commerce.returns.commands
Class CalculateReturnItemAdjustmentPercentagePolicyCmdImpl

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

public class CalculateReturnItemAdjustmentPercentagePolicyCmdImpl
extends CalculateReturnItemAdjustmentPolicyCmdImpl
implements CalculateReturnItemAdjustmentPolicyCmd

Calculate the adjustment for a return mechandise authorization (RMA) item based on a percentage. The properties passed to this policy may be of the following form:

If a days property is specified and no percent property, then percent=0 is assumed (that is, no adjustment). If the number of days since the item was shipped is more than any of the days_i properties then percent = 0 is assumed (unless a default value is specified).

An example property string is:

This translates into "If the item is returned within 30 days of it being shipped then there is no charge. If it is returned within 90 days then there is a 10% charge. Otherwise, there is a 20% charge."


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.CalculateReturnItemAdjustmentPolicyCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
CalculateReturnItemAdjustmentPercentagePolicyCmdImpl()
          CalculateReturnItemAdjustmentPercentagePolicyCmdImpl constructor.
 
Method Summary
protected  java.math.BigDecimal calcAdjustment()
          Calculate the RMA item adjustment (charge).
protected  int findAppropriatePercent(int aDaysSinceShipped)
          Find the appropriate percent charge.
protected  java.lang.Integer getDefault()
          Get the default percentage (if specified).
 void reset()
          Reset the command.
 void setRequestProperties(TypedProperty requestProperties)
          Set the request properties for the policy.
 
Methods inherited from class com.ibm.commerce.returns.commands.CalculateReturnItemAdjustmentPolicyCmdImpl
calcTimestampShipped, createCharge, findBestDays, getAdjustment, getDaysSince, getOrderItemAB, getRMAItemAB, getTotalToAdjust, performExecute, removeExistingCharges, setOrderItemAB, setRMAItemAB, validateParameters
 
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.returns.commands.CalculateReturnItemAdjustmentPolicyCmd
getAdjustment, setOrderItemAB, setRMAItemAB
 
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, performExecute, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 

Constructor Detail

CalculateReturnItemAdjustmentPercentagePolicyCmdImpl

public CalculateReturnItemAdjustmentPercentagePolicyCmdImpl()
CalculateReturnItemAdjustmentPercentagePolicyCmdImpl constructor.
Method Detail

calcAdjustment

protected java.math.BigDecimal calcAdjustment()
                                       throws ECException
Calculate the RMA item adjustment (charge).
Overrides:
calcAdjustment in class CalculateReturnItemAdjustmentPolicyCmdImpl
Returns:
The adjustment (charge) amount.

findAppropriatePercent

protected int findAppropriatePercent(int aDaysSinceShipped)
Find the appropriate percent charge.
Parameters:
aDaysSinceShipped - The number of days since the item was shipped.
Returns:
The percent amount.

getDefault

protected java.lang.Integer getDefault()
Get the default percentage (if specified).
Returns:
The default percentage.

reset

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

setRequestProperties

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