Skip to content
This repository was archived by the owner on Mar 29, 2019. It is now read-only.

Commit eeeee7a

Browse files
committed
Revert filtering StepExecutions by step name
As part of BATCHADM-177, a filter was added to remove all step executions that are not directly part of the job execution (aka the partition step executions). This commit reverts that filter as it was too aggressive of an approach. BATCHADM-194
1 parent 8b72b4f commit eeeee7a

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

spring-batch-admin-manager/src/main/java/org/springframework/batch/admin/web/JobExecutionController.java

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -319,25 +319,29 @@ public String detail(Model model, @PathVariable Long jobExecutionId, @ModelAttri
319319
JobExecution jobExecution = jobService.getJobExecution(jobExecutionId);
320320
model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
321321
String jobName = jobExecution.getJobInstance().getJobName();
322-
Collection<String> stepNames = new HashSet<String>(jobService.getStepNamesForJob(jobName));
323-
Collection<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecution.getStepExecutions());
322+
// Collection<String> stepNames = new HashSet<String>(jobService.getStepNamesForJob(jobName));
323+
// Collection<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecution.getStepExecutions());
324324
List<StepExecutionInfo> stepExecutionInfos = new ArrayList<StepExecutionInfo>();
325325

326-
for (String name : stepNames) {
327-
boolean found = false;
328-
for (Iterator<StepExecution> iterator = stepExecutions.iterator(); iterator.hasNext();) {
329-
StepExecution stepExecution = iterator.next();
330-
if (stepExecution.getStepName().equals(name)) {
331-
stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
332-
iterator.remove();
333-
found = true;
334-
}
335-
}
336-
if (!found) {
337-
stepExecutionInfos.add(new StepExecutionInfo(jobName, jobExecutionId, name, timeZone));
338-
}
326+
for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
327+
stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
339328
}
340329

330+
// for (String name : stepNames) {
331+
// boolean found = false;
332+
// for (Iterator<StepExecution> iterator = stepExecutions.iterator(); iterator.hasNext();) {
333+
// StepExecution stepExecution = iterator.next();
334+
// if (stepExecution.getStepName().equals(name)) {
335+
// stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
336+
// iterator.remove();
337+
// found = true;
338+
// }
339+
// }
340+
// if (!found) {
341+
// stepExecutionInfos.add(new StepExecutionInfo(jobName, jobExecutionId, name, timeZone));
342+
// }
343+
// }
344+
341345
Collections.sort(stepExecutionInfos, new Comparator<StepExecutionInfo>() {
342346
@Override
343347
public int compare(StepExecutionInfo o1, StepExecutionInfo o2) {
@@ -351,10 +355,10 @@ public int compare(StepExecutionInfo o1, StepExecutionInfo o2) {
351355
errors.reject("no.such.job.execution", new Object[] { jobExecutionId }, "There is no such job execution ("
352356
+ jobExecutionId + ")");
353357
}
354-
catch (NoSuchJobException e) {
355-
errors.reject("no.such.job", new Object[] { jobExecutionId }, "There is no such job with exeuction id ("
356-
+ jobExecutionId + ")");
357-
}
358+
// catch (NoSuchJobException e) {
359+
// errors.reject("no.such.job", new Object[] { jobExecutionId }, "There is no such job with exeuction id ("
360+
// + jobExecutionId + ")");
361+
// }
358362

359363
return "jobs/execution";
360364

spring-batch-admin-manager/src/test/java/org/springframework/batch/admin/web/JobExecutionControllerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void testDetailSunnyDay() throws Exception {
8989
MetaDataInstanceFactory.createStepExecution(jobExecution,"foo", 111L);
9090
MetaDataInstanceFactory.createStepExecution(jobExecution, "bar", 222L);
9191
when(jobService.getJobExecution(123L)).thenReturn(jobExecution);
92-
when(jobService.getStepNamesForJob("job")).thenReturn(Arrays.asList("foo", "bar"));
92+
// when(jobService.getStepNamesForJob("job")).thenReturn(Arrays.asList("foo", "bar"));
9393

9494
ExtendedModelMap model = new ExtendedModelMap();
9595
String result = controller.detail(model, 123L, null, null);

0 commit comments

Comments
 (0)