com.ibm.commerce.couponredemption.commands
Class CouponDSSTaskCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.couponredemption.commands.CouponDSSTaskCmdImpl
All Implemented Interfaces:
CouponDSSTaskCmd, ECCommand, TaskCommand

public class CouponDSSTaskCmdImpl
extends TaskCommandImpl
implements CouponDSSTaskCmd

This task command is called from the COUPONDSSCMD when user selects a set of eCoupons to be used in her order. In case of any conflict among the user selected set of eCoupons, the previous set of eCoupons from CouponWallet is thrown back to user, else the final selection page is displayed with the order prepare button.

The input to this command are :

First the eCoupons with selection status whether SELECTED or not is checked and it shouldn't have a common item in their itemlist where the itemlist is obtained from TCPITMAP table. If the number of selected order eCoupon is not more than one, the complete list of applicable eCoupons is shown to the user again and asked to reselect.
If the above condition not satisfied, the selected eCoupons are moved to ORCPMAP table from TORCPMAP table and the unselected eCoupons are to be deleted from TORCPMAP table. The entries corresponding to selected eCoupons are moved to CPITMAP table from TCPITMAP table and the entries corresponding to unselected eCoupons are deleted from TCPITMAP table. Then the final eCoupon selection summary page is displayed with the discounts incorporated.


Field Summary
protected  java.util.Hashtable conflicts
           
protected  java.lang.Long[] couponId
           
protected  java.math.BigDecimal[] discAmt
           
protected  java.util.Vector[] itemList
           
protected  int numCoupons
           
protected  java.lang.Long orderId
           
protected  CommandContext processingContext
           
protected  TypedProperty reqProp
           
protected  TypedProperty rspProp
           
protected  boolean validSelection
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.couponredemption.commands.CouponDSSTaskCmd
COPYRIGHT, defaultCommandClassName, Name
 
Constructor Summary
CouponDSSTaskCmdImpl()
          CouponDSSCmdImpl constructor, call super.
 
Method Summary
 void computeItemAndDiscount()
          Finds the items and discount on those corresponding to each cpwalletId.
 java.util.Hashtable getConflicts()
          Returns the conflict hashtable.
 java.lang.Long[] getCouponId()
          Ge the coupon ids.
 int getNumCoupons()
          Returns the conflict hashtable.
 java.lang.Long getOrderId()
          Get the order ids.
 TypedProperty getReqProp()
          Get the request properties.
 TypedProperty getRspProp()
          Get the response properties.
 boolean isReadyToCallExecute()
          It always return true.
 boolean isValidSelection()
          Returns whether the selection is valid or not.
 void performExecute()
          This shopper command is called when user selects a set of eCoupons to be used in an order.
 void setConflicts(java.util.Hashtable newConflicts)
          Sets the conflict variable.
 void setCouponId(java.lang.Long[] newCouponId)
          Set the ecoupon Id.
 void setNumCoupons(int newNumCoupons)
          Sets the number of coupons.
 void setOrderId(java.lang.Long newOrderId)
          Set the order ids.
 void setValidSelection(boolean newValidSelection)
          Set valid selection.
 void transferFromTemp()
          Transfer the entries from tempordercouponmap and tempcouponitemmap tables to the ordercouponmap and couponitemmap tables.
 void validateParameters()
          Check the parameters.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, reset, 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
 

Field Detail

conflicts

protected java.util.Hashtable conflicts

couponId

protected java.lang.Long[] couponId

discAmt

protected java.math.BigDecimal[] discAmt

itemList

protected java.util.Vector[] itemList

numCoupons

protected int numCoupons

orderId

protected java.lang.Long orderId

processingContext

protected CommandContext processingContext

reqProp

protected TypedProperty reqProp

rspProp

protected TypedProperty rspProp

validSelection

protected boolean validSelection
Constructor Detail

CouponDSSTaskCmdImpl

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

computeItemAndDiscount

public void computeItemAndDiscount()
                            throws ECSystemException
Finds the items and discount on those corresponding to each cpwalletId.

getConflicts

public java.util.Hashtable getConflicts()
Returns the conflict hashtable.
Specified by:
getConflicts in interface CouponDSSTaskCmd
Returns:
java.util.Hashtable

getCouponId

public java.lang.Long[] getCouponId()
Ge the coupon ids.
Returns:
java.lang.Long[]

getNumCoupons

public int getNumCoupons()
Returns the conflict hashtable.
Specified by:
getNumCoupons in interface CouponDSSTaskCmd
Returns:
int

getOrderId

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

getReqProp

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

getRspProp

public TypedProperty getRspProp()
Get the response properties.
Returns:
com.ibm.commerce.datatype.TypedProperty

isReadyToCallExecute

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

isValidSelection

public boolean isValidSelection()
Returns whether the selection is valid or not.
Specified by:
isValidSelection in interface CouponDSSTaskCmd
Returns:
boolean

performExecute

public void performExecute()
                    throws ECException

This shopper command is called when user selects a set of eCoupons to be used in an order. The task command CouponDSSTaskCmd is used for those eCoupons which are used together as customizable.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Throws:
: - com.ibm.commerce.exception.ECException.

setConflicts

public void setConflicts(java.util.Hashtable newConflicts)
Sets the conflict variable.
Parameters:
newConflicts - java.util.Hashtable

setCouponId

public void setCouponId(java.lang.Long[] newCouponId)
Set the ecoupon Id.
Specified by:
setCouponId in interface CouponDSSTaskCmd
Parameters:
newCouponId - java.lang.Long[]

setNumCoupons

public void setNumCoupons(int newNumCoupons)
Sets the number of coupons.
Parameters:
newNumCoupons - int

setOrderId

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

setValidSelection

public void setValidSelection(boolean newValidSelection)
Set valid selection.
Parameters:
newValidSelection - boolean

transferFromTemp

public void transferFromTemp()
                      throws ECSystemException

Transfer the entries from tempordercouponmap and tempcouponitemmap tables to the ordercouponmap and couponitemmap tables. Also, mark the selected coupons as 'in progress'.

Throws:
: - com.ibm.commerce.exception.ECException.

validateParameters

public void validateParameters()
                        throws ECException
Check the parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Throws:
ECException -