Example usage for org.springframework.batch.core StepExecution getStepName

List of usage examples for org.springframework.batch.core StepExecution getStepName

Introduction

In this page you can find the example usage for org.springframework.batch.core StepExecution getStepName.

Prototype

public String getStepName() 

Source Link

Usage

From source file:org.seedstack.spring.batch.fixtures.FlatFileBatchDemo.java

protected static void printStatistics(JobExecution jobExecution) {
    for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
        System.out.println("-----------------------------------");
        System.out.println("STEP name: " + stepExecution.getStepName());
        System.out.println("-----------------------------------");
        System.out.println("CommitCount: " + stepExecution.getCommitCount());
        System.out.println("FilterCount: " + stepExecution.getFilterCount());
        System.out.println("ProcessSkipCount: " + stepExecution.getProcessSkipCount());
        System.out.println("ReadCount: " + stepExecution.getReadCount());
        System.out.println("ReadSkipCount: " + stepExecution.getReadSkipCount());
        System.out.println("RollbackCount: " + stepExecution.getRollbackCount());
        System.out.println("SkipCount: " + stepExecution.getSkipCount());
        System.out.println("WriteCount: " + stepExecution.getWriteCount());
        System.out.println("WriteSkipCount: " + stepExecution.getWriteSkipCount());
        if (stepExecution.getFailureExceptions().size() > 0) {
            System.out.println("exceptions:");
            System.out.println("-----------------------------------");
            for (Throwable t : stepExecution.getFailureExceptions()) {
                System.out.println(t.getMessage());
            }//  w  w w  .j a v a2 s. c o m
        }
        System.out.println("-----------------------------------");
    }
}

From source file:org.trpr.platform.batch.impl.spring.admin.repository.MapStepExecutionDao.java

/**
 * Returns a copy of {@link StepExecution}, by adding new Objects for every field(no references are passed)
 * //w  ww.j a v a2 s  .  c  o  m
 * @param original StepExecution to be copied
 * @return StepExecution copy
 */
private static StepExecution copy(StepExecution original) {
    StepExecution copy = new StepExecution(original.getStepName(), original.getJobExecution());
    copy.setCommitCount(original.getCommitCount());
    if (original.getEndTime() != null) {
        copy.setEndTime((Date) original.getEndTime().clone());
    }
    //Warning: no deep copy
    if (original.getExitStatus() != null) {
        copy.setExitStatus(new ExitStatus(original.getExitStatus().getExitCode(),
                original.getExitStatus().getExitDescription()));
    }
    copy.setFilterCount(original.getFilterCount());
    copy.setId(original.getId());
    if (original.getLastUpdated() != null) {
        copy.setLastUpdated((Date) original.getLastUpdated().clone());
    }
    copy.setProcessSkipCount(original.getProcessSkipCount());
    copy.setReadCount(original.getReadCount());
    copy.setReadSkipCount(original.getReadSkipCount());
    copy.setRollbackCount(original.getRollbackCount());
    if (original.getStartTime() != null) {
        copy.setStartTime((Date) original.getStartTime().clone());
    }
    if (original.getStatus() != null) {
        copy.setStatus(BatchStatus.valueOf(original.getStatus().name()));
    }
    if (original.isTerminateOnly()) {
        copy.setTerminateOnly();
    }
    copy.setVersion(original.getVersion());
    copy.setWriteCount(original.getWriteCount());
    copy.setWriteSkipCount(original.getWriteSkipCount());
    return copy;
}

From source file:com.vmware.bdd.manager.TestClusteringJobs.java

public static String stepsToString(Collection<StepExecution> ses) {
    StringBuilder sb = new StringBuilder();
    for (StepExecution se : ses) {
        if (sb.length() > 0) {
            sb.append(", ");
        }//  ww  w.j ava 2s. c  o m
        sb.append(se.getStepName()).append(":").append(se.getStatus()).append("-")
                .append(se.getExecutionContext());
    }
    return sb.toString();
}

From source file:lcn.module.batch.web.guide.listener.SampleStepPreProcessor.java

/**
 * Step  ?? ? //from   ww  w.ja  v  a2  s  .co m
 */
public void beforeStep(StepExecution stepExecution) {

    log.info(">>>>>>>> beforeStep ::: start " + stepExecution.getStepName());
}

From source file:lcn.module.batch.web.guide.listener.SampleStepPostProcessor.java

/**
 * Step  ?? ? /*from  w  w w. ja  v  a 2 s .  c  o  m*/
 */
public ExitStatus afterStep(StepExecution stepExecution) {
    log.info(">>>>>>>> afterStep ::: finish " + stepExecution.getStepName());
    return null;
}

From source file:com.javaetmoi.core.batch.test.EndTasklet.java

private List<StepExecution> getUnpartitionedStepExecution(JobExecution jobExecution) {
    List<StepExecution> unpartitionedStepExecution = new ArrayList<StepExecution>();
    Collection<StepExecution> allStepExecutions = jobExecution.getStepExecutions();
    for (StepExecution stepExecution : allStepExecutions) {
        if (!stepExecution.getStepName().contains(":partition")) {
            unpartitionedStepExecution.add(stepExecution);
        }/* w  w w.  j a va 2 s .c  o  m*/
    }
    return unpartitionedStepExecution;
}

From source file:com.javaetmoi.elasticsearch.musicbrainz.batch.TestMusicAlbumJob.java

private StepExecution getStepExecution(JobExecution jobExecution, String name) {
    for (StepExecution step : jobExecution.getStepExecutions()) {
        if (step.getStepName().equals(name)) {
            return step;
        }/*w w  w  .j  a va2  s  .c om*/
    }
    return null;
}

From source file:com.javaetmoi.core.batch.test.TestParallelAndPartitioning.java

private StepExecution getStepExecution(JobExecution jobExecution, String stepName) {
    StepExecution stepExecution = null;//from  w ww .  j a va  2s. c om
    List<String> stepNames = new ArrayList<String>();
    for (StepExecution candidate : jobExecution.getStepExecutions()) {
        String name = candidate.getStepName();
        stepNames.add(name);
        if (name.equals(stepName)) {
            stepExecution = candidate;
        }
    }
    if (stepExecution == null) {
        throw new IllegalArgumentException(
                "No such step in this job execution: " + stepName + " not in " + stepNames);
    }
    return stepExecution;
}

From source file:lcn.module.batch.web.guide.listener.SkipCheckingListener.java

/**
 * Step  ? stepName? Context? put /* w ww  .ja va2 s  .c  o  m*/
 */
@BeforeStep
public void saveStepName(StepExecution stepExecution) {
    stepExecution.getExecutionContext().put("stepName", stepExecution.getStepName());
}

From source file:batch.OutputFileListener.java

@BeforeStep
public void createOutputNameFromInput(StepExecution stepExecution) {
    ExecutionContext executionContext = stepExecution.getExecutionContext();
    String inputName = stepExecution.getStepName().replace(":", "-");
    if (executionContext.containsKey(inputKeyName)) {
        inputName = executionContext.getString(inputKeyName);
    }/*  ww  w  .j a v a 2  s.co  m*/
    if (!executionContext.containsKey(outputKeyName)) {
        executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv");
    }
}