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

Commit

Permalink
Revert filtering StepExecutions by step name
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mminella committed Jan 5, 2015
1 parent 8b72b4f commit eeeee7a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,25 +319,29 @@ public String detail(Model model, @PathVariable Long jobExecutionId, @ModelAttri
JobExecution jobExecution = jobService.getJobExecution(jobExecutionId);
model.addAttribute(new JobExecutionInfo(jobExecution, timeZone));
String jobName = jobExecution.getJobInstance().getJobName();
Collection<String> stepNames = new HashSet<String>(jobService.getStepNamesForJob(jobName));
Collection<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecution.getStepExecutions());
// Collection<String> stepNames = new HashSet<String>(jobService.getStepNamesForJob(jobName));
// Collection<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecution.getStepExecutions());
List<StepExecutionInfo> stepExecutionInfos = new ArrayList<StepExecutionInfo>();

for (String name : stepNames) {
boolean found = false;
for (Iterator<StepExecution> iterator = stepExecutions.iterator(); iterator.hasNext();) {
StepExecution stepExecution = iterator.next();
if (stepExecution.getStepName().equals(name)) {
stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
iterator.remove();
found = true;
}
}
if (!found) {
stepExecutionInfos.add(new StepExecutionInfo(jobName, jobExecutionId, name, timeZone));
}
for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
}

// for (String name : stepNames) {
// boolean found = false;
// for (Iterator<StepExecution> iterator = stepExecutions.iterator(); iterator.hasNext();) {
// StepExecution stepExecution = iterator.next();
// if (stepExecution.getStepName().equals(name)) {
// stepExecutionInfos.add(new StepExecutionInfo(stepExecution, timeZone));
// iterator.remove();
// found = true;
// }
// }
// if (!found) {
// stepExecutionInfos.add(new StepExecutionInfo(jobName, jobExecutionId, name, timeZone));
// }
// }

Collections.sort(stepExecutionInfos, new Comparator<StepExecutionInfo>() {
@Override
public int compare(StepExecutionInfo o1, StepExecutionInfo o2) {
Expand All @@ -351,10 +355,10 @@ public int compare(StepExecutionInfo o1, StepExecutionInfo o2) {
errors.reject("no.such.job.execution", new Object[] { jobExecutionId }, "There is no such job execution ("
+ jobExecutionId + ")");
}
catch (NoSuchJobException e) {
errors.reject("no.such.job", new Object[] { jobExecutionId }, "There is no such job with exeuction id ("
+ jobExecutionId + ")");
}
// catch (NoSuchJobException e) {
// errors.reject("no.such.job", new Object[] { jobExecutionId }, "There is no such job with exeuction id ("
// + jobExecutionId + ")");
// }

return "jobs/execution";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void testDetailSunnyDay() throws Exception {
MetaDataInstanceFactory.createStepExecution(jobExecution,"foo", 111L);
MetaDataInstanceFactory.createStepExecution(jobExecution, "bar", 222L);
when(jobService.getJobExecution(123L)).thenReturn(jobExecution);
when(jobService.getStepNamesForJob("job")).thenReturn(Arrays.asList("foo", "bar"));
// when(jobService.getStepNamesForJob("job")).thenReturn(Arrays.asList("foo", "bar"));

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

0 comments on commit eeeee7a

Please sign in to comment.