com.ibm.commerce.couponoffer.commands
Class AcceptCouponFromBannerAdCmdImpl
java.lang.Object
CacheableCommandImpl
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 creates an eCoupon and puts it in the wallet of the customer when she clicks on a banner ad or on the URL sent in a promotional e-mail to accept an eCoupon.
If the promotion in CouponPromotionAccessBean corresponding to the parameter promoName (and optionally the storeId), has an ACTIVE status and if TOTALNUMOFFER is -1 (implying any number of coupons can be issued for this promotion) or number of coupons already issued from this promotion is less then total number of coupons that can be issued, then a coupon may be issued. Further, the customer should not have already accepted too many coupons. If the user is unregistered and accepts the coupon from e-mail, number of coupons already accepted is found from the PromoAcceptedAccessBean for that user's SHOPPEREMAILID. For registered shoppers, the number of coupons accepted is found from the CouponWalletAccessBean. Then an entry is created in the CouponWalletAccessBean. The number of accepted coupons is updated for this promotion. If the conditions are not satisfied then an error page is displayed.
- See Also:
- Serialized Form
Field Summary |
protected java.lang.Integer |
promotionId
The ID of the promotion from which the coupon is being accepted |
protected boolean |
selectionOK
Indicates if the parameters are OK for further processing. |
protected java.lang.Integer |
storeId
The ID of the store from which this coupon is being accepted |
protected java.lang.Long |
userId
The ID of the user invoking this command. |
Method Summary |
java.lang.Integer |
getStoreId()
Gets the store ID. |
boolean |
isReadyToCallExecute()
It always returns true. |
void |
performExecute()
If the promotion in CouponPromotionAccessBean corresponding to the parameter promoName (and optionally the storeId), has an ACTIVE status and if TOTALNUMOFFER is -1 (implying any number of coupons can be issued for this promotion) or number of coupons already issued from this promotion is less then total number of coupons that can be issued, then a coupon may be issued. |
void |
setStoreId(java.lang.Integer newStoreId)
Sets the store ID. |
void |
validateParameters()
It extracts the parameters from request and command context and checks for their correctness. |
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl |
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setRequestProperties, setResponseProperties, setRetriable, setViewInputProperties |
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand |
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getUser, getUserId, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, 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.ControllerCommand |
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties |
Methods inherited from interface com.ibm.commerce.command.ECCommand |
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties |
userId
protected java.lang.Long userId
- The ID of the user invoking this command.
promotionId
protected java.lang.Integer promotionId
- The ID of the promotion from which the coupon is being accepted
storeId
protected java.lang.Integer storeId
- The ID of the store from which this coupon is being accepted
selectionOK
protected boolean selectionOK
- Indicates if the parameters are OK for further processing. Set in the validateParameters method.
AcceptCouponFromBannerAdCmdImpl
public AcceptCouponFromBannerAdCmdImpl()
- AcceptCouponFromBannerAdCmdImpl constructor,calls super.
getStoreId
public java.lang.Integer getStoreId()
- Gets the store ID.
-
- Specified by:
- getStoreId in interface ECCommand
- Overrides:
- getStoreId in class AbstractECTargetableCommand
-
- Returns:
- java.lang.Integer The store ID of this store.
isReadyToCallExecute
public boolean isReadyToCallExecute()
- It always returns true.
-
- Overrides:
- isReadyToCallExecute in class AbstractECTargetableCommand
-
- Returns:
- boolean
performExecute
public void performExecute()
throws ECException
-
If the promotion in CouponPromotionAccessBean corresponding to the parameter promoName (and optionally the storeId), has an ACTIVE status and if TOTALNUMOFFER is -1 (implying any number of coupons can be issued for this promotion) or number of coupons already issued from this promotion is less then total number of coupons that can be issued, then a coupon may be issued. Further, the customer should not have already accepted too many coupons. If the user is unregistered and accepts the coupon from e-mail, number of coupons already accepted is found from the PromoAcceptedAccessBean for that user's SHOPPEREMAILID. For registered shoppers, the number of coupons accepted is found from the CouponWalletAccessBean. Then an entry is created in the CouponWalletAccessBean. The number of accepted coupons is updated for this promotion. 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)
- Sets the store ID.
-
- Parameters:
- newStoreId - java.lang.Integer
validateParameters
public void validateParameters()
throws ECException
- It extracts the parameters from request and command context and checks for their correctness.
It takes the promoName, acceptedFromType, successURL and shopperEmailId from the request. It takes storeId and userId from the commandContext. It finds the promotionId for this promoName.
-
- Specified by:
- validateParameters in interface ECCommand
- Overrides:
- validateParameters in class AbstractECTargetableCommand
-
- Throws:
- ECException - If a problem is encountered while creating or finding an EJB.
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.