com.ibm.commerce.tools.optools.returns.commands
Class CSRReturnBaseCmdImpl

java.lang.Object
  CacheableCommandImpl
      com.ibm.commerce.command.AbstractECTargetableCommand
          com.ibm.commerce.command.ControllerCommandImpl
              com.ibm.commerce.tools.command.ToolsControllerCommandImpl
                  com.ibm.commerce.tools.optools.order.commands.CSRBaseControllerCommandImpl
                      com.ibm.commerce.tools.optools.returns.commands.CSRReturnBaseCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, ToolsControllerCommand
Direct Known Subclasses:
CSRReturnCancelCmdImpl, CSRReturnCreateCopyCmdImpl, CSRReturnItemAddCmdImpl, CSRReturnItemComponentUpdateCmdImpl, CSRReturnItemDeleteCmdImpl, CSRReturnItemUpdateCmdImpl, CSRReturnPrepareCmdImpl, CSRReturnProcessCmdImpl, CSRReturnRestoreCopyCmdImpl, CSRReturnUpdateCmdImpl

public abstract class CSRReturnBaseCmdImpl
extends CSRBaseControllerCommandImpl

Base class for all the CSR Returns commands.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
IBM copyright notice field.
protected java.lang.String customerId
static java.lang.String ERRTASK_NAME
Default redirect URL when errors are encountered.
protected CommandContext origCmdContext
protected TypedProperty origReqProperties
protected java.lang.String redirectURL
protected java.lang.String returnId
protected java.util.Hashtable returnResBun
protected java.util.Hashtable xmlRoot
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.tools.command.ToolsControllerCommand
NAME
Fields inherited from interface com.ibm.commerce.command.ECCommand
defaultCommandClassName
Constructor Summary
CSRReturnBaseCmdImpl()
Constructor for CSRReturnBaseCmdImpl.
Method Summary
protected TypedProperty exceptionUtil(TypedProperty prop, java.lang.Exception ex, java.lang.String methodName, java.lang.String cmdName)
Utility for performing common tasks prior to throwing exception.
java.lang.String getCustomerId()
Gets customer identifier which is used to set the forUserId parameter in the request property when calling a command.
java.util.Hashtable getNLS()
Gets reference to property file used for Returns user interface.
CommandContext getOrigCmdContext()
Gets command context as it was at the start of command run.
TypedProperty getOrigReqProperties()
Gets request property as it was at the start of command run.
java.lang.String getRedirectURL()
Gets redirect url.
AccessVector getResources()
Gets the access vector used by command.
java.lang.String getReturnId()
Gets the unique identifier of the Return being processed.
protected abstract void parseInputXMLObject(java.util.Hashtable xmlRoot)
Parses and retrieves the command's input parameters.
void setCustomerId(java.lang.String newCustomerId)
Sets the unique identifier of the customer whom owns the Return being processed.
protected void setNLS(java.util.Hashtable newNLS)
Sets the reference to the contents of the property file.
void setOrigCmdContext(CommandContext newOrigCmdContext)
Saves a copy of the command context at the start of command run.
void setOrigReqProperties(TypedProperty newOrigReqProperties)
Saves a copy of the request properties at the start of command run.
void setRedirectURL(java.lang.String newRedirectURL)
Sets the redirect URL.
void setReturnId(java.lang.String newReturnId)
Sets unique identifier of the Return being processed.
java.lang.String traceFormat(TypedProperty prop)
Formats a trace message.
void validateParameters()
Prepares command enviroment.
Methods inherited from class com.ibm.commerce.tools.optools.order.commands.CSRBaseControllerCommandImpl
callPreCommands, findCmdInterfaceName, getIfExePreCmdChains, getPreCmdChain, setIfExePreCmdChains, setPreCmdChain
Methods inherited from class com.ibm.commerce.tools.command.ToolsControllerCommandImpl
getViewInputProperties, setRequestProperties
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, 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, isReadyToCallExecute, performExecute, 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, isGeneric, isRetriable, mergeProperties, setGeneric, 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, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
Field Detail

COPYRIGHT

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

origCmdContext

protected CommandContext origCmdContext

origReqProperties

protected TypedProperty origReqProperties

returnId

protected java.lang.String returnId

customerId

protected java.lang.String customerId

redirectURL

protected java.lang.String redirectURL

xmlRoot

protected java.util.Hashtable xmlRoot

returnResBun

protected java.util.Hashtable returnResBun

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Default redirect URL when errors are encountered.
See Also:
Constant Field Values
Constructor Detail

CSRReturnBaseCmdImpl

public CSRReturnBaseCmdImpl()
Constructor for CSRReturnBaseCmdImpl.
Method Detail

exceptionUtil

protected TypedProperty exceptionUtil(TypedProperty prop,
                                      java.lang.Exception ex,
                                      java.lang.String methodName,
                                      java.lang.String cmdName)
Utility for performing common tasks prior to throwing exception. Adds view task name and name of originating command to specified typed property. Prints stack trace of the exception. Unsets forUserId in the request properties.
Parameters:
prop - existing typed properties object to which to add properties
ex - exception about to be thrown
methodName - name of method in which exception occurred
cmdName - name of command in which exception occurred

getCustomerId

public java.lang.String getCustomerId()
Gets customer identifier which is used to set the forUserId parameter in the request property when calling a command.
Returns:
customer identifier

getNLS

public java.util.Hashtable getNLS()
Gets reference to property file used for Returns user interface.
Returns:
reference to the contents of the property file

getOrigCmdContext

public CommandContext getOrigCmdContext()
Gets command context as it was at the start of command run.
Returns:
original command context

getOrigReqProperties

public TypedProperty getOrigReqProperties()
Gets request property as it was at the start of command run.
Returns:
original request properties

getRedirectURL

public java.lang.String getRedirectURL()
Gets redirect url. The redirect URL is passed in as a parameter to all the CSR Returns commands..
Returns:
redirect URL

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector used by command. The default implementation returns null indicating that no protectable resources are accessed by this command.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
vector of resource action pairs
Throws:
ECException
See Also:
AccessVector

getReturnId

public java.lang.String getReturnId()
Gets the unique identifier of the Return being processed.
Returns:
return identifier

parseInputXMLObject

protected abstract void parseInputXMLObject(java.util.Hashtable xmlRoot)
                                     throws ECApplicationException
Parses and retrieves the command's input parameters.
Parameters:
xmlRoot - xml stream represented in a java hashtable
Throws:
ECApplicationException

setCustomerId

public void setCustomerId(java.lang.String newCustomerId)
Sets the unique identifier of the customer whom owns the Return being processed.
Parameters:
newCustomerId - customer identifier

setNLS

protected void setNLS(java.util.Hashtable newNLS)
Sets the reference to the contents of the property file.
Parameters:
newNLS - national language messages to use

setOrigCmdContext

public void setOrigCmdContext(CommandContext newOrigCmdContext)
Saves a copy of the command context at the start of command run.
Parameters:
newOrigCmdContext - command context

setOrigReqProperties

public void setOrigReqProperties(TypedProperty newOrigReqProperties)
Saves a copy of the request properties at the start of command run.
Parameters:
newOrigReqProperties - request properties

setRedirectURL

public void setRedirectURL(java.lang.String newRedirectURL)
Sets the redirect URL.
Parameters:
newRedirectURL - URL to which to redirect when command terminates

setReturnId

public void setReturnId(java.lang.String newReturnId)
Sets unique identifier of the Return being processed.
Parameters:
newReturnId - Return identifier

traceFormat

public java.lang.String traceFormat(TypedProperty prop)
Formats a trace message. Converts to a string, and removes tabs and new lines markers.
Parameters:
prop - message to be formatted

validateParameters

public void validateParameters()
                        throws ECApplicationException
Prepares command enviroment. Gets first element from XML input and uses it to call parseInputXMLObject as implemented in descendent class. Sets reference to property file used for Returns user interface by looking up returns.ReturnsNLS for the current locale.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class CSRBaseControllerCommandImpl
Throws:
ECApplicationException

Feedback