Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobExecution


    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? "NONE" : jobExecution.getExitStatus().getExitCode();
  }

  public String getLatestStatus() {
    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? "NONE" : jobExecution.getStatus().toString();
  }
View Full Code Here


    }

    @Override
    public JobExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
      Long id = rs.getLong(1);
      JobExecution jobExecution;
     
      JobParameters jobParameters = getJobParameters(id);

      JobInstance jobInstance = new JobInstance(rs.getLong(10), rs.getString(11));
      jobExecution = new JobExecution(jobInstance, jobParameters);
      jobExecution.setId(id);

      jobExecution.setStartTime(rs.getTimestamp(2));
      jobExecution.setEndTime(rs.getTimestamp(3));
      jobExecution.setStatus(BatchStatus.valueOf(rs.getString(4)));
      jobExecution.setExitStatus(new ExitStatus(rs.getString(5), rs.getString(6)));
      jobExecution.setCreateTime(rs.getTimestamp(7));
      jobExecution.setLastUpdated(rs.getTimestamp(8));
      jobExecution.setVersion(rs.getInt(9));
      return jobExecution;
    }
View Full Code Here

    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? "NONE" : jobExecution.getStatus().toString();
  }

  public long getLatestExecutionId() {
    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? -1 : jobExecution.getId();
  }
View Full Code Here

    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? -1 : jobExecution.getId();
  }

  public String getLatestStepExitDescription() {
    JobExecution jobExecution = getLatestJobExecution(jobName);
    StepExecution stepExecution = getLatestStepExecution(jobExecution);
    return stepExecution==null ? "" : stepExecution.getExitStatus().getExitDescription();
  }
View Full Code Here

    StepExecution stepExecution = getLatestStepExecution(jobExecution);
    return stepExecution==null ? "" : stepExecution.getExitStatus().getExitDescription();
  }

  public String getLatestStepName() {
    JobExecution jobExecution = getLatestJobExecution(jobName);
    StepExecution stepExecution = getLatestStepExecution(jobExecution);
    return stepExecution==null ? "" : stepExecution.getStepName();
  }
View Full Code Here

    StepExecution stepExecution = getLatestStepExecution(jobExecution);
    return stepExecution==null ? "" : stepExecution.getStepName();
  }

  public boolean isJobRunning() {
    JobExecution jobExecution = getLatestJobExecution(jobName);
    return jobExecution==null ? false : jobExecution.isRunning();
  }
View Full Code Here

      Collection<JobExecution> jobExecutions = jobService.listJobExecutionsForJob(jobName, 0, 4);
      if (jobExecutions.isEmpty()) {
        return null;
      }
      long lastUpdated = 0L;
      JobExecution result = null;
      for (JobExecution jobExecution : jobExecutions) {
        long updated = jobExecution.getCreateTime().getTime();
        if (updated > lastUpdated) {
          result = jobExecution;
          lastUpdated = updated;
        }
        else if (result!=null && updated == lastUpdated && jobExecution.getId() > result.getId()) {
          // Tie breaker using ID
          result = jobExecution;
        }
      }
      return result;
View Full Code Here

  public String stop(Model model, @ModelAttribute("stopRequest") StopRequest stopRequest, Errors errors,
      @PathVariable Long jobExecutionId) {

    stopRequest.jobExecutionId = jobExecutionId;
    try {
      JobExecution jobExecution = jobService.stop(jobExecutionId);
      model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
    }
    catch (NoSuchJobExecutionException e) {
      errors.reject("no.such.job.execution", new Object[] { jobExecutionId }, "No job exection with id="
          + jobExecutionId);
    }
    catch (JobExecutionNotRunningException e) {
      errors.reject("job.execution.not.running", "Job exection with id=" + jobExecutionId + " is not running.");
      JobExecution jobExecution;
      try {
        jobExecution = jobService.getJobExecution(jobExecutionId);
        model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
      }
      catch (NoSuchJobExecutionException e1) {
View Full Code Here

  public String abandon(Model model, @ModelAttribute("stopRequest") StopRequest stopRequest, Errors errors,
      @PathVariable Long jobExecutionId) {

    stopRequest.jobExecutionId = jobExecutionId;
    try {
      JobExecution jobExecution = jobService.abandon(jobExecutionId);
      model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
    }
    catch (NoSuchJobExecutionException e) {
      errors.reject("no.such.job.execution", new Object[] { jobExecutionId }, "No job exection with id="
          + jobExecutionId);
    }
    catch (JobExecutionAlreadyRunningException e) {
      errors.reject("job.execution.running", "Job exection with id=" + jobExecutionId + " is running.");
      JobExecution jobExecution;
      try {
        jobExecution = jobService.getJobExecution(jobExecutionId);
        model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
      }
      catch (NoSuchJobExecutionException e1) {
View Full Code Here

    try {

      Collection<JobExecution> jobExecutions = jobService.getJobExecutionsForJobInstance(jobName, jobInstanceId);
      model.addAttribute(new JobInfo(jobName, jobExecutions.size() + 1));
      JobExecution jobExecution = jobExecutions.iterator().next();
      model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));

      Long jobExecutionId = jobExecution.getId();

      try {

        jobExecution = jobService.restart(jobExecutionId);
        model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.JobExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.