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

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

Introduction

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

Prototype

public void setLastUpdated(Date lastUpdated) 

Source Link

Document

Set the time when the StepExecution was last updated before persisting

Usage

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)
 * //  www . java  2s . 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:org.springframework.batch.core.repository.support.SimpleJobRepository.java

@Override
public void add(StepExecution stepExecution) {
    validateStepExecution(stepExecution);

    stepExecution.setLastUpdated(new Date(System.currentTimeMillis()));
    stepExecutionDao.saveStepExecution(stepExecution);
    ecDao.saveExecutionContext(stepExecution);
}

From source file:org.springframework.batch.core.repository.support.SimpleJobRepository.java

@Override
public void addAll(Collection<StepExecution> stepExecutions) {
    Assert.notNull(stepExecutions, "Attempt to save a null collection of step executions");
    for (StepExecution stepExecution : stepExecutions) {
        validateStepExecution(stepExecution);
        stepExecution.setLastUpdated(new Date(System.currentTimeMillis()));
    }//from  w  w  w  . j  a  v a  2s  .com
    stepExecutionDao.saveStepExecutions(stepExecutions);
    ecDao.saveExecutionContexts(stepExecutions);
}

From source file:org.springframework.batch.core.repository.support.SimpleJobRepository.java

@Override
public void update(StepExecution stepExecution) {
    validateStepExecution(stepExecution);
    Assert.notNull(stepExecution.getId(), "StepExecution must already be saved (have an id assigned)");

    stepExecution.setLastUpdated(new Date(System.currentTimeMillis()));
    stepExecutionDao.updateStepExecution(stepExecution);
    checkForInterruption(stepExecution);
}