com.ibm.commerce.couponredemption.commands
Class CheckValidityCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.couponredemption.commands.CheckValidityCmdImpl
All Implemented Interfaces:
CheckValidityCmd, ECCommand, ECTargetableCommand, TaskCommand

public class CheckValidityCmdImpl
extends TaskCommandImpl
implements CheckValidityCmd

The purpose of this command is to check each of the eCoupons for expiry and put the information in expired variable which is used by the calling commands.

For each cpwalletId the cppmnId is found out. Then the endDate is found out corresponding to this coupon promotion and if this endDate is after the current time, the coupon is not expired. These above steps are performed for each cpwalletId. This command uses CouponWalletAccessBean and CouponPromotionAccessBean.

See Also:
Serialized Form

Field Summary
protected  java.lang.Long[] bcIds
          The IDs of the coupons to be applied to this order
protected  java.sql.Timestamp currentTimeStamp
          The current system time.
protected  TypedProperty inParam
          The request properties.
protected  TypedProperty outParam
          The response properties.
protected  TypedProperty reqParam
          The request properties.
protected  boolean[] validCoupons
          The nth element denotes if the nth coupon is applicable.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.couponredemption.commands. CheckValidityCmd
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
CheckValidityCmdImpl()
          CheckValidityCmdImpl constructor, call super.
 
Method Summary
 java.lang.Long[] getBcIds()
          Gets the eCoupon IDs.
 java.sql.Timestamp getCurrentTimeStamp()
          Gets the current timestamp.
  TypedProperty getRequestProperties()
          Gets the request properties.
  TypedProperty getResponseProperties()
          Gets the response properties.
 boolean[] getValidCoupons()
          Gets the array indicating whether the Coupons are valid or not.
 void performExecute()
          For each cpwalletId the cppmnId is found out.
 void setBcIds(java.lang.Long[] newBcIds)
          Sets eCoupon IDs.
 void setCurrentTimeStamp(java.sql.Timestamp newCurrentTimeStamp)
          Sets current time.
 void setRequestProperties( TypedProperty param)
          Sets the request properties.
 void setValidCoupons(boolean[] newValidCoupons)
          Sets valid eCoupons.
 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, isReadyToCallExecute, 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

outParam

protected TypedProperty outParam
The response properties.

reqParam

protected TypedProperty reqParam
The request properties.

bcIds

protected java.lang.Long[] bcIds
The IDs of the coupons to be applied to this order

currentTimeStamp

protected java.sql.Timestamp currentTimeStamp
The current system time.

inParam

protected TypedProperty inParam
The request properties.

validCoupons

protected boolean[] validCoupons
The nth element denotes if the nth coupon is applicable.
Constructor Detail

CheckValidityCmdImpl

public CheckValidityCmdImpl()
CheckValidityCmdImpl constructor, call super.
Method Detail

getBcIds

public java.lang.Long[] getBcIds()
Gets the eCoupon IDs.
Returns:
the coupon IDs to be checked for validity.

getCurrentTimeStamp

public java.sql.Timestamp getCurrentTimeStamp()
Gets the current timestamp.
Returns:
the cuurent time.

getRequestProperties

public TypedProperty getRequestProperties()
Gets the request properties.
Returns:
the request properties.

getResponseProperties

public TypedProperty getResponseProperties()
Gets the response properties.
Specified by:
getResponseProperties in interface CheckValidityCmd
Returns:
the response properties.

getValidCoupons

public boolean[] getValidCoupons()
Gets the array indicating whether the Coupons are valid or not.
Specified by:
getValidCoupons in interface CheckValidityCmd
Returns:
array whose nth element indicates if the nth coupon is valid

performExecute

public void performExecute()
                    throws ECException

For each cpwalletId the cppmnId is found out. Then the endDate is found out corresponding to this coupon promotion and if this endDate is after the current time, the coupon is not expired. These above steps are performed for each cpwalletId.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
com.ibm.commerce.exception.ECException.
ECException

setBcIds

public void setBcIds(java.lang.Long[] newBcIds)
Sets eCoupon IDs.
Specified by:
setBcIds in interface CheckValidityCmd

setCurrentTimeStamp

public void setCurrentTimeStamp(java.sql.Timestamp newCurrentTimeStamp)
Sets current time.
Parameters:
newCurrentTimeStamp - the current timestamp.

setRequestProperties

public void setRequestProperties(TypedProperty param)
Sets the request properties.
Specified by:
setRequestProperties in interface CheckValidityCmd
Parameters:
param - the request properties.

setValidCoupons

public void setValidCoupons(boolean[] newValidCoupons)
Sets valid eCoupons.
Parameters:
newValidCoupons - array whose nth element indicates if the nth coupon is valid

validateParameters

public void validateParameters()
                        throws ECException
Checks the parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException