List of usage examples for org.springframework.batch.core JobInstance setVersion
public void setVersion(Integer version)
From source file:org.springframework.xd.dirt.rest.BatchJobsController.java
/** * Return a paged collection of job instances for a given job. * //from www . j av a 2 s . co m * @param jobName name of the batch job * @param startJobInstance start index for the job instance * @param pageSize page size for the list * @return collection of JobInstnaces by job name */ @RequestMapping(value = "/{jobName}/instances", method = RequestMethod.GET) @ResponseBody @ResponseStatus(HttpStatus.OK) public Collection<JobInstance> instancesForJob(@PathVariable String jobName, @RequestParam(defaultValue = "0") int startJobInstance, @RequestParam(defaultValue = "20") int pageSize) { String fullName = jobName + ".job"; try { Collection<JobInstance> jobInstances = jobService.listJobInstances(fullName, startJobInstance, pageSize); // need to pass simple name back to the client List<JobInstance> result = new ArrayList<JobInstance>(); for (JobInstance jobInstance : jobInstances) { JobInstance simpleInstance = new JobInstance(jobInstance.getId(), jobName); simpleInstance.setVersion(jobInstance.getVersion()); result.add(simpleInstance); } // TODO: Need to add the jobExecutions for each jobInstance return result; } catch (NoSuchJobException e) { throw new NoSuchBatchJobException(jobName); } }