com.ibm.commerce.interestitems.commands
Class InterestItemAddCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.interestitems.commands.InterestItemAddCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, InterestItemAddCmd, Protectable

public class InterestItemAddCmdImpl
extends ControllerCommandImpl
implements InterestItemAddCmd

The InterestItemAdd command adds one or more products to one or more shopper's interest item lists.


Field Summary
static java.lang.String CLASSNAME
          The fully qualified name of this class.
static java.lang.String COPYRIGHT
          The internal copyright field.
 
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.interestitems.commands.InterestItemAddCmd
defaultCommandClassName, NAME
 
Constructor Summary
InterestItemAddCmdImpl()
          No value constructor.
 
Method Summary
 void checkIsAllowed(AccessVector resource, java.lang.String action)
          Check to see if user can perform action on resource.
protected  void checkProductEntitlement(java.lang.Long catentry_id, java.lang.Long member_id)
          Ensures that the given member is entitled to access the given catlog entry based on the user's trading agreements.
 TypedProperty getResolvedRequestProperties()
          Gets the resolved request properties associated with this command.
 java.lang.Long[] getResourceOwners()
          Returns all the organization unit that owns the resources accessed by this command.It will return null if no resource is being accessed by this command.
 boolean isReadyToCallExecute()
          isReadyToCallExecute method is called by the Targettable Command frame work before the execution of the command.
 void performExecute()
          Contains the actual business logic of the command It should be implemented by all the command writer.
 void reset()
          This method should be called after a command has been executed to reset its states variables.
 void setAttrName(java.util.Hashtable ahshAttrName)
          Set the attribute name parameters (optional).
 void setAttrValue(java.util.Hashtable ahshAttrValue)
          Set the attribute value parameters (optional).
 void setCatEntryId(java.util.Hashtable ahshCatEntryId)
          Set the catentry id parameters.
 void setField1(java.util.Hashtable ahshField1)
          Set the field1 parameters (optional).
 void setField2(java.util.Hashtable ahshField2)
          Set the field2 parameters (optional).
 void setField3(java.util.Hashtable ahshField3)
          Set the field3 parameters (optional).
 void setListId(java.lang.String[] asaListId)
          Specifies zero or more interest item lists from which to be added.
 void setListIdName(java.lang.String[] asaListIdName)
          Specifies the names of name-value pairs to be added to the redirection URL.
 void setMemberId(java.util.Hashtable ahshMemberId)
          Set the member id parameters.
 void setPartNumber(java.util.Hashtable ahshPartNumber)
          Set the part number parameters.
 void setQuantity(java.util.Hashtable ahshQuantity)
          The quantity of the item to add.
 void setRequestProperties(TypedProperty aRequestProperties)
          The WebController calls this method before invoking the execute method in this command to set the request properties for this command.
 void setUOM(java.util.Hashtable ahshUOM)
          Set the unit of measure parameters (optional).
 void setUpdateable(java.util.Hashtable ahshUpdateable)
          updateable={ 1 | 0 } If updateable=1: Add a new record.
protected  double updateQuantity(double newQuantity, double oldQuantity)
          Returns the newly calculated quantity.
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME
The fully qualified name of this class.

COPYRIGHT

public static final java.lang.String COPYRIGHT
The internal copyright field.
Constructor Detail

InterestItemAddCmdImpl

public InterestItemAddCmdImpl()
No value constructor.
Method Detail

checkIsAllowed

public void checkIsAllowed(AccessVector resource,
                           java.lang.String action)
                    throws ECException
Check to see if user can perform action on resource. This is called by the command to perform resource level access control check in addition to the reources returned by the getResources() method.

Parameters:
resource - AccessVector - the resource to be acted on
action - String - action to be performed on the resource
Throws:
ECException -  

checkProductEntitlement

protected void checkProductEntitlement(java.lang.Long catentry_id,
                                       java.lang.Long member_id)
                                throws ECException,
                                       javax.ejb.FinderException,
                                       javax.ejb.CreateException,
                                       javax.naming.NamingException,
                                       java.rmi.RemoteException
Ensures that the given member is entitled to access the given catlog entry based on the user's trading agreements.

Parameters:
catentry_id - java.lang.Long
member_id - java.lang.Long

getResolvedRequestProperties

public TypedProperty getResolvedRequestProperties()
Description copied from interface: ControllerCommand
Gets the resolved request properties associated with this command. This method is called after a controller command has been executed successfully. It return a a hashtable of name value pairs of interpreted request properties. This method needs to be implemented for all commands that accepts wild card parameter values and where user traffic data monitoring is desired. The command will return only the properties with expanded parameter values.
Specified by:
getResolvedRequestProperties in interface ControllerCommand
Overrides:
getResolvedRequestProperties in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Returns:
com.ibm.commerce.datatype.TypeProperty

getResourceOwners

public java.lang.Long[] getResourceOwners()
                                   throws ECException
Description copied from interface: AccCommand
Returns all the organization unit that owns the resources accessed by this command.It will return null if no resource is being accessed by this command. This method was used in previous version for command level access control check. It is no longer required. It is kept for backward compatibility. The default implementation returns null.

Specified by:
getResourceOwners in interface AccCommand
Overrides:
getResourceOwners in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.AccCommand
Returns:
Long[] - an array of all organization unit reference numbers a site owner is representated by an organization unit value of -1

isReadyToCallExecute

public boolean isReadyToCallExecute()
Description copied from class: AbstractECTargetableCommand
isReadyToCallExecute method is called by the Targettable Command frame work before the execution of the command. The default implementation is to return true.

Overrides:
isReadyToCallExecute in class AbstractECTargetableCommand
Following copied from class: com.ibm.commerce.command.AbstractECTargetableCommand
Returns:
boolean - true if we can execute the command false if we canot execute the command

performExecute

public void performExecute()
                    throws ECException
Description copied from interface: ECCommand
Contains the actual business logic of the command It should be implemented by all the command writer.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

reset

public void reset()
Description copied from class: AbstractECTargetableCommand
This method should be called after a command has been executed to reset its states variables. After the call to reset, we should be able to execute the command again.
Overrides:
reset in class AbstractECTargetableCommand

setAttrName

public void setAttrName(java.util.Hashtable ahshAttrName)
Description copied from interface: InterestItemAddCmd
Set the attribute name parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
Specified by:
setAttrName in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshAttrName - java.util.Hashtable

setAttrValue

public void setAttrValue(java.util.Hashtable ahshAttrValue)
Description copied from interface: InterestItemAddCmd
Set the attribute value parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
Specified by:
setAttrValue in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshAttrValue - java.util.Hashtable

setCatEntryId

public void setCatEntryId(java.util.Hashtable ahshCatEntryId)
Description copied from interface: InterestItemAddCmd
Set the catentry id parameters.
Specified by:
setCatEntryId in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshCatEntryId - java.util.Hashtable

setField1

public void setField1(java.util.Hashtable ahshField1)
Description copied from interface: InterestItemAddCmd
Set the field1 parameters (optional).
Specified by:
setField1 in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshField1 - java.util.Hashtable

setField2

public void setField2(java.util.Hashtable ahshField2)
Description copied from interface: InterestItemAddCmd
Set the field2 parameters (optional).
Specified by:
setField2 in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshField2 - java.util.Hashtable

setField3

public void setField3(java.util.Hashtable ahshField3)
Description copied from interface: InterestItemAddCmd
Set the field3 parameters (optional).
Specified by:
setField3 in interface InterestItemAddCmd
Following copied from interface: com.ibm.commerce.interestitems.commands.InterestItemAddCmd
Parameters:
ahshField3 - java.util.Hashtable

setListId

public void setListId(java.lang.String[] asaListId)
Specifies zero or more interest item lists from which to be added. In addition to interest item list reference numbers it can be specified as one of the special abbreviations ".", "*". If "." is specified, the GetCurrentIILists process task is invoked to obtain the shopper's current interest item lists, and the command behaves as if the current interest item lists were specified. If GetCurrentIILists process task determines that there are no current interest item lists, the most recently updated item interest item list is used. If there is no interest item list at all, a new interest item list will be created. If "*" is specified, the command behaves as if all shopper's interest item lists were specified. If a specified interest item list no longer exists, it is not added. If this parameter is missing, this command behaves as if "." were specified.
Specified by:
setListId in interface InterestItemAddCmd
Parameters:
asaListId - the ListId

setListIdName

public void setListIdName(java.lang.String[] asaListIdName)
Specifies the names of name-value pairs to be added to the redirection URL. The values of the added name-value pairs are the reference numbers of the interest item lists specified by ListId. This is provided to make it possible to obtain the reference numbers of the interest item lists when ListId is not explicitly specified.
Specified by:
setListIdName in interface InterestItemAddCmd
Parameters:
asaListIdName - the array of names

setMemberId

public void setMemberId(java.util.Hashtable ahshMemberId)
Set the member id parameters. MemberId + PartNumber can be supplied in place of a CatentryId
Specified by:
setMemberId in interface InterestItemAddCmd
Parameters:
ahshMemberId - java.util.Hashtable

setPartNumber

public void setPartNumber(java.util.Hashtable ahshPartNumber)
Set the part number parameters. MemberId + PartNumber can be supplied in place of a CatentryId
Specified by:
setPartNumber in interface InterestItemAddCmd
Parameters:
ahshPartNumber - java.util.Hashtable

setQuantity

public void setQuantity(java.util.Hashtable ahshQuantity)
The quantity of the item to add.
Specified by:
setQuantity in interface InterestItemAddCmd
Parameters:
adQuantity - the quantity of the item

setRequestProperties

public void setRequestProperties(TypedProperty aRequestProperties)
                          throws ECApplicationException
Description copied from interface: ControllerCommand
The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

setUOM

public void setUOM(java.util.Hashtable ahshUOM)
Description copied from interface: InterestItemAddCmd
Set the unit of measure parameters (optional). Used with quantity to calculate the normalized quantity
Specified by:
setUOM in interface InterestItemAddCmd
Parameters:
astrUOM - the UOM, used with quantity to calculate the normalized quantity

setUpdateable

public void setUpdateable(java.util.Hashtable ahshUpdateable)
updateable={ 1 | 0 } If updateable=1: Add a new record. Update the record if already exists. updateable=0: Add a new record. Throw an exception if the record already exists. updateable is not specified: Default to 1(Update)
Specified by:
setUpdateable in interface InterestItemAddCmd
Parameters:
anUpdatable - the updatable flag

updateQuantity

protected double updateQuantity(double newQuantity,
                                double oldQuantity)
Returns the newly calculated quantity. Adds the newQuantity to the oldQuantity.
Parameters:
newQuantity - double
oldQuantity - double
Returns:
double

validateParameters

public void validateParameters()
                        throws ECException
Description copied from interface: ECCommand
Performs server side parameter checking. This method replaces the checkParameters() method in a previous version of the code.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -