com.ibm.commerce.command
Class AbstractECTargetableCommand

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
Direct Known Subclasses:
ControllerCommandImpl, DataBeanCommandImpl, TaskCommandImpl

public abstract class AbstractECTargetableCommand
extends CacheableCommandImpl

This is the abstract base class for all commerce ECTargetableCommands

See Also:
Serialized Form

Field Summary
protected  CommandContext commandContext
           
 
Constructor Summary
AbstractECTargetableCommand()
          AbstractECTargetableCommand constructor.
 
Method Summary
 boolean accessControlCheck()
          Performs command level access control check.
 void checkIsAllowed(java.lang.Object resource, java.lang.String action)
          Check to see if user can perform action on resource.
protected  void checkParameters()
          Deprecated. Replaced by validateParameters()
 void checkResourcePermission()
          Performs resource level access control check.
 void createCommandExecutionEvent(CommandExecutionTrigger trigger)
          Creates a command execution event.
 void execute()
          This method is part of the command framework for execution of a command.
 void finalize()
          Final cleans up of resources.
 boolean getAccCheck()
          Check to see if access control check is required for this command.
  CommandContext getCommandContext()
          Gets the command context associated with this command.
 java.lang.String getCommandIfName()
          Gets the command interface name.
 java.lang.String getCommandName()
          Gets the name of the originating command.
 java.lang.Integer getCommandStoreId()
          Gets the store Id used to create this command.
 TypedProperty getDefaultProperties()
          Gets the default properties associated with this command.
 AccessVector getResources()
          Gets the access vector accessed by this command.
 java.lang.Integer getStoreId()
          Gets the store Id associated with this command from the command context.
 UserAccessBean getUser()
          Gets the userAccessBean associated with the user.
 java.lang.Long getUserId()
          Gets the user Id for the user associated with this command from the command context.
 boolean isReadyToCallExecute()
          This method is called by the Targettable Command frame work before the execution of the command.
 void performExecute()
          The business logic for this command.
 void reset()
          This method should be called after a command has been executed to reset its states variables.
 void setAccCheck(boolean newValue)
          This method is set by the web controller to indicate whether access control check is required for this command.
 void setCommandContext( CommandContext aCommandContext)
          Sets the command context associated with this command.
 void setCommandIfName(java.lang.String name)
          Sets the command interface name
 void setCommandStoreId(java.lang.Integer storeId)
          Sets the store Id associated with this command.
 void setDefaultProperties(com.ibm.commerce.datatype.TypedProperty val)
          Sets default properties associated with this ECCommand.
 void validateParameters()
          Performs parameter checking.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandContext

protected CommandContext commandContext
Constructor Detail

AbstractECTargetableCommand

public AbstractECTargetableCommand()
AbstractECTargetableCommand constructor.
Method Detail

accessControlCheck

public boolean accessControlCheck()
                           throws ECException
Performs command level access control check. The default implementation invokes the access control manager to perform the command level access control check on this command.
Returns:
true if user has authority to execute this command false if user has no authority to execute this command
Throws:
ECException - -ECApplicationException indicating an _ERR_USER_AUTHORITY error

checkIsAllowed

public void checkIsAllowed(java.lang.Object 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 - the resource to be acted on
action - action to be performed on the resource
Throws:
ECException - -ECApplicationException indicating an _ERR_USER_AUTHORITY error

checkParameters

protected void checkParameters()
                        throws ECException
Deprecated. Replaced by validateParameters()
Performs server side parameter checking. This method is replaced by the validateParameters() method. Command writers should NOT implement this method but implement validateParameters() instead. The default implementation of checkParameters is just a no op.
Throws:
ECException.
ECException

checkResourcePermission

public void checkResourcePermission()
                             throws ECException
Performs resource level access control check. The default implementation calls the AccManager to perform resource level access control checking based on the command interface name and the AccessVector returned by the getResources() method. This method will throw an ECApplicationException with message _ERR_USER_AUTHORITY if the user has no authority to perform the operation on the resource.
Throws:
ECException - - _ERR_USER_AUTHORITY if user has no permission to perform the operation on the resource.

execute

public final void execute()
                   throws ECException
This method is part of the command framework for execution of a command. An ECException will be throw if there are any errors detected during the command execution.
Throws:
com.ibm.commerce.exception.ECException
ECException

getAccCheck

public boolean getAccCheck()
Check to see if access control check is required for this command.
Returns:
true if access check is required false if access check is not required

getCommandContext

public final CommandContext getCommandContext()
Gets the command context associated with this command. The command context has to be set before we execute any command.
Returns:
command context object.

getCommandIfName

public final java.lang.String getCommandIfName()
Gets the command interface name.

getCommandName

public final java.lang.String getCommandName()
Gets the name of the originating command. This is the url name defined in the URLREG.

getDefaultProperties

public final TypedProperty getDefaultProperties()
Gets the default properties associated with this command.
Returns:
default properties

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 on the resource.
Returns:
vector of resource action pairs
ECException

getStoreId

public java.lang.Integer getStoreId()
Gets the store Id associated with this command from the command context.
Returns:
the store Id.

getCommandStoreId

public final java.lang.Integer getCommandStoreId()
Gets the store Id used to create this command.
Returns:
the store Id.

setCommandStoreId

public final void setCommandStoreId(java.lang.Integer storeId)
Sets the store Id associated with this command. This method is used by the by the command factory when creating the command
Parameters:
storeId - the command store Id.

getUser

public final UserAccessBean getUser()
                             throws com.ibm.commerce.exception.ECSystemException
Gets the userAccessBean associated with the user.
Returns:
user access bean
Throws:
com.ibm.commerce.exception.ECSystemException - The exception description.

getUserId

public java.lang.Long getUserId()
Gets the user Id for the user associated with this command from the command context.
Returns:
the user Id.

isReadyToCallExecute

public boolean isReadyToCallExecute()
This method is called by the Targettable Command frame work before the execution of the command. The default implementation is to return true.
Returns:
true if we can execute the command false if we canot execute the command

performExecute

public void performExecute()
                    throws ECException
The business logic for this command. This method should be overwritten by all command writers. Command writers should call super.performExecute() as the first line in their method.
Throws:
ECException.
ECException

reset

public void reset()
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.

setAccCheck

public void setAccCheck(boolean newValue)
This method is set by the web controller to indicate whether access control check is required for this command. For example, no access control check is required when we display a jsp page associated with a command because access control has already been performed on the controller command
Parameters:
newValue - true if access check is required and false if access check is not required

setCommandContext

public final void setCommandContext(CommandContext aCommandContext)
Sets the command context associated with this command. It is the responsibility of the caller of the command to call this method to set up the command context before invoking the command.

setCommandIfName

public final void setCommandIfName(java.lang.String name)
Sets the command interface name
Parameters:
name - the command interface name.

setDefaultProperties

public final void setDefaultProperties(com.ibm.commerce.datatype.TypedProperty val)
Sets default properties associated with this ECCommand. Default properties are defined in the URLREG for controller commands and is defined in the VIEWREG for view commands.
Parameters:
val - TypedProperties

validateParameters

public void validateParameters()
                        throws ECException
Performs parameter checking. This method replaces checkParameters() in 5.1. The default implementation of validateParameters() is a no op. It is the responsibility of the command writers to implements this method if they want to perform server side parameter checking.
Throws:
ECException.
ECException

finalize

public void finalize()
Final cleans up of resources.

createCommandExecutionEvent

public void createCommandExecutionEvent(CommandExecutionTrigger trigger)
                                 throws ECException
Creates a command execution event.
Parameters:
trigger - command execution trigger
Throws:
ECException