com.ibm.commerce.couponredemption.commands
Class CalculateDiscountAmtCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.command.BusinessPolicyCommandImpl
                    |
                    +--com.ibm.commerce.order.calculation.CalculationCmdImpl
                          |
                          +--com.ibm.commerce.couponredemption.commands.CalculateDiscountAmtCmdImpl
All Implemented Interfaces:
BusinessPolicyCommand, CalculateDiscountAmtCmd, CalculationCmd, ECCommand, TaskCommand

public class CalculateDiscountAmtCmdImpl
extends CalculationCmdImpl
implements CalculateDiscountAmtCmd

The purpose of the task command is to computes the discount amount for each eCoupon that satisfy the purchase order conditions of the of the eCoupon.

The input to this command are :

First the orderItems for a order are found out and for each cpwalletId, corresponding promoId is found out from the CPWALLET table. The corresponding calcodeId are found out from CPPMNDISC table by using the obtained promoId. A mapping is computed between OrderItemAccessBean ( corresponding to the items qualified for this cpwalletId) and the Categorized MonetaryAmount(Set to zero). The task command CalculationCodeCalculate command with usage type as eCoupons and the mapping created above are called and the discount amounts are stored in TCPITMAP table. These above steps are performed for each cpwalletId.


Field Summary
protected  java.util.Vector[] appItems
           
protected  java.lang.Long[] bcIds
           
protected  java.lang.Long orderId
           
protected  CommandContext processingContext
           
protected  TypedProperty reqProp
           
protected  java.util.Hashtable returnTable
           
protected  TypedProperty rspProp
           
 
Fields inherited from class com.ibm.commerce.order.calculation.CalculationCmdImpl
COPYRIGHT
 
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.couponredemption.commands.CalculateDiscountAmtCmd
COPYRIGHT, defaultCommandClassName, Name
 
Fields inherited from interface com.ibm.commerce.order.calculation.CalculationCmd
NAME
 
Constructor Summary
CalculateDiscountAmtCmdImpl()
          CouponDSSCmdImpl constructor, call super.
 
Method Summary
 boolean checkParentCatEntryIds(java.lang.Long oiCatEntryId, java.lang.Long walletCatEntryId)
          Check the parent catalog entry.
 java.util.Vector[] getAppItems()
          Get the applied items.
static java.lang.String getIClassName()
          Get the class name.
 java.lang.Long getOrderId()
          Get the orderIds.
 CommandContext getProcessingContext()
          Get the processing context.
 TypedProperty getReqProp()
          Get request properties.
 TypedProperty getResponseProperties()
          Get the responce properties.
 java.util.Hashtable getReturnTable()
          Get the return table.
 TypedProperty getRspProp()
          Get the responce properties.
 boolean isReadyToCallExecute()
          It always return true.
 void performExecute()
          The purpose of the task command is to computes the discount amount for each eCoupon that satisfy the purchase order conditions of the of the eCoupon.
 void setAppItems(java.util.Vector[] newAppItems)
          It set the applied items.
 void setBcIds(java.lang.Long[] paramBcIds)
          Set the eCouponIds.
 void setOrderId(java.lang.Long newOrderId)
          Set the order ids.
 void setProcessingContext(CommandContext newProcessingContext)
          Set the processing context.
 void setReqProp(TypedProperty newReqProp)
          Set the request properties.
 void setRequestProperties(TypedProperty paramReqProp)
          Set the request properties.
 void setReturnTable(java.util.Hashtable newReturnTable)
          set the return table.
 void setRspProp(TypedProperty newRspProp)
          Set the responce properties.
 
Methods inherited from class com.ibm.commerce.order.calculation.CalculationCmdImpl
createCommand, getCurrency, getCustomProperties, getCustomProperty, getTimestamp, getUsageId, reset, setCurrency, setCustomProperties, setCustomProperty, setTimestamp, setUsageId
 
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, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
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, validateParameters
 
Methods inherited from interface com.ibm.commerce.command.BusinessPolicyCommand
getPolicyId, getRequestProperties, setPolicyId
 

Field Detail

appItems

protected java.util.Vector[] appItems

bcIds

protected java.lang.Long[] bcIds

orderId

protected java.lang.Long orderId

processingContext

protected CommandContext processingContext

reqProp

protected TypedProperty reqProp

returnTable

protected java.util.Hashtable returnTable

rspProp

protected TypedProperty rspProp
Constructor Detail

CalculateDiscountAmtCmdImpl

public CalculateDiscountAmtCmdImpl()
CouponDSSCmdImpl constructor, call super.
Method Detail

checkParentCatEntryIds

public boolean checkParentCatEntryIds(java.lang.Long oiCatEntryId,
                                      java.lang.Long walletCatEntryId)
                               throws ECSystemException
Check the parent catalog entry.
Returns:
java.util.Enumeration

getAppItems

public java.util.Vector[] getAppItems()
Get the applied items.
Returns:
java.util.Vector

getIClassName

public static final java.lang.String getIClassName()
Get the class name.
Returns:
java.lang.String

getOrderId

public java.lang.Long getOrderId()
Get the orderIds.
Returns:
java.lang.Long

getProcessingContext

public CommandContext getProcessingContext()
Get the processing context.
Returns:
com.ibm.commerce.command.CommandContext

getReqProp

public TypedProperty getReqProp()
Get request properties.
Returns:
com.ibm.commerce.datatype.TypedProperty

getResponseProperties

public TypedProperty getResponseProperties()
Get the responce properties.
Specified by:
getResponseProperties in interface CalculateDiscountAmtCmd
Returns:
com.ibm.commerce.datatype.TypedProperty

getReturnTable

public java.util.Hashtable getReturnTable()
Get the return table.
Specified by:
getReturnTable in interface CalculateDiscountAmtCmd
Returns:
java.util.Hashtable

getRspProp

public TypedProperty getRspProp()
Description copied from interface: CalculateDiscountAmtCmd
Get the responce properties.
Specified by:
getRspProp in interface CalculateDiscountAmtCmd
Returns:
com.ibm.commerce.datatype.TypedProperty

isReadyToCallExecute

public boolean isReadyToCallExecute()
It always return true.
Overrides:
isReadyToCallExecute in class AbstractECCommand
Returns:
boolean

performExecute

public void performExecute()
                    throws ECException

The purpose of the task command is to computes the discount amount for each eCoupon that satisfy the purchase order conditions of the of the eCoupon.
First the orderItems for a order are found out and for each cpwalletId, corresponding promoId is found out from the CPWALLET table. The corresponding calcodeId are found out from CPPMNDISC table by using the obtained promoId. A mapping is computed between OrderItemAccessBean ( corresponding to the items qualified for this cpwalletId) and the Categorized MonetaryAmount(Set to zero). The task command CalculationCodeCalculate command with usage type as eCoupons and the mapping created above are called and the discount amounts are stored in TCPITMAP table. These above steps are performed for each cpwalletId.

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.

setAppItems

public void setAppItems(java.util.Vector[] newAppItems)
It set the applied items.
Specified by:
setAppItems in interface CalculateDiscountAmtCmd
Parameters:
newAppItems - java.util.Vector

setBcIds

public void setBcIds(java.lang.Long[] paramBcIds)
Set the eCouponIds.
Specified by:
setBcIds in interface CalculateDiscountAmtCmd
Parameters:
paramBcIds - java.lang.Long

setOrderId

public void setOrderId(java.lang.Long newOrderId)
Set the order ids.
Specified by:
setOrderId in interface CalculateDiscountAmtCmd
Parameters:
newOrderId - java.lang.Long

setProcessingContext

public void setProcessingContext(CommandContext newProcessingContext)
Set the processing context.
Specified by:
setProcessingContext in interface CalculateDiscountAmtCmd
Parameters:
newProcessingContext - com.ibm.commerce.command.CommandContext

setReqProp

public void setReqProp(TypedProperty newReqProp)
Description copied from interface: CalculateDiscountAmtCmd
Set the request properties.
Specified by:
setReqProp in interface CalculateDiscountAmtCmd
Parameters:
newReqProp - com.ibm.commerce.datatype.TypedProperty

setRequestProperties

public void setRequestProperties(TypedProperty paramReqProp)
Set the request properties.
Specified by:
setRequestProperties in interface CalculateDiscountAmtCmd
Overrides:
setRequestProperties in class BusinessPolicyCommandImpl
Parameters:
paramReqProp - com.ibm.commerce.datatype.TypedProperty

setReturnTable

public void setReturnTable(java.util.Hashtable newReturnTable)
set the return table.
Parameters:
newReturnTable - java.util.Hashtable

setRspProp

public void setRspProp(TypedProperty newRspProp)
Set the responce properties.
Parameters:
newRspProp - com.ibm.commerce.datatype.TypedProperty