org.pentaho.platform.api.scheduler2
Class Job

java.lang.Object
  extended by org.pentaho.platform.api.scheduler2.Job

public class Job
extends Object

A Job is 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 creating Jobs via IScheduler.createJob(String, Class, Map, JobTrigger). Jobs are likely persistent, at least for the life of a IScheduler instance. In other words, an IScheduler instance should never forget about a Job it has created, unless the Job has been removed via IScheduler#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. Job will contain only minimal of such temporal information.

Author:
aphillips

Nested Class Summary
static class Job.JobState
           
 
Constructor Summary
Job()
           
 
Method Summary
 String getJobId()
           
 String getJobName()
           
 Map<String,Serializable> getJobParams()
           
 JobTrigger getJobTrigger()
           
 Date getLastRun()
           
 Date getNextRun()
           
 String getSchedulableClass()
           
 Job.JobState getState()
           
 String getUserName()
           
 void setJobId(String jobId)
          Sets the id that uniquely defines this job.
 void setJobName(String jobName)
          Sets the user defined name of this job.
 void setJobParams(Map<String,Serializable> jobParams)
          Sets the parameters that will be passed to the scheduled IAction when the job executes.
 void setJobTrigger(JobTrigger jobTrigger)
          Sets the trigger used to determine when this job runs.
 void setLastRun(Date lastRun)
          Sets the last time the job executed.
 void setNextRun(Date nextRun)
          Sets the next time the job will execute
 void setSchedulableClass(String schedulableClass)
          Sets the name of the IAction class that will run when the job is executed.
 void setState(Job.JobState state)
          Sets the current state of this job
 void setUserName(String userName)
          Sets the name of the user that has scheduled this job
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Job

public 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

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