com.ibm.commerce.scheduler.commands

Class EditJobCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, AddJobCmd, EditJobCmd, com.ibm.commerce.scheduler.OmitSchedulerJobId, Protectable, 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


    public class EditJobCmdImpl
    extends AddJobCmdImpl
    implements EditJobCmd

    This class edits the configuration or next start time of an existing schedule job.

    The parameters passed to the command are:

    • pathInfo (required): This is the name of the command that the schedule job should execute.
    • start (required): This indicates when to start executing the job.
    • URL (required): This is the URL to which we should be redirected after the command has finished executing.
    • name (optional): This is the logon id of the job's user identity. The default value is the current user scheduling the job. Valid values include any existing users that have the access control authority to create a scheduled job.
    • queryString (optional): This is an object that represents the parameters specified when executing the job. This will be in the form of a URL query string. A value of n1=v1 indicates that parameter n1 will have a value of v1 when the job is executing. The default value is null which means there will be no parameters specified when the job is executing.
    • host (optional): This is the scheduler instance that should execute the job. Each scheduler instance can have a unique instance name (by default it is the WebSphere Commerce Server's web server host name). A scheduled job can run on a particular scheduler instance if specified. The default value is null which means that the job will run on any scheduler instance.
    • interval (optional): This is the time (in seconds) that indicates how often the job should be re-executed. The default value is 0 which means that the job will only be executed once. The value of the interval must be greater than or equal to 0.
    • attempts (optional): This is the number of attempts required to execute the job successfully. The default value is 0 which means the job will only have one attempt of a successful execution. The value specified must be greater than or equal to 0. If this parameter is specified, then the delay parameter should be specified as well.
    • delay (optional): This is the time (in seconds) that indicates how long to wait before attempting to run the job again. This parameter must have a value greater than or equal to 0 and if this parameter is specified, then the attempts parameter must be specified as well.
    • schedulerPolicy (optional): This is the policy of the job when it fails to be executed. The default value is 0. A value of 0 indicates that the job will not be retried. A value of 1 means the job will be retried.
    • priority (optional): This is the priority of the job. The default value is java.lang.Thread.NORM_PRIORTY. Valid values must be between the range of java.lang.Thread.MIN_PRIORITY and java.lang.Thread.MAX_PRIORITY.
    • applicationType (optional): This is the application type of the job. This is defined in the scheduler instance configuration. The default application types are default, broadcast, auction and inventory but others may be added. The default value is null which represents the default application type. A valid value must be one of the defined application types.
    • storeId (optional): this is the store identity of the job. The default value is the current store in the command context. Valid values include stores for which the current user has access control authority.
    • checkCmdId (optional): This is the task command used to determine whether the job needs to be executed or not. The default value is null which means that the job will always be executed. Valid values include any check command id found in the CHKCMD table.

    This command retrieves the current configuration for the specified schedule job. It then creates a new schedule job based on the specified configuration and using the old configuration value for those parameters that were not specified. Then the original job is removed by calling the RemoveJob command. After the execution of the command, the response properties will contain the information needed to redirect to the specified URL.

    See Also:
    AddJobCmdImpl, Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • EditJobCmdImpl

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

      • getResources

        public AccessVector getResources()
                                  throws ECException
        This method returns the resources for the EditJob command. The resources returned are the store that the schedule job belongs to and the user identity under which the job will execute.
        Specified by:
        getResources in interface ECCommand
        Overrides:
        getResources in class AddJobCmdImpl
        Returns:
        This method returns an AccessVector object containing first the store the job belongs to and then the user identity of the command. The user identity is only returned if it differs from the current identity found in the command context.
        Throws:
        ECException - This is thrown if there was a problem retrieving the schedule job's configuration from the database.
      • performExecute

        public void performExecute()
                            throws ECException
        This first calls the RemoveJob command to remove the current job. The default implementation of RemoveJob is to change the jobs configuration to deactivate the job. It also removes the SCHACTIVE record so it will not be picked up. To add the new job, super.validateParameters() is called, followed by super.performExecute(). If there is a problem adding the new copy of the job, RemoveJob should rollback because they are part of the same transaction.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AddJobCmdImpl
        Throws:
        ECException - This is thrown if there was a problem with calling the remove job command or calling the methods of the super class.
      • setRequestProperties

        public void setRequestProperties(TypedProperty reqParms)
                                  throws ECException
        This method extracts the required parameters from the request properties and sets them locally in the command. It throws an ECApplicationException if a required parameter is missing.
        Specified by:
        setRequestProperties in interface ControllerCommand
        Overrides:
        setRequestProperties in class AddJobCmdImpl
        Parameters:
        reqParms - This is an object that represents the parameters of the command.
        Throws:
        ECException - This is thrown if there was a missing parameter.
      • validateParameters

        public void validateParameters()
                                throws ECException
        This method validates the specified parameters of the command. For those parameters that were not specified, the values from the existing schedule job are used.
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AddJobCmdImpl
        Throws:
        ECException - This is thrown if there is a problem with either the parameters specified or the retrieval of the existing schedule job.