IN PROGRESS - issue BATCH-340: Refactor JobRepository for greater clarity and consistency.
http://jira.springframework.org/browse/BATCH-340 JobInstance now has not-null Job as required constructor argument - repository no longer requires a separate Job setter
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,14 +38,11 @@ public class JobInstance extends Entity {
|
||||
private int jobExecutionCount;
|
||||
|
||||
private JobExecution lastExecution;
|
||||
|
||||
public JobInstance(Long id, JobParameters jobParameters) {
|
||||
super(id);
|
||||
this.jobParameters = jobParameters==null ? new JobParameters() : jobParameters;
|
||||
}
|
||||
|
||||
public JobInstance(Long id, JobParameters jobParameters, Job job){
|
||||
this(id, jobParameters);
|
||||
super(id);
|
||||
Assert.notNull(job);
|
||||
this.jobParameters = jobParameters==null ? new JobParameters() : jobParameters;
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
@@ -92,7 +91,4 @@ public class JobInstance extends Entity {
|
||||
return job;
|
||||
}
|
||||
|
||||
public void setJob(Job job) {
|
||||
this.job = job;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user