com.ibm.commerce.scheduler.commands
Class CleanJobCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.scheduler.commands.CleanJobCmdImpl
All Implemented Interfaces:
AccCommand, CleanJobCmd, ControllerCommand, ECCommand, ECTargetableCommand

public class CleanJobCmdImpl
extends ControllerCommandImpl
implements CleanJobCmd

Remove job entries from scheduler status table if the job entry is completed.

The command exceptions the following parameters:

The command first verifies the values specified. Once the parameters are verified the status in the SCHSTATUS and SCHBRDCST tables that have an end time that is before the specified end time. If a job number is specified, on the status for that particular job is removed and if no job number is specified, then all job status will be removed. The response properties will contain the appropriate information to redirect to the specified URL after execution.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          IBM Copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.scheduler.commands. CleanJobCmd
defaultCommandClassName, NAME
 
Constructor Summary
CleanJobCmdImpl()
          Creates the CleanJob command object.
 
Method Summary
protected static java.sql.Timestamp convertTime(java.lang.String time)
          Convert the input time value to a Timestamp.
 java.sql.Timestamp getEndTime()
          Gets the end time of the job status to clean.
protected  java.lang.Long getJobRefNum()
          Gets the job reference number for the job to be removed.
  AccessVector getResources()
          Returns the store the owns the job to be cleaned.
protected  java.lang.String getStringEndTime()
          Gets the end time of the status to clean.
protected  java.lang.String getUrl()
          Gets the URL to be redirected to at the end of the command.
 void performExecute()
          Find all the status records for the specified job that is completed and has an end time less before the specified value.
 void setEndTime(java.sql.Timestamp endTime)
          Sets the time value which indicates the status records that should be deleted.
 void setJobRefNum(java.lang.Long jobrefnum)
          Sets the job reference number for the job to be removed.
 void setRequestProperties( TypedProperty reqParms)
          This method extracts the required parameters from the request properties and sets it locally in the command.
 void setStringEndTime(java.lang.String endTime)
          Sets the time criteria used to clean job status entries.
 void setUrl(java.lang.String url)
          Sets the URL to be redirected to at the end of the command.
 void validateParameters()
          Validates the parameters passed to the command.
 
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, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, 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.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, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

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

CleanJobCmdImpl

public CleanJobCmdImpl()
Creates the CleanJob command object.
Method Detail

convertTime

protected static java.sql.Timestamp convertTime(java.lang.String time)
                                         throws ECException
Convert the input time value to a Timestamp.
Parameters:
time - input time value
Returns:
Timestamp
ECException

getEndTime

public java.sql.Timestamp getEndTime()
Gets the end time of the job status to clean.
Returns:
The end time of the job status to clean.

getJobRefNum

protected java.lang.Long getJobRefNum()
Gets the job reference number for the job to be removed.
Returns:
The job reference number.

getResources

public AccessVector getResources()
                          throws ECException
Returns the store the owns the job to be cleaned. If no job is specified then the site identifier is returned.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
The store that owns the job to be cleaned.
Throws:
ECException - if there is a problem obtaining the store id of the job.

getStringEndTime

protected java.lang.String getStringEndTime()
Gets the end time of the status to clean.
Returns:
The end time of the job status to clean.

getUrl

protected java.lang.String getUrl()
Gets the URL to be redirected to at the end of the command.
Returns:
The URL to redirect to.

performExecute

public void performExecute()
                    throws ECException
Find all the status records for the specified job that is completed and has an end time less before the specified value. Then delete those records. The status of the job is either found in the SCHSTATUS oor SCHBRDCST table. Note, if no job is specified that all job status will be cleared that is completed and has an end time before the specified time.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - if there is a problem removing or finding the job status records.

setEndTime

public void setEndTime(java.sql.Timestamp endTime)
Sets the time value which indicates the status records that should be deleted.

setJobRefNum

public void setJobRefNum(java.lang.Long jobrefnum)
Sets the job reference number for the job to be removed.
Parameters:
jobrefnum - the job to clean.

setRequestProperties

public void setRequestProperties(TypedProperty reqParms)
                          throws ECApplicationException
This method extracts the required parameters from the request properties and sets it locally in the command. It throws an ECApplicationException if a required parameter is missing.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
reqParms - the parameters of the command.
Throws:
ECApplicationException - if there was an invalid or missing parameter.

setStringEndTime

public void setStringEndTime(java.lang.String endTime)
Sets the time criteria used to clean job status entries.

setUrl

public void setUrl(java.lang.String url)
Sets the URL to be redirected to at the end of the command.
Parameters:
url - the URL to redirect to.

validateParameters

public void validateParameters()
                        throws ECException
Validates the parameters passed to the command.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - if a required parameter is missing or a specified parameter is invalid.