com.ibm.commerce.couponredemption.commands
Class CheckApplicabilityCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.couponredemption.commands.CheckApplicabilityCmdImpl
All Implemented Interfaces:
CheckApplicabilityCmd, ECCommand, TaskCommand

public class CheckApplicabilityCmdImpl
extends TaskCommandImpl
implements CheckApplicabilityCmd

The purpose of this command is to check for aplicability of the coupons i.e., the purchase order condition is satisfied and the information is put in applicable variable which is used by the calling command.

The input to this command are:

First the order amount is calculated. Then the cppmnId is found out by using corresponding cpwalletId for that eCoupon. If the purchase order condition type for an eCoupon promotion is of product type, then the required products and their minumum quantities are found out from cppmnprod table. If all the required products are present in the order with the required quantities, then the applicable eCoupons are found out.If the purchase order condition type for an eCoupon promotion is of type order, then the required amount for that order is found from cppmnord table and the currency from cppmn table. If the order amount satisfies the boundary conditions, then the eCoupon is applicable. These above steps are performed for each cpwalletId.


Field Summary
protected  java.util.Vector[] applicableItems
           
protected  java.lang.Long[] bcIds
           
protected  java.sql.Timestamp currentTimeStamp
           
protected  TypedProperty inParam
           
protected  java.lang.Long orderId
           
protected  TypedProperty outParam
           
protected  CommandContext processingContext
           
protected  TypedProperty reqParam
           
protected  boolean[] validCoupons
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.couponredemption.commands.CheckApplicabilityCmd
COPYRIGHT, defaultCommandClassName, Name
 
Constructor Summary
CheckApplicabilityCmdImpl()
          CheckValidityCmdImpl constructor call super.
 
Method Summary
 java.math.BigDecimal calculateTotalOrderAmt(java.util.Vector vecoiAB, StoreAccessBean sAB, CurrencyManager cm, java.lang.String curCurrency)
          It calculate the total order amount.
 boolean checkParentCatEntryIds(java.lang.Long oiCatEntryId, java.lang.Long walletCatEntryId)
          Check the parent catalog entry.
 java.util.Vector[] getApplicableItems()
          Get applicable items.
 java.lang.Long[] getBcIds()
          Get the eCoupon ids.
 java.sql.Timestamp getCurrentTimeStamp()
          Get current time from system.
 java.lang.Long getOrderId()
          Get order ids.
 CommandContext getProcessingContext()
          It get the processing context.
 TypedProperty getRequestProperties()
          Get the request properties.
 TypedProperty getResponseProperties()
          Get the response properties.
 boolean[] getValidCoupons()
          Get valid coupons.
 void performExecute()
          The purpose of this command is to check for aplicability of the coupons i.e., the purchase order condition is satisfied and the information is put in applicable variable which is used by the calling command.
 void setApplicableItems(java.util.Vector[] newApplicableItems)
          Set the applicable items.
 void setBcIds(java.lang.Long[] newBcIds)
          Set eCoupon ids.
 void setCurrentTimeStamp(java.sql.Timestamp newCurrentTimeStamp)
          Set the current time from system.
 void setOrderId(java.lang.Long newOrderId)
          Set the order ids.
 void setProcessingContext(CommandContext newProcessingContext)
          Set the processing context.
 void setRequestProperties(TypedProperty param)
          Set the request properties.
 void setValidCoupons(boolean[] newValidCoupons)
          Set valid eCoupons.
 void validateParameters()
          It check the parameters.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, 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.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Field Detail

applicableItems

protected java.util.Vector[] applicableItems

bcIds

protected java.lang.Long[] bcIds

currentTimeStamp

protected java.sql.Timestamp currentTimeStamp

inParam

protected TypedProperty inParam

orderId

protected java.lang.Long orderId

outParam

protected TypedProperty outParam

processingContext

protected CommandContext processingContext

reqParam

protected TypedProperty reqParam

validCoupons

protected boolean[] validCoupons
Constructor Detail

CheckApplicabilityCmdImpl

public CheckApplicabilityCmdImpl()
CheckValidityCmdImpl constructor call super.
Method Detail

calculateTotalOrderAmt

public java.math.BigDecimal calculateTotalOrderAmt(java.util.Vector vecoiAB,
                                                   StoreAccessBean sAB,
                                                   CurrencyManager cm,
                                                   java.lang.String curCurrency)
                                            throws ECSystemException,
                                                   javax.naming.NamingException,
                                                   java.rmi.RemoteException,
                                                   javax.ejb.CreateException,
                                                   javax.ejb.FinderException
It calculate the total order amount.
Returns:
java.math.BigDecimal

checkParentCatEntryIds

public boolean checkParentCatEntryIds(java.lang.Long oiCatEntryId,
                                      java.lang.Long walletCatEntryId)
                               throws ECSystemException
Check the parent catalog entry.
Returns:
java.util.Enumeration

getApplicableItems

public java.util.Vector[] getApplicableItems()
Get applicable items.
Specified by:
getApplicableItems in interface CheckApplicabilityCmd
Returns:
java.util.Vector

getBcIds

public java.lang.Long[] getBcIds()
Get the eCoupon ids.
Returns:
java.lang.Long

getCurrentTimeStamp

public java.sql.Timestamp getCurrentTimeStamp()
Get current time from system.
Returns:
java.sql.Timestamp

getOrderId

public java.lang.Long getOrderId()
Get order ids.
Returns:
java.lang.Integer

getProcessingContext

public CommandContext getProcessingContext()
It get the processing context.
Returns:
com.ibm.commerce.command.CommandContext

getRequestProperties

public TypedProperty getRequestProperties()
Get the request properties.
Returns:
com.ibm.commerce.datatype.TypedProperty

getResponseProperties

public TypedProperty getResponseProperties()
Get the response properties.
Specified by:
getResponseProperties in interface CheckApplicabilityCmd
Returns:
com.ibm.commerce.datatype.TypedProperty

getValidCoupons

public boolean[] getValidCoupons()
Get valid coupons.
Specified by:
getValidCoupons in interface CheckApplicabilityCmd
Returns:
boolean[]

performExecute

public void performExecute()
                    throws ECException

The purpose of this command is to check for aplicability of the coupons i.e., the purchase order condition is satisfied and the information is put in applicable variable which is used by the calling command.
First the order amount is calculated. Then the cppmnId is found out by using corresponding cpwalletId for that eCoupon. If the purchase order condition type for an eCoupon promotion is of product type, then the required products and their minumum quantities are found out from cppmnprod table. If all the required products are present in the order with the required quantities, then the applicable eCoupons are found out.If the purchase order condition type for an eCoupon promotion is of type order, then the required amount for that order is found from cppmnord table and the currency from cppmn table. If the order amount satisfies the boundary conditions, then the eCoupon is applicable. These above steps are performed for each cpwalletId.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Throws:
: - ECException.

setApplicableItems

public void setApplicableItems(java.util.Vector[] newApplicableItems)
Set the applicable items.
Parameters:
newApplicableItems - java.util.Vector

setBcIds

public void setBcIds(java.lang.Long[] newBcIds)
Set eCoupon ids.
Specified by:
setBcIds in interface CheckApplicabilityCmd
Parameters:
newBcId - java.lang.Long

setCurrentTimeStamp

public void setCurrentTimeStamp(java.sql.Timestamp newCurrentTimeStamp)
Set the current time from system.
Parameters:
newCurrentTimeStamp - java.sql.Timestamp

setOrderId

public void setOrderId(java.lang.Long newOrderId)
Set the order ids.
Specified by:
setOrderId in interface CheckApplicabilityCmd
Parameters:
newOrderId - java.lang.Integer

setProcessingContext

public void setProcessingContext(CommandContext newProcessingContext)
Set the processing context.
Specified by:
setProcessingContext in interface CheckApplicabilityCmd
Parameters:
newProcessingContext - com.ibm.commerce.command.CommandContext

setRequestProperties

public void setRequestProperties(TypedProperty param)
Set the request properties.
Specified by:
setRequestProperties in interface CheckApplicabilityCmd
Parameters:
param - com.ibm.commerce.datatype.TypedProperty

setValidCoupons

public void setValidCoupons(boolean[] newValidCoupons)
Set valid eCoupons.
Parameters:
newValidCoupons - boolean[]

validateParameters

public void validateParameters()
                        throws ECException
It check the parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Throws:
ECException - The exception description.