com.ibm.commerce.couponwallet.commands
Class DeleteCouponsFromWalletCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.couponwallet.commands.DeleteCouponsFromWalletCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, DeleteCouponsFromWalletCmd, ECCommand, ECTargetableCommand, Protectable

public class DeleteCouponsFromWalletCmdImpl
extends ControllerCommandImpl
implements DeleteCouponsFromWalletCmd

For each cpwalletId in the input parameter, the STATE of the eCoupon is updated in the CPWALLET table to DELETED. ViewNames SearchWalletView : After deleting the coupons successfully.


Field Summary
protected  java.lang.Long[] couponId
           
protected  int numCoupons
           
protected  boolean selectionOK
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.couponwallet.commands.DeleteCouponsFromWalletCmd
COPYRIGHT, defaultCommandClassName
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
DeleteCouponsFromWalletCmdImpl()
          DeleteCouponsFromWalletCmdImpl constructor call super.
 
Method Summary
 java.lang.Long[] getCouponId()
          Get the coupon ids.
 int getNumCoupons()
          Get the number of coupons.
 AccessVector getResources()
          Get the resources.
 boolean isReadyToCallExecute()
          It always return true.
 void performExecute()
          This method changes the state of the eCoupons to "DELETED".
 void setCouponId(java.lang.Long[] newCouponId)
          Set the coupon id.
 void setNumCoupons(int newNumCoupons)
          Set the number of coupons.
 void validateParameters()
          It extracts the parameters from the request and command context and checks for their correctness.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setRequestProperties, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

couponId

protected java.lang.Long[] couponId

numCoupons

protected int numCoupons

selectionOK

protected boolean selectionOK
Constructor Detail

DeleteCouponsFromWalletCmdImpl

public DeleteCouponsFromWalletCmdImpl()
DeleteCouponsFromWalletCmdImpl constructor call super.
Method Detail

getCouponId

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

getNumCoupons

public int getNumCoupons()
Get the number of coupons.
Returns:
int

getResources

public AccessVector getResources()
                          throws ECSystemException
Get the resources.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
com.ibm.commerce.accesscontrol.AccessVector
Throws:
ECSystemException -  

isReadyToCallExecute

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

performExecute

public void performExecute()
                    throws ECException
This method changes the state of the eCoupons to "DELETED".
For each cpwalletId in the input parameter, first it is checked whether the coupon belongs to this user. If yes, the STATE of the eCoupon is updated in the CPWALLET table to DELETED.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If a problem is encountered while creating or finding an EJB.

setCouponId

public void setCouponId(java.lang.Long[] newCouponId)
Set the coupon id.
Parameters:
newCouponId - java.lang.Long[]

setNumCoupons

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

validateParameters

public void validateParameters()
                        throws ECException
It extracts the parameters from the request and command context and checks for their correctness.

It takes the couponIds from the command context as String [] and converts to Long []. This also sets the numCoupons field. from the commandContext. It finds the promotionId for this promotionName.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException -