Class MongoJobInstanceDao
java.lang.Object
org.springframework.batch.core.repository.dao.MongoJobInstanceDao
- All Implemented Interfaces:
JobInstanceDao
- Since:
- 5.2.0
- Author:
- Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionMongoJobInstanceDao(org.springframework.data.mongodb.core.MongoOperations mongoOperations) -
Method Summary
Modifier and TypeMethodDescriptioncreateJobInstance(String jobName, JobParameters jobParameters) Create a JobInstance with given name and parameters.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.longgetJobInstanceCount(String jobName) Query the repository for the number of uniqueJobInstances 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.getLastJobInstance(String jobName) Fetch the last job instance by Id for the given job.voidsetJobInstanceIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobInstanceIncrementer) voidsetJobKeyGenerator(JobKeyGenerator<JobParameters> jobKeyGenerator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.batch.core.repository.dao.JobInstanceDao
deleteJobInstance
-
Constructor Details
-
MongoJobInstanceDao
public MongoJobInstanceDao(org.springframework.data.mongodb.core.MongoOperations mongoOperations)
-
-
Method Details
-
setJobKeyGenerator
-
setJobInstanceIncrementer
public void setJobInstanceIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobInstanceIncrementer) -
createJobInstance
Description copied from interface:JobInstanceDaoCreate 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.
- Specified by:
createJobInstancein interfaceJobInstanceDao- Parameters:
jobName-Stringcontaining the name of the job.jobParameters-JobParameterscontaining the parameters for the JobInstance.- Returns:
- JobInstance
JobInstanceinstance that was created.
-
getJobInstance
Description copied from interface:JobInstanceDaoFind the job instance that matches the given name and parameters. If no matching job instances are found, then returns null.- Specified by:
getJobInstancein interfaceJobInstanceDao- Parameters:
jobName- the name of the jobjobParameters- the parameters with which the job was executed- Returns:
JobInstanceobject matching the job name andJobParametersornull
-
getJobInstance
Description copied from interface:JobInstanceDaoFetch the job instance with the provided identifier.- Specified by:
getJobInstancein interfaceJobInstanceDao- Parameters:
instanceId- the job identifier- Returns:
- the job instance with this identifier or
nullif it doesn't exist
-
getJobInstance
Description copied from interface:JobInstanceDaoFetch the JobInstance for the provided JobExecution.- Specified by:
getJobInstancein interfaceJobInstanceDao- Parameters:
jobExecution- the JobExecution- Returns:
- the JobInstance for the provided execution or
nullif it doesn't exist.
-
getJobInstances
Description copied from interface:JobInstanceDaoFetch 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')
- Specified by:
getJobInstancesin interfaceJobInstanceDao- 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
Description copied from interface:JobInstanceDaoFetch the last job instance by Id for the given job.- Specified by:
getLastJobInstancein interfaceJobInstanceDao- Parameters:
jobName- name of the job- Returns:
- the last job instance by Id if any or null otherwise
-
getJobNames
Description copied from interface:JobInstanceDaoRetrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed.- Specified by:
getJobNamesin interfaceJobInstanceDao- Returns:
- the names of all job instances
-
findJobInstancesByName
Description copied from interface:JobInstanceDaoFetch the last job instances with the provided name, sorted backwards by primary key, using a 'like' criteria- Specified by:
findJobInstancesByNamein interfaceJobInstanceDao- Parameters:
jobName-Stringcontaining 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
JobInstancefor the job name requested.
-
getJobInstanceCount
Description copied from interface:JobInstanceDaoQuery the repository for the number of uniqueJobInstances associated with the supplied job name.- Specified by:
getJobInstanceCountin interfaceJobInstanceDao- Parameters:
jobName- the name of the job to query for- Returns:
- the number of
JobInstances that exist within the associated job repository - Throws:
NoSuchJobException- thrown if no Job has the jobName specified.
-