java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.ControllerCommandImpl | +--com.ibm.commerce.couponoffer.commands.AcceptCouponFromBannerAdCmdImpl
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.
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. |
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,calls super. |
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. AccCommand |
accessControlCheck,
getAccCheck,
getForUserId,
getResourceOwners,
setAccCheck,
setForUserId,
setOwner |
Methods inherited from interface com.ibm.commerce.command. ECCommand |
checkIsAllowed,
checkResourcePermission,
createCommandExecutionEvent,
getCommandContext,
getCommandIfName,
getCommandName,
getCommandStoreId,
getDefaultProperties,
getResources,
getUser,
getUserId,
setCommandContext,
setCommandIfName,
setCommandStoreId,
setDefaultProperties |
Field Detail |
---|
protected java.lang.Long userId
protected java.lang.Integer promotionId
protected java.lang.Integer storeId
protected boolean selectionOK
validateParameters
method.
Constructor Detail |
---|
public AcceptCouponFromBannerAdCmdImpl()
Method Detail |
---|
public java.lang.Integer getStoreId()
getStoreId
in interface
ECCommand
getStoreId
in class
AbstractECTargetableCommand
public boolean isReadyToCallExecute()
isReadyToCallExecute
in class
AbstractECTargetableCommand
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.
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
ECException
- If a problem is encountered while creating or finding an
EJB.public void setStoreId(java.lang.Integer newStoreId)
newStoreId
- java.lang.Integerpublic void validateParameters() throws ECException
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
.
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
ECException
- If a problem is encountered while creating or finding an
EJB.