public class PromotionCodeAddRemoveControllerCmdImpl extends ControllerCommandImpl implements PromotionCodeAddRemoveControllerCmd
This Controller Command adds or removes a PromotionCode
from
an Order
. It implements the PromotionCodeAddRemoveControllerCmd
interface. This command is mapped to the PromotionCodeManage
URL.
If the command is executed as a URL Command the following url parameters must be set
,
) A
for adding the promotion code to Order
R
for removing promotion code from Order.)Optionally the following url parameters can be set
Note: If both URL & VIEW parameters are specified, the request will be redirected to URL.
If both are not specified the request will be forwarded to CouponsDisplayView
.
If executing this Command as a task Command, the methods listed below must be invoked before calling the command
Optionally the following methods can be invoked
defaultCommandClassName, NAME
Constructor and Description |
---|
PromotionCodeAddRemoveControllerCmdImpl()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addPromoCodeToOrder()
Adds a promotion code to the current order
|
java.lang.Long |
getOrderId()
This method gets the order ID for which the promotion code should be added or removed.
|
java.util.Vector |
getPromotionCodes()
This method gets the promotion codes.
|
AccessVector |
getResources()
Gets the resources associated with the command.
|
java.lang.String |
getTaskType()
This method gets the task type.
|
java.lang.String |
getURL()
This method gets the redirect URL
|
java.lang.String |
getUserIdentifier()
This method gets the user identifier.
|
java.lang.String |
getViewName()
This methods returns the view name.
|
void |
performExecute()
Command execution body for performing different tasks depending upon the task
type.
|
void |
removePromoCodeFromOrder()
Removes a promotion code from the current order.
|
void |
setOrderId(java.lang.Long aOrderId)
This method sets the order ID for which the promotion code should be added or removed.
|
void |
setPromotionCodes(java.util.Vector aPromotionCodes)
This method sets the promotion codes.
|
void |
setRequestProperties(TypedProperty aReqProperties)
This method sets the request properties of the controller command.
|
void |
setTaskType(java.lang.String aTaskType)
This method sets the task type.
|
void |
setURL(java.lang.String aUrl)
This method sets the redirect URL.
|
void |
setUserIdentifier(java.lang.String aUserIdentifier)
This method sets the user identifier.
|
void |
setViewName(java.lang.String aViewName)
This method sets the view name.
|
void |
validateParameters()
Parameters validation to make sure they are set.
|
boolean |
validatePromotionCode(java.lang.String pCode)
This method checks if the Promotion Code is valid.
|
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputProperties
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
fulfills, getOwner
public PromotionCodeAddRemoveControllerCmdImpl()
public void setUserIdentifier(java.lang.String aUserIdentifier)
aUserIdentifier
- the user identifier to set.public void setURL(java.lang.String aUrl)
aUrl
- the redirect URL to set.public void setTaskType(java.lang.String aTaskType)
A
for adding
promotion code to order or R
for removing promotion code from order.aTaskType
- the task type of A(adding) or R(removing) of promotion code from order.public void setOrderId(java.lang.Long aOrderId)
aOrderId
- the order ID to set.public void setPromotionCodes(java.util.Vector aPromotionCodes)
aPromotionCodes
- the promotion codes to set.public void setViewName(java.lang.String aViewName)
aViewName
- the view name to set.public java.lang.String getViewName()
public java.lang.String getUserIdentifier()
public java.lang.String getURL()
public java.lang.String getTaskType()
A
for adding
promotion code to order or R
for removing promotion code from order.public java.lang.Long getOrderId()
public java.util.Vector getPromotionCodes()
public void setRequestProperties(TypedProperty aReqProperties) throws ECException
setRequestProperties
in interface ControllerCommand
setRequestProperties
in class ControllerCommandImpl
aReqProperties
- The request properties to set.ECException
- When an error is encountered on setting the request properties of the command.ControllerCommand.setRequestProperties(com.ibm.commerce.datatype.TypedProperty)
public void validateParameters() throws ECException
validateParameters
in interface ECCommand
validateParameters
in class AbstractECTargetableCommand
ECException
- is a general exception when such operation failspublic void removePromoCodeFromOrder() throws ECException
ECException
- when such operation failspublic void addPromoCodeToOrder() throws ECApplicationException
ECApplicationException
- when an error is encountered on adding a promotion code to the current order.public boolean validatePromotionCode(java.lang.String pCode) throws ECApplicationException
pCode
- java.lang.String is the promotion code.true
if promotion code is valid,
false
otherwiseECApplicationException
- when the validation fails.public void performExecute() throws ECSystemException, ECException
A
for
adding Coupon to order or R
for removing Coupon from order.performExecute
in interface ECCommand
performExecute
in interface com.ibm.websphere.command.TargetableCommand
performExecute
in class AbstractECTargetableCommand
ECSystemException
- a system exception when such operation fails.ECException
- a general exception when such operation fails.public AccessVector getResources()
getResources
in interface ECCommand
getResources
in class AbstractECTargetableCommand