com.ibm.commerce.scheduler.commands
Class EditJobCmdImpl
- java.lang.Object
-
- com.ibm.websphere.command.TargetableCommandImpl
-
- com.ibm.websphere.command.CacheableCommandImpl
-
- com.ibm.commerce.command.MeasuredCacheableCommandImpl
-
- com.ibm.commerce.command.AbstractECTargetableCommand
-
- com.ibm.commerce.command.ControllerCommandImpl
-
- com.ibm.commerce.scheduler.commands.AddJobCmdImpl
-
- com.ibm.commerce.scheduler.commands.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 ofn1=v1
indicates that parametern1
will have a value ofv1
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 thedelay
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 theattempts
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 isjava.lang.Thread.NORM_PRIORTY
. Valid values must be between the range ofjava.lang.Thread.MIN_PRIORITY
andjava.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 theCHKCMD
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 Summary
Fields Modifier and Type Field and Description static java.lang.String
COPYRIGHT
IBM Copyright notice field.-
Fields inherited from interface com.ibm.commerce.scheduler.commands.EditJobCmd
defaultCommandClassName, NAME
-
Fields inherited from interface com.ibm.commerce.scheduler.commands.AddJobCmd
defaultCommandClassName, NAME
-
-
Constructor Summary
Constructors Constructor and Description EditJobCmdImpl()
This is the default constructor for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AccessVector
getResources()
This method returns the resources for theEditJob
command.void
performExecute()
This first calls theRemoveJob
command to remove the current job.void
setRequestProperties(TypedProperty reqParms)
This method extracts the required parameters from the request properties and sets them locally in the command.void
validateParameters()
This method validates the specified parameters of the command.-
Methods inherited from class com.ibm.commerce.scheduler.commands.AddJobCmdImpl
getApplicationType, getAttempts, getCheckCommandId, getDelay, getHost, getInterfaceName, getJobId, getJobInstanceId, getStoreId, getUserRefNum, setApplicationType, setAttempts, setCheckCommandId, setDelay, setDescription, setEndTime, setErrorUrl, setHost, setInterfaceName, setInterval, setJobId, setJobInfo, setName, setPathInfo, setPriority, setQueryString, setSequence, setStartTime, setStoreId, setStringEndTime, setStringStartTime, setUrl, setUserRefNum
-
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
-
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
-
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.commerce.command.ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
-
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.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, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, 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
-
-
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 theEditJob
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 interfaceECCommand
- Overrides:
getResources
in classAddJobCmdImpl
- 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 theRemoveJob
command to remove the current job. The default implementation ofRemoveJob
is to change the jobs configuration to deactivate the job. It also removes theSCHACTIVE
record so it will not be picked up. To add the new job,super.validateParameters()
is called, followed bysuper.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 interfaceECCommand
- Specified by:
performExecute
in interfacecom.ibm.websphere.command.TargetableCommand
- Overrides:
performExecute
in classAddJobCmdImpl
- 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 anECApplicationException
if a required parameter is missing.- Specified by:
setRequestProperties
in interfaceControllerCommand
- Overrides:
setRequestProperties
in classAddJobCmdImpl
- 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 interfaceECCommand
- Overrides:
validateParameters
in classAddJobCmdImpl
- Throws:
ECException
- This is thrown if there is a problem with either the parameters specified or the retrieval of the existing schedule job.
-
-