com.ibm.commerce.couponoffer.commands
Class AcceptCouponFromBannerAdCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.couponoffer.commands.AcceptCouponFromBannerAdCmdImpl
All Implemented Interfaces:
AccCommand, AcceptCouponFromBannerAdCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable

public class AcceptCouponFromBannerAdCmdImpl
extends ControllerCommandImpl
implements AcceptCouponFromBannerAdCmd

This command is invoked when the shopper clicks on a banner ad to accept an eCoupon.

For the promotion in CPPMN table corresponding to the parameter promoName, if the STATUS is ACTIVE and if TOTALNUMOFFER is -1 or NUMOFFERED less then TOTALNUMOFFER, an entry is created in the CPWALLET table with cpwalletld being generated using keys table. The userId and storeId are extracted from the command context. The value of NUMOFFERED column is updated for this promotion in the CPPMN table. If the conditions are not satisfied then an error page is displayed. ViewNames SearchWalletView : If the coupon was accepted successfully BannerAdErrorView : Otherwise


Field Summary
protected  java.lang.Integer promotionId
           
protected  boolean selectionOK
           
protected  java.lang.Integer storeId
           
protected  java.lang.Long userId
           
 
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.couponoffer.commands.AcceptCouponFromBannerAdCmd
COPYRIGHT, defaultCommandClassName
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
AcceptCouponFromBannerAdCmdImpl()
          AcceptCouponFromBannerAdCmdImpl constructor,call super .
 
Method Summary
 java.lang.Integer getStoreId()
          Get the store id.
 boolean isReadyToCallExecute()
          It always return true.
 void performExecute()
          For the promotion in CPPMN table corresponding to the parameter promoName, if the STATUS is ACTIVE and if TOTALNUMOFFER is -1 or NUMOFFERED less then TOTALNUMOFFER, an entry is created in the CPWALLET table with cpwalletld being generated using keys table.
 void setStoreId(java.lang.Integer newStoreId)
          Set the store Ids.
 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, getResources, 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, getResources, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

promotionId

protected java.lang.Integer promotionId

selectionOK

protected boolean selectionOK

storeId

protected java.lang.Integer storeId

userId

protected java.lang.Long userId
Constructor Detail

AcceptCouponFromBannerAdCmdImpl

public AcceptCouponFromBannerAdCmdImpl()
AcceptCouponFromBannerAdCmdImpl constructor,call super .
Method Detail

getStoreId

public java.lang.Integer getStoreId()
Get the store id.
Specified by:
getStoreId in interface ECCommand
Overrides:
getStoreId in class AbstractECTargetableCommand
Returns:
java.lang.Integer

isReadyToCallExecute

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

performExecute

public void performExecute()
                    throws ECException
For the promotion in CPPMN table corresponding to the parameter promoName, if the STATUS is ACTIVE and if TOTALNUMOFFER is -1 or NUMOFFERED less then TOTALNUMOFFER, an entry is created in the CPWALLET table with cpwalletld being generated using keys table.

ShopperId and storeId are extracted from the command context. The value of NUMOFFERED column is updated for this promotion in the CPPMN table. If the conditions are not satisfied then an error page is displayed.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If a problem is encountered while creating or finding an EJB.

setStoreId

public void setStoreId(java.lang.Integer newStoreId)
Set the store Ids.
Parameters:
newStoreId - java.lang.Integer

validateParameters

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

It takes the promotionName from the request and storeId and userId is extracted from the commandContext. It finds the promotionId for this promotionName.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - If a problem is encountered while creating or finding an EJB.