Example usage for org.springframework.batch.core.jsr JsrJobExecution JsrJobExecution

List of usage examples for org.springframework.batch.core.jsr JsrJobExecution JsrJobExecution

Introduction

In this page you can find the example usage for org.springframework.batch.core.jsr JsrJobExecution JsrJobExecution.

Prototype

public JsrJobExecution(org.springframework.batch.core.JobExecution execution,
        JobParametersConverter parametersConverter) 

Source Link

Usage

From source file:org.springframework.batch.core.jsr.launch.JsrJobOperator.java

@Override
public JobExecution getJobExecution(long executionId) throws NoSuchJobExecutionException, JobSecurityException {
    org.springframework.batch.core.JobExecution jobExecution = jobExplorer.getJobExecution(executionId);

    if (jobExecution == null) {
        throw new NoSuchJobExecutionException("No execution was found for executionId " + executionId);
    }/*from   w w  w.  jav  a 2s .  co m*/

    return new JsrJobExecution(jobExecution, jobParametersConverter);
}

From source file:org.springframework.batch.core.jsr.launch.JsrJobOperator.java

@Override
public List<JobExecution> getJobExecutions(JobInstance jobInstance)
        throws NoSuchJobInstanceException, JobSecurityException {
    if (jobInstance == null) {
        throw new NoSuchJobInstanceException("A null JobInstance was provided");
    }//w  w w.j av  a  2  s .  co m

    org.springframework.batch.core.JobInstance instance = (org.springframework.batch.core.JobInstance) jobInstance;
    List<org.springframework.batch.core.JobExecution> batchExecutions = jobExplorer.getJobExecutions(instance);

    if (batchExecutions == null || batchExecutions.size() == 0) {
        throw new NoSuchJobInstanceException("Unable to find JobInstance " + jobInstance.getInstanceId());
    }

    List<JobExecution> results = new ArrayList<JobExecution>(batchExecutions.size());
    for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) {
        results.add(new JsrJobExecution(jobExecution, jobParametersConverter));
    }

    return results;
}