com.ibm.commerce.collaboration.livehelp.commands
Class RetrieveShoppingCartCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.collaboration.livehelp.commands.RetrieveShoppingCartCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, RetrieveShoppingCartCmd

public class RetrieveShoppingCartCmdImpl
extends ControllerCommandImpl
implements RetrieveShoppingCartCmd

Retrieves a shoppers profile for the Customer Care (sametime) tooling in Commerce Accelerator Behaviour The command does the following: 1. Verifies that the user requesting the action is a Customer Service Representative (CSR), Customer Service Supervisor (CSS), Seller, or a Site Administrator role in the seller organization. Otherwise, the requester does not have the authority to execute this command. 2. Creates an instance of UserRegistrationDataBean. 3. Creates an instance of UserAccessBean. 4. Creates an instance of OrderAccessBean. 5. Uses the OrderAccessBean to populate the Vector vOrder with any pending orders. 6. Checks if the user is registered. 7. If the user is registered, puts the logonName in the responseProperties as "Title" . 8. If the user is NOT registered, puts the userId in the responseProperties as "Title". 9. puts OrderItems Vector in the responseProperties as "ShoppingCart". 10. Sets the viewtask to LiveHelpShoppingCartView in responseProperties Exception Conditions If any parameters are missing, the command sets the _ERR_MISSING_PARMS exception task to handle the error.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASSNAME
          Class name
static java.lang.String COPYRIGHT
          IBM copyright info
static java.lang.String ERRTASK_NAME
          Error task name
 
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.collaboration.livehelp.commands. RetrieveShoppingCartCmd
defaultCommandClassName, NAME
 
Constructor Summary
RetrieveShoppingCartCmdImpl()
           
 
Method Summary
  AccessVector getResources()
          Gets the access vector accessed by this command.
 boolean isGeneric()
          This controller command can not be called by a generic user.
 boolean isReadyToCallExecute()
          Always true.
 void performExecute()
          This method will retrieve the shopping cart information and put into responseProperties 1.
protected  java.lang.String safeString(java.lang.String riskyString)
          Utility function to check if a string is safe to use.
 void validateParameters()
          Checks for the required parameters validated parameters are: userId user Id (required) storeId store Id (required)
 
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setRequestProperties, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, 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
 
Methods inherited from interface com.ibm.commerce.command. ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command. AccCommand
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command. ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright info
See Also:
Constant Field Values

CLASSNAME

public static final java.lang.String CLASSNAME
Class name
See Also:
Constant Field Values

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Error task name
See Also:
Constant Field Values
Constructor Detail

RetrieveShoppingCartCmdImpl

public RetrieveShoppingCartCmdImpl()
Method Detail

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command. The default implementation returns null indicating that no protectable resource is accessed by this command. It is the responsibilities of the command writer to return the protectable primary resource(s) and the corresponding actions accessed by this command.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
AccessVector a vector of resource action pairs
Throws:
ECException - System error

isGeneric

public boolean isGeneric()
This controller command can not be called by a generic user.
Specified by:
isGeneric in interface ControllerCommand
Overrides:
isGeneric in class ControllerCommandImpl
Returns:
boolean

isReadyToCallExecute

public boolean isReadyToCallExecute()
Always true.
Overrides:
isReadyToCallExecute in class AbstractECTargetableCommand
Returns:
boolean

performExecute

public void performExecute()
                    throws ECException
This method will retrieve the shopping cart information and put into responseProperties 1. Creates an instance of UserRegistrationDataBean. 2. Creates an instance of UserAccessBean. 3. Creates an instance of OrderAccessBean. 4. Uses the OrderAccessBean to populate the Vector vOrder with any pending orders. 5. Checks if the user is registered. 6. If the user is registered, puts the logonName in the responseProperties as "Title" . 7. If the user is NOT registered, puts the userId in the responseProperties as "Title". 8. puts OrderItems Vector in the responseProperties as "ShoppingCart". 9. Sets the viewtask to LiveHelpShoppingCartView in responseProperties
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECSystemException - Raised with message key : ECMessage._ERR_CREATE_EXCEPTION or ECMessage._ERR_FINDER_EXCEPTION or ECMessage._ERR_FINDER_EXCEPTION or ECMessage._ERR_NAMING_EXCEPTION or ECMessage._ERR_REMOTE_EXCEPTION or ECMessage._ERR_REMOVE_EXCEPTION if anything goes wrong with the data resources being queried.
ECException

safeString

protected java.lang.String safeString(java.lang.String riskyString)
Utility function to check if a string is safe to use.
Parameters:
riskyString - A string that could be null, or contain leading or trailing spaces.
Returns:
A safe string, trimmed, and set to "" if the input was null.

validateParameters

public void validateParameters()
                        throws ECException
Checks for the required parameters validated parameters are: userId user Id (required) storeId store Id (required)
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECApplicationException - Raised with message key ECMessage._ERR_MISSING_PARMS if fails the validation,
ECException