this.classLoader = getJobContext().getClassLoader();
this.stepExecution = getJobContext().jobRepository.createStepExecution(id);
final JobExecutionImpl originalToRestart = getJobContext().originalToRestart;
if (originalToRestart != null) { //currently in a restarted execution
final StepExecutionImpl originalStepExecution = findOriginalStepExecution(originalToRestart);
if (originalStepExecution != null) {
if (originalStepExecution.getBatchStatus() == BatchStatus.COMPLETED) {
allowStartIfComplete = Boolean.valueOf(step.getAllowStartIfComplete());
if (allowStartIfComplete == Boolean.FALSE) {
setBatchStatus(BatchStatus.COMPLETED);
setExitStatus(originalStepExecution.getExitStatus());
return;
}
}
if (originalStepExecution.getPersistentUserData() != null) {
this.stepExecution.setPersistentUserData(originalStepExecution.getPersistentUserData());
}
this.stepExecution.setReaderCheckpointInfo(originalStepExecution.getReaderCheckpointInfo());
this.stepExecution.setWriterCheckpointInfo(originalStepExecution.getWriterCheckpointInfo());
this.stepExecution.setStartCount((originalStepExecution).getStartCount());
this.stepExecution.setNumOfPartitions(originalStepExecution.getNumOfPartitions());
if (originalStepExecution.getPartitionPropertiesIndex() != null) {
for (final Integer i : originalStepExecution.getPartitionPropertiesIndex()) {
this.stepExecution.addPartitionPropertiesIndex(i);
}
}
if (originalStepExecution.getPartitionPersistentUserData() != null) {
for (final Serializable d : originalStepExecution.getPartitionPersistentUserData()) {
this.stepExecution.addPartitionPersistentUserData(d);
}
}
if (originalStepExecution.getPartitionReaderCheckpointInfo() != null) {
for (final Serializable d : originalStepExecution.getPartitionReaderCheckpointInfo()) {
this.stepExecution.addPartitionReaderCheckpointInfo(d);
}
}
if (originalStepExecution.getPartitionWriterCheckpointInfo() != null) {
for (final Serializable d : originalStepExecution.getPartitionWriterCheckpointInfo()) {
this.stepExecution.addPartitionWriterCheckpointInfo(d);
}
}
}
}