com.ibm.commerce.command

Class ControllerCommandImpl

  • java.lang.Object
    • Constructor Detail

      • ControllerCommandImpl

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

      • checkPermission

        public boolean checkPermission()
                                throws ECException
        Deprecated. This method has been replaced by ECCommand.getResources()
        This method performs fine grain level access control. This is replaced by resource level access control or checkResourcePermission() in this version. Command writers should not implement this method but implement the getResources() method instead. The default implementation returns true.
        Specified by:
        checkPermission in interface ControllerCommand
        Returns:
        This method returns true if this user has permission to perform the operation on the resource and false otherwise.
        Throws:
        ECException
      • getForUserId

        public java.lang.Long getForUserId()
        This method gets the user id for a customer agent command.
        Specified by:
        getForUserId in interface AccCommand
        Returns:
        This method returns the forUserId.
      • getGeneric

        public boolean getGeneric()
        This method gets the generic property for this command. A generic command is a command that can be executed by a generic user. The default implementation by ControllerCommandImpl returns 'false' for this method. The command writer needs to overwrite this method if this command can be executed by a generic user.
        Specified by:
        getGeneric in interface ControllerCommand
        Returns:
        This method returns true if this command can be called by a generic user and false otherwise.
      • getOwner

        public java.lang.Long getOwner()
                                throws java.lang.Exception
        This method gets the owner of this command. This method is part of the Protectable interface. This is required for command level access control where the command is the protectable resource.
        Specified by:
        getOwner in interface Protectable
        Returns:
        This method returns the owner id.
        Throws:
        java.lang.Exception
      • getRequestProperties

        public TypedProperty getRequestProperties()
        This method gets the request properties associated with this command.
        Specified by:
        getRequestProperties in interface ControllerCommand
        Returns:
        This method returns the request properties.
      • getResolvedRequestProperties

        public TypedProperty getResolvedRequestProperties()
        This method gets the resolved request properties associated with this command. This method is called after a controller command has been executed successfully. It returns a Hashtable of name/value pairs of interpreted request properties. This method needs to be implemented for all commands that accept wild card parameter values and where user traffic data monitoring is desired. The default implementation returns null. The command will return only the properties with expanded parameter values.
        Specified by:
        getResolvedRequestProperties in interface ControllerCommand
        Returns:
        This method returns the request properties.
      • getResourceOwners

        public java.lang.Long[] getResourceOwners()
                                           throws ECException
        Deprecated. This method has been replaced by AbstractECTargetableCommand.getResources()
        This method gets all the organization units that own the resources accessed by this command. It returns null if no resource is being accessed by this command. This method was used in WebSphere Commerce 5.1 for command level access control checking. It is no longer required. It is kept for backward compatibility. The default implementation returns null.
        Specified by:
        getResourceOwners in interface AccCommand
        Returns:
        This method returns an array of Long objects that represents all the organization unit reference numbers. A site owner is represented by an organization unit value of -1.
        Throws:
        ECException
      • getResponseProperties

        public TypedProperty getResponseProperties()
        This method gets the response properties associated with this command. This method is called after a controller command has been executed successfully. It return a Hashtable of name value pairs. The controller command should return a view command name for returning response data.

        For example, it could contain the following properties:

        • EC_VIEWTASKNAME (viewTaskName) - The name of a view command/view task. This is a required parameter.
        • EC_DOCPATHNAME (docname) - The name of a JSP to be forwarded.
        • EC_TEXTDOCUMENT (textDocument)- An InputStream for the text document to be returned.
        • EC_RAWDOCUMENT (rawDocument)- An InputStream for the raw document to be returned.
        • EC_REDIRECTURL (redirecturl) - The name of a redirect URL
        It could also contain other information to be passed as request parameters to the view command.

        The response properties are combined with any default parameters defined in the properties column of the URL configuration before passing on to the view command.

        Specified by:
        getResponseProperties in interface ControllerCommand
        Returns:
        This method returns the response properties.
      • getRetriable

        public boolean getRetriable()
        This method gets the retriable property for this command. A retriable command is one that should be retried on a rollback exception. The default implementation is to return false.
        Specified by:
        getRetriable in interface ControllerCommand
        Returns:
        This method returns true if this command is retriable and false otherwise.
      • getViewInputProperties

        public TypedProperty getViewInputProperties()
        This method gets the input properties that will be passed on to the view command. The default implementation is to return all of the request properties to the view command. The command writer can overwrite this method to return all, part or none of the request properties to the view command.
        Specified by:
        getViewInputProperties in interface ControllerCommand
        Returns:
        This method returns the request properties.
      • isGeneric

        public boolean isGeneric()
        This method determines whether this is a generic command. A generic command is a command that can be invoked by a generic user. The default is false for all controller commands and true for all view commands.
        Specified by:
        isGeneric in interface ControllerCommand
        Returns:
        This method returns true if this command can be called by a generic user and false otherwise.
      • isRetriable

        public boolean isRetriable()
        This method determines whether this command is retriable on transaction rollback exceptions. A retriable command will be retried once a transaction rollback exception is thrown. The default implementation is to return false.
        Specified by:
        isRetriable in interface ControllerCommand
        Returns:
        This method returns true if this command is retriable and false otherwise.
      • mergeProperties

        public TypedProperty mergeProperties(TypedProperty reqProp)
        This method merges the properties passed to the request with the default properties. The default behavior is to give a higher priority to the properties passed in the request. The default properties, retrieved from command configuration, are given a lower priority. Command writers can overwrite this method if they want a different merge policy.
        Specified by:
        mergeProperties in interface ControllerCommand
        Parameters:
        reqProp - This is an object that represents the input request properties.
        Returns:
        This method returns the request properties for this command.
      • setForUserId

        public void setForUserId(java.lang.Long value)
        This method sets the forUserId for a customer agent command. This method is for internal use by the framework only.
        Specified by:
        setForUserId in interface AccCommand
        Parameters:
        value - This is the user id.
      • setGeneric

        public final void setGeneric(boolean value)
        This method sets the generic property of this command. The generic property is initialized by the command factory code based on the properties specified in the command configuration.
        Specified by:
        setGeneric in interface ControllerCommand
        Parameters:
        value - This is a boolean value; true if the command is a generic command and false otherwise.
      • setOwner

        public void setOwner(java.lang.Long value)
        This method sets the owner for this command for the purpose of command level access control.
        Specified by:
        setOwner in interface AccCommand
        Parameters:
        value - This is the owner id.
      • setRequestProperties

        public void setRequestProperties(TypedProperty reqProperties)
                                  throws ECException
        This method sets the requestProperties for the command. The WebController calls the setRequestProperties method before invoking the execute method for this command. It is the responsibility of the command writer to extract the required input parameters from the requestProperties object.
        Specified by:
        setRequestProperties in interface ControllerCommand
        Parameters:
        reqProperties - This is an object that represents the request properties.
        Throws:
        ECException
      • setResponseProperties

        public void setResponseProperties(TypedProperty respProperties)
        This method sets the response properties. It is called by the command to set the response properties to be returned.
        Parameters:
        respProperties - This is an object that represents the response properties.
      • setRetriable

        public final void setRetriable(boolean value)
        This method sets the retriable property for this command. The retriable property is initialized by the command factory based on the properties defined in the command configuration. This command configuration at runtime can come from the following two locations in the given order of sequence:
        • 1) CommandRegistryEntry retriable setting is assigned from the retriable properties in the PROPERTIES column of the CMDREG table, only when that entry exists in the database table, otherwise,
        • 2) if an instance property called <CommandRegistryRetriableProperty defaultValue="0" (or "false") /> is defined in the wc-server.xml file, then the command factory will use this setting as the default retriable configuration.
        Specified by:
        setRetriable in interface ControllerCommand
        Parameters:
        value - This is a boolean value; true if retriable and false otherwise.
      • setViewInputProperties

        public void setViewInputProperties(TypedProperty reqProperties)
                                    throws ECException
        This method sets the input properties to be passed to the view command. It is initialized to be the request properties for this command.
        Specified by:
        setViewInputProperties in interface ControllerCommand
        Parameters:
        reqProperties - This is an object that represents the request properties.
        Throws:
        ECException
      • fulfills

        public boolean fulfills(java.lang.Long member,
                                java.lang.String relationship)
                         throws java.lang.Exception
        This method determines if a given member fulfills a given relationship with the resource.
        Specified by:
        fulfills in interface Protectable
        Parameters:
        member - This is the member id of the member.
        relationship - This is the relationship the member has with to the resource.
        Returns:
        This method returns true if the member fulfills the relationship with the resource and false otherwise.
        Throws:
        RemoteException
        java.lang.Exception