Class Job
- java.lang.Object
-
- org.pentaho.platform.api.scheduler2.Job
-
public class Job extends Object
AJobis a representation of the union between an action to be performed, data to be supplied, and a schedule upon which the action will be fired. The scheduling system is responsible for creatingJobs viaIScheduler#createJob(String, Class, Map, JobTrigger). Jobs are likely persistent, at least for the life of aISchedulerinstance. In other words, anISchedulerinstance should never forget about a Job it has created, unless the Job has been removed viaIScheduler#removeJob(Job).Note: once the scheduler engine processes a job run, it will create a new
IJobResult, which will contain full historical information about job runs.Jobwill contain only minimal of such temporal information.- Author:
- aphillips
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJob.JobState
-
Constructor Summary
Constructors Constructor Description Job()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetGroupName()StringgetJobId()StringgetJobName()Map<String,Serializable>getJobParams()JobTriggergetJobTrigger()DategetLastRun()DategetNextRun()StringgetSchedulableClass()Job.JobStategetState()StringgetUserName()voidsetGroupName(String groupName)Sets the group name of this jobvoidsetJobId(String jobId)Sets the id that uniquely defines this job.voidsetJobName(String jobName)Sets the user defined name of this job.voidsetJobParams(Map<String,Serializable> jobParams)Sets the parameters that will be passed to the scheduled IAction when the job executes.voidsetJobTrigger(JobTrigger jobTrigger)Sets the trigger used to determine when this job runs.voidsetLastRun(Date lastRun)Sets the last time the job executed.voidsetNextRun(Date nextRun)Sets the next time the job will executevoidsetSchedulableClass(String schedulableClass)Sets the name of the IAction class that will run when the job is executed.voidsetState(Job.JobState state)Sets the current state of this jobvoidsetUserName(String userName)Sets the name of the user that has scheduled this job
-
-
-
Method Detail
-
getJobTrigger
public JobTrigger getJobTrigger()
- Returns:
- the trigger that determines when the job executes
-
getJobParams
public Map<String,Serializable> getJobParams()
- Returns:
- the map containing the parameters to be passed to the action executed by this job
-
getLastRun
public Date getLastRun()
- Returns:
- the last time this job ran or null if the job has not run yet.
-
getNextRun
public Date getNextRun()
- Returns:
- the next time the job is scheduled to run or null if the job will not run again.
-
getSchedulableClass
public String getSchedulableClass()
- Returns:
- the class name of the IAction that will be executed by this job.
-
getJobId
public String getJobId()
- Returns:
- the id that uniquely defines this job.
-
getJobName
public String getJobName()
- Returns:
- the user defined name of this job.
-
getUserName
public String getUserName()
- Returns:
- the user that scheduled this job
-
getGroupName
public String getGroupName()
- Returns:
- the group name of this job
-
setJobTrigger
public void setJobTrigger(JobTrigger jobTrigger)
Sets the trigger used to determine when this job runs.- Parameters:
jobTrigger- the job trigger
-
setJobParams
public void setJobParams(Map<String,Serializable> jobParams)
Sets the parameters that will be passed to the scheduled IAction when the job executes.- Parameters:
jobParams- the parameters to be passed to the IAction
-
setLastRun
public void setLastRun(Date lastRun)
Sets the last time the job executed.- Parameters:
lastRun- the last time the job ran. null if the job has not run.
-
setNextRun
public void setNextRun(Date nextRun)
Sets the next time the job will execute- Parameters:
nextRun- the next time the job will run. null if the job will not run again.
-
setSchedulableClass
public void setSchedulableClass(String schedulableClass)
Sets the name of the IAction class that will run when the job is executed.- Parameters:
schedulableClass- the name of the IAction to run.
-
setJobId
public void setJobId(String jobId)
Sets the id that uniquely defines this job.- Parameters:
jobId- the job id
-
setUserName
public void setUserName(String userName)
Sets the name of the user that has scheduled this job- Parameters:
userName- the user name
-
setJobName
public void setJobName(String jobName)
Sets the user defined name of this job.- Parameters:
jobName- the job name
-
getState
public Job.JobState getState()
- Returns:
- the current job state
-
setState
public void setState(Job.JobState state)
Sets the current state of this job- Parameters:
state- the job state
-
setGroupName
public void setGroupName(String groupName)
Sets the group name of this job- Parameters:
groupName- the group name
-
-