com.ibm.commerce.command

Class AbstractECTargetableCommand

  • java.lang.Object
    • com.ibm.websphere.command.TargetableCommandImpl
      • com.ibm.websphere.command.CacheableCommandImpl
        • com.ibm.commerce.command.MeasuredCacheableCommandImpl
          • com.ibm.commerce.command.AbstractECTargetableCommand
  • All Implemented Interfaces:
    ECCommand, ECTargetableCommand, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable
    Direct Known Subclasses:
    ControllerCommandImpl, DataBeanCommandImpl, TaskCommandImpl


    public abstract class AbstractECTargetableCommand
    extends com.ibm.commerce.command.MeasuredCacheableCommandImpl
    implements ECTargetableCommand
    This is the abstract base class for all WebSphere Commerce ECTargetableCommand objects.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      • Fields inherited from class com.ibm.websphere.command.TargetableCommandImpl

        LOCAL
      • Fields inherited from interface com.ibm.websphere.command.Command

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractECTargetableCommand()
      This is the default constructor for this class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean accessControlCheck()
      This method performs a command level access control check for this command.
      void checkIsAllowed(java.lang.Object resource, java.lang.String action)
      This method determines whether a user can perform a specified action on a certain resource.
      void checkResourcePermission()
      This method performs resource level access control checking.
      void createCommandExecutionEvent(com.ibm.commerce.command.event.CommandExecutionTrigger trigger)
      This method creates a command execution event.
      void execute()
      This method is part of the command framework.
      boolean getAccCheck()
      This method checks to see if an access control check is required for this command.
      CommandContext getCommandContext()
      This method gets the command context associated with this command.
      java.lang.String getCommandIfName()
      This method gets the command interface name.
      java.lang.String getCommandName()
      This method gets the name of the originating command.
      java.lang.Integer getCommandStoreId()
      This method gets the store id used to create this command.
      TypedProperty getDefaultProperties()
      This method gets the default properties associated with this command.
      java.util.Map getExceptionInvokeParameters(java.lang.String event)
      This method returns the attributes for a particular event type when the command executed throws an exception.
      long getObjectSize()
      Returns the estimated footprint size in bytes of this object and the objects it contains.
      java.util.Map getPostInvokeParameters(java.lang.String event)
      This method returns the attributes for a particular event type after the command is executed.
      java.util.Map getPreInvokeParameters(java.lang.String event)
      This method returns the attributes for a particular event type before the command is executed.
      AccessVector getResources()
      This method gets the access vector accessed by this command.
      java.lang.Integer getStoreId()
      This method gets the store id associated with this command.
      UserAccessBean getUser()
      This method gets the UserAccessBean object associated with the user.
      java.lang.Long getUserId()
      This method gets the user id for the user associated with this command from the command context.
      boolean isReadyToCallExecute()
      This method is called by the targetable command framework.
      void performExecute()
      This method performs the business logic for this command.
      void reset()
      This method is called after a command has been executed.
      void setAccCheck(boolean newValue)
      This method is set by the web controller to indicate whether an access control check is required for this command.
      void setCommandContext(CommandContext aCommandContext)
      This method sets the command context associated with this command.
      void setCommandIfName(java.lang.String name)
      This method sets the command interface name.
      void setCommandStoreId(java.lang.Integer storeId)
      This method sets the store id used to create this command.
      void setDefaultProperties(TypedProperty val)
      This method sets default properties associated with this ECCommand.
      void validateParameters()
      This method performs server side parameter checking.
      • Methods inherited from class com.ibm.websphere.command.CacheableCommandImpl

        executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
      • Methods inherited from class com.ibm.websphere.command.TargetableCommandImpl

        getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.ibm.websphere.command.CacheableCommand

        executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
      • Methods inherited from interface com.ibm.websphere.command.TargetableCommand

        getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputProperties
      • Methods inherited from interface com.ibm.websphere.command.CommandCaller

        unionDependencies
    • Field Detail

      • COPYRIGHT

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

      • AbstractECTargetableCommand

        public AbstractECTargetableCommand()
        This is the default constructor for this class. It calls the constructor from the superclass.
    • Method Detail

      • getObjectSize

        public long getObjectSize()
        Returns the estimated footprint size in bytes of this object and the objects it contains.
        Specified by:
        getObjectSize in interface com.ibm.websphere.cache.Sizeable
        Overrides:
        getObjectSize in class com.ibm.websphere.command.CacheableCommandImpl
        Returns:
        the estimated footprint size in bytes or -1 if a size cannot be determined.
      • accessControlCheck

        public boolean accessControlCheck()
                                   throws ECException
        This method performs a command level access control check for this command. The default implementation invokes the access control manager to perform the check.
        Returns:
        This method returns true if the user has authority and false otherwise.
        Throws:
        ECException - An ECApplicationException is thrown when an _ERR_USER_AUTHORITY error occurs.
      • checkIsAllowed

        public void checkIsAllowed(java.lang.Object resource,
                                   java.lang.String action)
                            throws ECException
        This method determines whether a user can perform a specified action on a certain resource. This method is called by the command to perform a resource level access control check in addition to the resources returned by the getResources() method.
        Specified by:
        checkIsAllowed in interface ECCommand
        Parameters:
        resource - This is the resource to be acted on.
        action - This is the action to be performed on the resource.
        Throws:
        ECException - An ECApplicationException is thrown when an _ERR_USER_AUTHORITY error occurs.
      • checkResourcePermission

        public void checkResourcePermission()
                                     throws ECException
        This method performs resource level access control checking. 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.
        Specified by:
        checkResourcePermission in interface ECCommand
        Throws:
        ECException - This is thrown with the message _ERR_USER_AUTHORITY if user does not have permission to perform the operation on the resource.
      • execute

        public final void execute()
                           throws ECException
        This method is part of the command framework. Command writers should not touch this method. An ECException will be thrown if there are any errors detected during the command execution.
        Specified by:
        execute in interface ECCommand
        Specified by:
        execute in interface com.ibm.websphere.command.Command
        Overrides:
        execute in class com.ibm.commerce.command.MeasuredCacheableCommandImpl
        Throws:
        ECException - This is thrown if there are any errors detected during the command execution.
      • getAccCheck

        public boolean getAccCheck()
        This method checks to see if an access control check is required for this command.
        Specified by:
        getAccCheck in interface ECCommand
        Returns:
        This method returns true if an access control check is required for this command and false otherwise.
      • getCommandContext

        public final CommandContext getCommandContext()
        This method gets the command context associated with this command. The command context has to be set before any commands are executed.
        Specified by:
        getCommandContext in interface ECCommand
        Returns:
        This method returns a CommandContext object.
      • getCommandIfName

        public final java.lang.String getCommandIfName()
        This method gets the command interface name.
        Specified by:
        getCommandIfName in interface ECCommand
        Returns:
        This method returns the command interface name.
      • getCommandName

        public final java.lang.String getCommandName()
        This method gets the name of the originating command. This is the URL name defined in the URL configuration.
        Specified by:
        getCommandName in interface ECCommand
        Returns:
        This method returns the command name.
      • getDefaultProperties

        public final TypedProperty getDefaultProperties()
        This method gets the default properties associated with this command.
        Specified by:
        getDefaultProperties in interface ECCommand
        Returns:
        This method returns the default properties.
      • getResources

        public AccessVector getResources()
                                  throws ECException
        This method 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 responsibility 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
        Returns:
        This method returns an AccessVector object of resource/action pairs.
        Throws:
        ECException
      • getStoreId

        public java.lang.Integer getStoreId()
        This method gets the store id associated with this command.
        Specified by:
        getStoreId in interface ECCommand
        Returns:
        This method returns the store id.
      • getCommandStoreId

        public final java.lang.Integer getCommandStoreId()
        This method gets the store id used to create this command.
        Specified by:
        getCommandStoreId in interface ECCommand
        Returns:
        This method returns the command store id.
      • setCommandStoreId

        public final void setCommandStoreId(java.lang.Integer storeId)
        This method sets the store id used to create this command. This is used internally by the command factory when creating the command.
        Specified by:
        setCommandStoreId in interface ECCommand
        Parameters:
        storeId - This is the command store id.
      • getUserId

        public java.lang.Long getUserId()
        This method gets the user id for the user associated with this command from the command context.
        Specified by:
        getUserId in interface ECCommand
        Returns:
        This method returns the user id.
      • isReadyToCallExecute

        public boolean isReadyToCallExecute()
        This method is called by the targetable command framework. This is where client side parameter checking is performed (before the execution of the command). The default implementation is to return true.
        Specified by:
        isReadyToCallExecute in interface com.ibm.websphere.command.Command
        Specified by:
        isReadyToCallExecute in class com.ibm.websphere.command.TargetableCommandImpl
        Returns:
        This method returns a boolean value; true if we can execute the command and false otherwise. This default implementation will return true.
      • performExecute

        public void performExecute()
                            throws ECException
        This method performs 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.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Specified by:
        performExecute in class com.ibm.websphere.command.TargetableCommandImpl
        Throws:
        ECException
      • reset

        public void reset()
        This method is called after a command has been executed. It is used to reset its states variables. After the call to reset, the command should be able to be executed again.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class com.ibm.websphere.command.CacheableCommandImpl
      • setAccCheck

        public void setAccCheck(boolean newValue)
        This method is set by the web controller to indicate whether an 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.
        Specified by:
        setAccCheck in interface ECCommand
        Parameters:
        newValue - This is a boolean value; true if an access check is required and false otherwise.
      • setCommandContext

        public final void setCommandContext(CommandContext aCommandContext)
        This method 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.
        Specified by:
        setCommandContext in interface ECCommand
        Parameters:
        aCommandContext - This is a CommandContext object.
      • setCommandIfName

        public final void setCommandIfName(java.lang.String name)
        This method sets the command interface name.
        Specified by:
        setCommandIfName in interface ECCommand
        Parameters:
        name - This is the command interface name.
      • setDefaultProperties

        public final void setDefaultProperties(TypedProperty val)
        This method sets default properties associated with this ECCommand. Default properties are defined in the URL configuration. This method is called by the CommandFactory object during command creation to set the default properties for this command.
        Specified by:
        setDefaultProperties in interface ECCommand
        Parameters:
        val - This is a TypedProperty object.
      • validateParameters

        public void validateParameters()
                                throws ECException
        This method performs server side parameter checking. This method replaces the checkParameters() method from version 5.1. The default implementation of validateParameters() is a no op. It is the responsibility of the command writers to implement this method if they want to perform server side parameter checking.
        Specified by:
        validateParameters in interface ECCommand
        Throws:
        ECException
      • createCommandExecutionEvent

        public void createCommandExecutionEvent(com.ibm.commerce.command.event.CommandExecutionTrigger trigger)
                                         throws ECException
        This method creates a command execution event.
        Specified by:
        createCommandExecutionEvent in interface ECCommand
        Parameters:
        trigger - This is a command execution trigger.
        Throws:
        ECException
      • getPreInvokeParameters

        public java.util.Map getPreInvokeParameters(java.lang.String event)
        This method returns the attributes for a particular event type before the command is executed.
        Specified by:
        getPreInvokeParameters in interface ECCommand
        Parameters:
        event - This is the event type.
        Returns:
        This method returns the attributes associated with the event type.
      • getPostInvokeParameters

        public java.util.Map getPostInvokeParameters(java.lang.String event)
        This method returns the attributes for a particular event type after the command is executed.
        Specified by:
        getPostInvokeParameters in interface ECCommand
        Parameters:
        event - This is the event type.
        Returns:
        This method returns the attributes associated with the event type.
      • getExceptionInvokeParameters

        public java.util.Map getExceptionInvokeParameters(java.lang.String event)
        This method returns the attributes for a particular event type when the command executed throws an exception.
        Specified by:
        getExceptionInvokeParameters in interface ECCommand
        Parameters:
        event - This is the event type.
        Returns:
        This method returns the attributes associated with the event type.