java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.TaskCommandImpl | +--com.ibm.commerce.couponredemption.commands.CouponDSSTaskCmdImpl
This task command is called from the CouponDSSCmd
when user
selects a set of eCoupons to be used on a set of items in her order.
First the eCoupons with selection status whether SELECTED or not is checked
and it shouldn't have a common item in their itemlist where the itemlist is
obtained from the parameter itemFor<cpwalletIds> if specified or from
TempCouponItemMapAccessBean
otherwise. This is done for all non
order level coupons. Also only one order level eCoupon can be selected per
order.
If the above conditions are satisfied, the selected eCoupons are moved from
TempOrderCouponMapAccessBean
to
OrderCouponMapAccessBean
and the unselected eCoupons are to
deleted from TempOrderCouponMapAccessBean
. Also the selected items
are moved from TempCouponItemMapAccessBean
to
CouponItemMapAccessBean
.
Field Summary | |
---|---|
protected
java.util.Hashtable |
conflicts This hashtable stores the information about the conflict in the coupon selection. |
protected
java.lang.Long[] |
couponId The couponIds to be processed. |
protected
java.math.BigDecimal[] |
discAmt The nth element is the total discount amount due to the nth coupon. |
protected
java.util.Vector[] |
itemList The nth element is the vector containing the items on which the nth coupon is being applied. |
protected
int |
numCoupons The the number of coupons to be processed. |
protected
java.lang.Long |
orderId The order on which the coupons are to be applied. |
protected
CommandContext |
processingContext The command context holder |
protected
TypedProperty |
reqProp The request properties. |
protected
TypedProperty |
rspProp The response properties. |
protected
boolean |
validSelection True if coupons selected can be used together. |
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
commandContext |
Fields inherited from interface com.ibm.commerce.couponredemption.commands. CouponDSSTaskCmd |
COPYRIGHT,
defaultCommandClassName,
Name |
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand |
COPYRIGHT |
Fields inherited from interface com.ibm.commerce.command. ECCommand |
defaultCommandClassName |
Constructor Summary | |
---|---|
CouponDSSTaskCmdImpl() CouponDSSCmdImpl constructor, call super. |
Method Summary | |
---|---|
void |
computeItemAndDiscount() Finds the items and discount on those corresponding to each cpwalletId. |
java.util.Hashtable |
getConflicts() Returns the conflict hashtable. |
java.lang.Long[] |
getCouponId() Gets the coupon IDs. |
java.util.Hashtable |
getItemsSelected() Gets the items that were selected for the coupons to be applied on. |
int |
getNumCoupons() Gets the number of coupons. |
java.lang.Long |
getOrderId() Gets the order ID. |
TypedProperty |
getReqProp() Gets the request properties. |
TypedProperty |
getRspProp() Gets the response properties. |
java.util.Vector |
getUnQualifiedCoupons() Gets the IDs of the unqualified coupons. |
boolean |
isReadyToCallExecute() It always returns true. |
boolean |
isValidSelection() Returns whether the selection is valid or not. |
void |
performExecute() First the eCoupons with selection status whether SELECTED or not is checked and it shouldn't have a common item in their itemlist where the itemlist is obtained from the parameter itemFor<cpwalletIds> if specified or from TempCouponItemMapAccessBean otherwise. |
protected
boolean |
qualifies(java.lang.Integer paramPromoId,
java.util.Vector paramItemList,
java.lang.String paramPurchaseCondType) This method tests whether the coupon of a given promotion can be applied on the given set of items for the purchase condition type. |
void |
setConflicts(java.util.Hashtable newConflicts) Sets the conflict variable. |
void |
setCouponId(java.lang.Long[] newCouponId) Sets the ecoupon IDs. |
void |
setItemsSelected(java.util.Hashtable newItemsSelected) Sets the items that were selected for the coupons to be applied on. |
void |
setNumCoupons(int newNumCoupons) Sets the number of coupons. |
void |
setOrderId(java.lang.Long newOrderId) Sets the order ID. |
void |
setValidSelection(boolean newValidSelection) Sets valid selection. |
void |
transferFromTemp() Transfer the entries from TempOrderCouponMapAccessBean
and TempCouponItemMapAccessBean to the
OrderCouponMapAcessBean and
CouponItemMapAcessBean . |
void |
validateParameters() Checks the parameters. |
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
accessControlCheck,
checkIsAllowed,
checkParameters,
checkResourcePermission,
createCommandExecutionEvent,
execute,
finalize,
getAccCheck,
getCommandContext,
getCommandIfName,
getCommandName,
getCommandStoreId,
getDefaultProperties,
getResources,
getStoreId,
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 |
Field Detail |
---|
protected java.lang.Long[] couponId
protected java.util.Vector[] itemList
protected int numCoupons
protected java.lang.Long orderId
protected java.math.BigDecimal[] discAmt
protected java.util.Hashtable conflicts
protected CommandContext processingContext
protected TypedProperty reqProp
protected TypedProperty rspProp
protected boolean validSelection
Constructor Detail |
---|
public CouponDSSTaskCmdImpl()
Method Detail |
---|
public void computeItemAndDiscount() throws ECSystemException
ECSystemException
public java.util.Hashtable getConflicts()
getConflicts
in interface
CouponDSSTaskCmd
public java.lang.Long[] getCouponId()
public java.util.Hashtable getItemsSelected()
public int getNumCoupons()
getNumCoupons
in interface
CouponDSSTaskCmd
public java.lang.Long getOrderId()
public TypedProperty getReqProp()
public TypedProperty getRspProp()
public java.util.Vector getUnQualifiedCoupons()
getUnQualifiedCoupons
in interface
CouponDSSTaskCmd
public boolean isReadyToCallExecute()
isReadyToCallExecute
in class
AbstractECTargetableCommand
public boolean isValidSelection()
isValidSelection
in interface
CouponDSSTaskCmd
public void performExecute() throws ECException
First the eCoupons with selection status whether SELECTED or not is checked
and it shouldn't have a common item in their itemlist where the itemlist is
obtained from the parameter itemFor<cpwalletIds> if specified or from
TempCouponItemMapAccessBean
otherwise. This is done for all non
order level coupons. Also only one order level eCoupon can be selected per
order.
If the above conditions are satisfied, the selected eCoupons are moved from
TempOrderCouponMapAccessBean
to
OrderCouponMapAccessBean
and the unselected eCoupons are to
deleted from TempOrderCouponMapAccessBean
. Also the selected items
are moved from TempCouponItemMapAccessBean
to
CouponItemMapAccessBean
.
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
ECException
protected boolean qualifies(java.lang.Integer paramPromoId, java.util.Vector paramItemList, java.lang.String paramPurchaseCondType) throws ECSystemException
paramPromoId
- The promotion ID of the coupon being attempted
to be applied.paramItemList
- The items on which the coupon is being
applied.paramPurchaseCondType
- the purchase condition type for this
promotion.
ECSystemException
public void setConflicts(java.util.Hashtable newConflicts)
newConflicts
- the hashtable containing conflict
information.public void setCouponId(java.lang.Long[] newCouponId)
setCouponId
in interface
CouponDSSTaskCmd
newCouponId
- the coupon IDs.public void setItemsSelected(java.util.Hashtable newItemsSelected)
setItemsSelected
in interface
CouponDSSTaskCmd
newItemsSelected
- hashtable of items being used for
coupons.public void setNumCoupons(int newNumCoupons)
newNumCoupons
- the number of coupons.public void setOrderId(java.lang.Long newOrderId)
setOrderId
in interface
CouponDSSTaskCmd
newOrderId
- the order ID.public void setValidSelection(boolean newValidSelection)
newValidSelection
- true if the selection is
valid.public void transferFromTemp() throws ECSystemException
Transfer the entries from TempOrderCouponMapAccessBean
and
TempCouponItemMapAccessBean
to the
OrderCouponMapAcessBean
and
CouponItemMapAcessBean
.
:
- com.ibm.commerce.exception.ECException.
ECSystemException
public void validateParameters() throws ECException
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
ECException