Examples of StepExecution


Examples of org.springframework.batch.core.StepExecution

   * later.
   *
   * @see ItemProcessor#process(Object)
   */
  public Future<O> process(final I item) throws Exception {
    final StepExecution stepExecution = getStepExecution();
    FutureTask<O> task = new FutureTask<O>(new Callable<O>() {
      public O call() throws Exception {
        if (stepExecution != null) {
          StepSynchronizationManager.register(stepExecution);
        }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  private StepExecution getStepExecution() {
    StepContext context = StepSynchronizationManager.getContext();
    if (context==null) {
      return null;
    }
    StepExecution stepExecution = context.getStepExecution();
    return stepExecution;
  }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @RequestMapping(value = "/jobs/executions/{jobExecutionId}/steps/{stepExecutionId}", method = RequestMethod.GET)
  public String detail(Model model, @PathVariable Long jobExecutionId, @PathVariable Long stepExecutionId,
      @ModelAttribute("date") Date date, Errors errors) {

    try {
      StepExecution stepExecution = jobService.getStepExecution(jobExecutionId, stepExecutionId);
      model.addAttribute(new StepExecutionInfo(stepExecution, timeZone));
    }
    catch (NoSuchStepExecutionException e) {
      errors.reject("no.such.step.execution", new Object[] { stepExecutionId }, "There is no such step execution ("
          + stepExecutionId + ")");
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @RequestMapping(value = "/jobs/executions/{jobExecutionId}/steps/{stepExecutionId}/progress", method = RequestMethod.GET)
  public String history(Model model, @PathVariable Long jobExecutionId, @PathVariable Long stepExecutionId,
      @ModelAttribute("date") Date date, Errors errors) {

    try {
      StepExecution stepExecution = jobService.getStepExecution(jobExecutionId, stepExecutionId);
      model.addAttribute(new StepExecutionInfo(stepExecution, timeZone));
      String stepName = stepExecution.getStepName();
      if (stepName.contains(":partition")) {
        // assume we want to compare all partitions
        stepName = stepName.replaceAll("(:partition).*", "$1*");
      }
      String jobName = stepExecution.getJobExecution().getJobInstance().getJobName();
      StepExecutionHistory stepExecutionHistory = computeHistory(jobName, stepName);
      model.addAttribute(stepExecutionHistory);
      model.addAttribute(new StepExecutionProgress(stepExecution, stepExecutionHistory));
    }
    catch (NoSuchStepExecutionException e) {
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @RequestMapping(value = "/jobs/executions/{jobExecutionId}/steps/{stepExecutionId}/execution-context", method = RequestMethod.GET)
  public String getStepExecutionContext(Model model, @PathVariable Long jobExecutionId, @PathVariable Long stepExecutionId,
                      @ModelAttribute("date") Date date, Errors errors) {
    try {
      StepExecution stepExecution = jobService.getStepExecution(jobExecutionId, stepExecutionId);
      Map<String, Object> executionMap = new HashMap<String, Object>();

      for (Map.Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
        executionMap.put(entry.getKey(), entry.getValue());
      }

      model.addAttribute("stepExecutionContext", objectMapper.writeValueAsString(executionMap));
      model.addAttribute("stepExecutionId", stepExecutionId);
      model.addAttribute("stepName", stepExecution.getStepName());
      model.addAttribute("jobExecutionId", jobExecutionId);
    }
    catch (NoSuchJobExecutionException e) {
      errors.reject("no.such.job.execution", new Object[] { jobExecutionId }, "There is no such job execution ("
          + jobExecutionId + ")");
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

    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

Examples of org.springframework.batch.core.StepExecution

    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

Examples of org.springframework.batch.core.StepExecution

    }
  }

  private StepExecution getLatestStepExecution(JobExecution jobExecution) {
    Collection<StepExecution> stepExecutions = jobExecution.getStepExecutions();
    StepExecution stepExecution = null;
    if (!stepExecutions.isEmpty()) {
      Date latest = new Date(0L);
      for (StepExecution candidate : stepExecutions) {
        Date stepDate = candidate.getEndTime();
        stepDate = stepDate==null ? new Date() : stepDate;
        if (stepDate.after(latest)) {
          latest = stepDate;
          stepExecution = candidate;
        }
        else if (stepExecution!=null && stepDate.equals(latest) && candidate.getId()>stepExecution.getId()) {
          // Tie breaker using ID
          stepExecution = candidate;           
        }
      }
    }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

      Collection<StepExecutionInfo> stepExecutionInfos = new ArrayList<StepExecutionInfo>();

      for (String name : stepNames) {
        boolean found = false;
        for (Iterator<StepExecution> iterator = stepExecutions.iterator(); iterator.hasNext();) {
          StepExecution stepExecution = iterator.next();
          if (stepExecution.getStepName().equals(name)) {
            stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
            iterator.remove();
            found = true;
          }
        }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  }

  private static class StepExecutionRowMapper implements RowMapper<StepExecution> {

    public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
      StepExecution stepExecution = new StepExecution(rs.getString(2), null);
      stepExecution.setId(rs.getLong(1));
      stepExecution.setStartTime(rs.getTimestamp(3));
      stepExecution.setEndTime(rs.getTimestamp(4));
      stepExecution.setStatus(BatchStatus.valueOf(rs.getString(5)));
      stepExecution.setCommitCount(rs.getInt(6));
      stepExecution.setReadCount(rs.getInt(7));
      stepExecution.setFilterCount(rs.getInt(8));
      stepExecution.setWriteCount(rs.getInt(9));
      stepExecution.setExitStatus(new ExitStatus(rs.getString(10), rs.getString(11)));
      stepExecution.setReadSkipCount(rs.getInt(12));
      stepExecution.setWriteSkipCount(rs.getInt(13));
      stepExecution.setProcessSkipCount(rs.getInt(14));
      stepExecution.setRollbackCount(rs.getInt(15));
      stepExecution.setLastUpdated(rs.getTimestamp(16));
      stepExecution.setVersion(rs.getInt(17));
      return stepExecution;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.