Interface JobInstanceDao
- All Known Implementing Classes:
JdbcJobInstanceDao
,MongoJobInstanceDao
public interface JobInstanceDao
Data Access Object for job instances.
- Author:
- Lucas Ward, Robert Kasanicky, Michael Minella, Mahmoud Ben Hassine
-
Method Summary
Modifier and TypeMethodDescriptioncreateJobInstance
(String jobName, JobParameters jobParameters) Create a JobInstance with given name and parameters.default void
deleteJobInstance
(JobInstance jobInstance) Delete the job instance.findJobInstancesByName
(String jobName, int start, int count) Fetch the last job instances with the provided name, sorted backwards by primary key, using a 'like' criteriagetJobInstance
(Long instanceId) Fetch the job instance with the provided identifier.getJobInstance
(String jobName, JobParameters jobParameters) Find the job instance that matches the given name and parameters.getJobInstance
(JobExecution jobExecution) Fetch the JobInstance for the provided JobExecution.long
getJobInstanceCount
(String jobName) Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.getJobInstances
(String jobName, int start, int count) Fetch the last job instances with the provided name, sorted backwards by primary key.Retrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed.default JobInstance
getLastJobInstance
(String jobName) Fetch the last job instance by Id for the given job.
-
Method Details
-
createJobInstance
Create a JobInstance with given name and parameters.PreConditions: JobInstance for given name and parameters must not already exist
PostConditions: A valid job instance will be returned which has been persisted and contains an unique Id.
- Parameters:
jobName
-String
containing the name of the job.jobParameters
-JobParameters
containing the parameters for the JobInstance.- Returns:
- JobInstance
JobInstance
instance that was created.
-
getJobInstance
Find the job instance that matches the given name and parameters. If no matching job instances are found, then returns null.- Parameters:
jobName
- the name of the jobjobParameters
- the parameters with which the job was executed- Returns:
JobInstance
object matching the job name andJobParameters
ornull
-
getJobInstance
Fetch the job instance with the provided identifier.- Parameters:
instanceId
- the job identifier- Returns:
- the job instance with this identifier or
null
if it doesn't exist
-
getJobInstance
Fetch the JobInstance for the provided JobExecution.- Parameters:
jobExecution
- the JobExecution- Returns:
- the JobInstance for the provided execution or
null
if it doesn't exist.
-
getJobInstances
Fetch the last job instances with the provided name, sorted backwards by primary key.if using the JdbcJobInstance, you can provide the jobName with a wildcard (e.g. *Job) to return 'like' job names. (e.g. *Job will return 'someJob' and 'otherJob')
- Parameters:
jobName
- the job namestart
- the start index of the instances to returncount
- the maximum number of objects to return- Returns:
- the job instances with this name or empty if none
-
getLastJobInstance
Fetch the last job instance by Id for the given job.- Parameters:
jobName
- name of the job- Returns:
- the last job instance by Id if any or null otherwise
- Since:
- 4.2
-
getJobNames
Retrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed.- Returns:
- the names of all job instances
-
findJobInstancesByName
Fetch the last job instances with the provided name, sorted backwards by primary key, using a 'like' criteria- Parameters:
jobName
-String
containing the name of the job.start
- int containing the offset of where list of job instances results should begin.count
- int containing the number of job instances to return.- Returns:
- a list of
JobInstance
for the job name requested.
-
getJobInstanceCount
Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.- Parameters:
jobName
- the name of the job to query for- Returns:
- the number of
JobInstance
s that exist within the associated job repository - Throws:
NoSuchJobException
- thrown if no Job has the jobName specified.
-
deleteJobInstance
Delete the job instance. This method is not expected to delete the associated job executions. If this is needed, clients of this method should do that manually.- Parameters:
jobInstance
- the job instance to delete- Since:
- 5.0
-