Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public StepExecution handleStep(Step step, JobExecution execution)
* @return true if the {@link StepExecution} is part of the {@link JobExecution}
*/
private boolean stepExecutionPartOfExistingJobExecution(JobExecution jobExecution, StepExecution stepExecution) {
return stepExecution != null && stepExecution.getJobExecutionId() == jobExecution.getId();
return stepExecution != null && stepExecution.getJobExecution().getId() == jobExecution.getId();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void setKeys(String[] keys) {
@Override
public void beforeStep(StepExecution stepExecution) {
ExecutionContext stepContext = stepExecution.getExecutionContext();
JobParameters jobParameters = stepExecution.getJobParameters();
JobParameters jobParameters = stepExecution.getJobExecution().getJobParameters();
Collection<String> keys = this.keys;
if (keys == null) {
keys = jobParameters.parameters().stream().map(JobParameter::name).collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public void aggregate(StepExecution result, Collection<StepExecution> executions
Assert.state(id != null, "StepExecution has null id. It must be saved first: " + stepExecution);
return id;
}).collect(Collectors.toSet());
JobExecution jobExecution = jobRepository.getJobExecution(result.getJobExecutionId());
JobExecution jobExecution = jobRepository.getJobExecution(result.getJobExecution().getId());
Assert.state(jobExecution != null,
"Could not load JobExecution from JobRepository for id " + result.getJobExecutionId());
"Could not load JobExecution from JobRepository for id " + result.getJobExecution().getId());
List<StepExecution> updates = jobExecution.getStepExecutions()
.stream()
.filter(stepExecution -> stepExecutionIds.contains(stepExecution.getId()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private boolean shouldStart(boolean allowStartIfComplete, StepExecution stepExec
}

private boolean isSameJobExecution(StepExecution stepExecution, StepExecution lastStepExecution) {
return stepExecution.getJobExecutionId() == lastStepExecution.getJobExecutionId();
return stepExecution.getJobExecution().getId() == lastStepExecution.getJobExecution().getId();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private List<Object[]> buildStepExecutionParameters(StepExecution stepExecution)
Timestamp createTime = stepExecution.getCreateTime() == null ? null
: Timestamp.valueOf(stepExecution.getCreateTime());
Object[] parameterValues = new Object[] { stepExecution.getId(), stepExecution.getVersion(),
stepExecution.getStepName(), stepExecution.getJobExecutionId(), startTime, endTime,
stepExecution.getStepName(), stepExecution.getJobExecution().getId(), startTime, endTime,
stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getReadCount(),
stepExecution.getFilterCount(), stepExecution.getWriteCount(),
stepExecution.getExitStatus().getExitCode(), exitDescription, stepExecution.getReadSkipCount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public org.springframework.batch.core.step.StepExecution toStepExecution(StepExe
public StepExecution fromStepExecution(org.springframework.batch.core.step.StepExecution source) {
StepExecution stepExecution = new StepExecution();
stepExecution.setStepExecutionId(source.getId());
stepExecution.setJobExecutionId(source.getJobExecutionId());
stepExecution.setJobExecutionId(source.getJobExecution().getId());
stepExecution.setName(source.getStepName());
stepExecution.setJobExecutionId(source.getJobExecutionId());
stepExecution.setJobExecutionId(source.getJobExecution().getId());
stepExecution.setStatus(source.getStatus());
stepExecution.setReadCount(source.getReadCount());
stepExecution.setWriteCount(source.getWriteCount());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void update(StepExecution stepExecution) {
private void validateStepExecution(StepExecution stepExecution) {
Assert.notNull(stepExecution, "StepExecution cannot be null.");
Assert.notNull(stepExecution.getStepName(), "StepExecution's step name cannot be null.");
Assert.notNull(stepExecution.getJobExecutionId(), "StepExecution must belong to persisted JobExecution");
Assert.notNull(stepExecution.getJobExecution().getId(), "StepExecution must belong to persisted JobExecution");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setKeyName(String keyName) {
*/
@Override
public void beforeStep(StepExecution stepExecution) {
JobParameters jobParameters = stepExecution.getJobParameters();
JobParameters jobParameters = stepExecution.getJobExecution().getJobParameters();
Assert.state(jobParameters.getParameter(keyName) != null,
"JobParameters do not contain Long parameter with key=[" + keyName + "]");
delegate = new SimpleCompletionPolicy(jobParameters.getLong(keyName).intValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public Map<String, Object> getJobExecutionContext() {
*/
public Map<String, Object> getJobParameters() {
Map<String, Object> result = new HashMap<>();
for (JobParameter<?> jobParameter : stepExecution.getJobParameters()) {
for (JobParameter<?> jobParameter : stepExecution.getJobExecution().getJobParameters()) {
result.put(jobParameter.name(), jobParameter.value());
}
return Collections.unmodifiableMap(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public final void execute(StepExecution stepExecution)
}
StepExecutionEvent stepExecutionEvent = new StepExecutionEvent(stepExecution.getStepName(),
stepExecution.getJobExecution().getJobInstance().getJobName(), stepExecution.getId(),
stepExecution.getJobExecutionId());
stepExecution.getJobExecution().getId());
stepExecutionEvent.begin();
stepExecution.setStartTime(LocalDateTime.now());
stepExecution.setStatus(BatchStatus.STARTED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,9 @@ public String getStepName() {
}

/**
* Accessor for the job execution ID.
* @return the {@code jobExecutionId}.
* @deprecated use {@link #getJobExecution().getId()} instead
*/
// TODO What is the added value of that?
@Deprecated(since = "6.0", forRemoval = true)
public long getJobExecutionId() {
return this.jobExecution.getId();
}
Expand Down Expand Up @@ -449,30 +448,28 @@ public void addFailureException(Throwable throwable) {
}

/**
* Convenience method to get the current job parameters.
* @return the {@link JobParameters} from the enclosing job or empty if that is
* {@code null}.
* @deprecated use {@link #getJobExecution().getJobParameters()} instead
*/
// TODO What is the added value of that?
@Deprecated(since = "6.0", forRemoval = true)
public JobParameters getJobParameters() {
return this.jobExecution.getJobParameters();
}

@Override
public boolean equals(Object obj) {

Object jobExecutionId = getJobExecutionId();
Object jobExecutionId = jobExecution.getId();
if (jobExecutionId == null || !(obj instanceof StepExecution other)) {
return super.equals(obj);
}

return stepName.equals(other.getStepName()) && jobExecutionId.equals(other.getJobExecutionId())
return stepName.equals(other.getStepName()) && jobExecutionId.equals(other.getJobExecution().getId())
&& getId() == other.getId();
}

@Override
public int hashCode() {
Object jobExecutionId = getJobExecutionId();
Object jobExecutionId = jobExecution.getId();
Long id = getId();
return super.hashCode() + 31 * (stepName != null ? stepName.hashCode() : 0)
+ 91 * (jobExecutionId != null ? jobExecutionId.hashCode() : 0) + 59 * (id != null ? id.hashCode() : 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void setKeys(String[] keys) {
@Override
public JobParameters getJobParameters(Job job, StepExecution stepExecution) {
JobParametersBuilder builder = new JobParametersBuilder();
JobParameters jobParameters = stepExecution.getJobParameters();
JobParameters jobParameters = stepExecution.getJobExecution().getJobParameters();
ExecutionContext executionContext = stepExecution.getExecutionContext();
if (useAllParentParameters) {
for (JobParameter<?> jobParameter : jobParameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon

if (stoppable) {
JobExecution jobExecution = jobRepository
.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecutionId());
.getJobExecution(chunkContext.getStepContext().getStepExecution().getJobExecution().getId());

if (jobExecution.isStopping()) {
stopped = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void assertStepExecutionsAreEqual(StepExecution expected, StepExecution
assertEquals(expected.getExitStatus(), actual.getExitStatus());
assertTemporalEquals(expected.getLastUpdated(), actual.getLastUpdated());
assertEquals(expected.getExitStatus(), actual.getExitStatus());
assertEquals(expected.getJobExecutionId(), actual.getJobExecutionId());
assertEquals(expected.getJobExecution().getId(), actual.getJobExecution().getId());
assertTemporalEquals(expected.getCreateTime(), actual.getCreateTime());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ChunkTaskExecutorItemWriter(ChunkProcessor<T> chunkRequestProcessor, Task

@Override
public void write(Chunk<? extends T> chunk) {
ChunkRequest<T> request = new ChunkRequest<>(++sequence, chunk, this.stepExecution.getJobExecutionId(),
ChunkRequest<T> request = new ChunkRequest<>(++sequence, chunk, this.stepExecution.getJobExecution().getId(),
this.stepExecution.createStepContribution());
FutureTask<ChunkResponse> chunkResponseFutureTask = new FutureTask<>(
() -> this.chunkProcessorChunkHandler.handle(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private Set<StepExecution> pollReplies(StepExecution managerStepExecution, final
Set<Long> partitionStepExecutionIds = split.stream().map(StepExecution::getId).collect(Collectors.toSet());

Callable<Set<StepExecution>> callback = () -> {
JobExecution jobExecution = jobRepository.getJobExecution(managerStepExecution.getJobExecutionId());
JobExecution jobExecution = jobRepository.getJobExecution(managerStepExecution.getJobExecution().getId());
Set<StepExecution> finishedStepExecutions = jobExecution.getStepExecutions()
.stream()
.filter(stepExecution -> partitionStepExecutionIds.contains(stepExecution.getId()))
Expand Down