BATCH-337:No *Instance domain objects (or their respective tables) contain a 'status'. Instead, they contain the 'last execution', which can be used to determinte the status. RestartData is also no longer necessary, as everything can be 'restored' by calling stepInstance.getLastExecution().getExecutionAttributes(). Also changed all 'ID' columns to be complete, such as 'JOB_INSTANCE_ID' rather than just 'ID'.
This commit is contained in:
@@ -124,6 +124,10 @@ public class JobExecution extends Entity {
|
||||
public JobInstance getJobInstance() {
|
||||
return jobInstance;
|
||||
}
|
||||
|
||||
public void setJobInstance(JobInstance jobInstance) {
|
||||
this.jobInstance = jobInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the step executions.
|
||||
|
||||
@@ -37,10 +37,10 @@ public class JobInstance extends Entity {
|
||||
|
||||
private Job job;
|
||||
|
||||
private BatchStatus status;
|
||||
|
||||
private int jobExecutionCount;
|
||||
|
||||
private JobExecution lastExecution;
|
||||
|
||||
public JobInstance(Long id, JobParameters jobParameters) {
|
||||
super(id);
|
||||
this.jobParameters = jobParameters==null ? new JobParameters() : jobParameters;
|
||||
@@ -51,12 +51,12 @@ public class JobInstance extends Entity {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public BatchStatus getStatus() {
|
||||
return status;
|
||||
public void setLastExecution(JobExecution lastExecution) {
|
||||
this.lastExecution = lastExecution;
|
||||
}
|
||||
|
||||
public void setStatus(BatchStatus status) {
|
||||
this.status = status;
|
||||
|
||||
public JobExecution getLastExecution() {
|
||||
return lastExecution;
|
||||
}
|
||||
|
||||
public List getStepInstances() {
|
||||
@@ -94,7 +94,9 @@ public class JobInstance extends Entity {
|
||||
}
|
||||
|
||||
public JobExecution createJobExecution() {
|
||||
return new JobExecution(this);
|
||||
JobExecution newExecution = new JobExecution(this);
|
||||
this.setLastExecution(newExecution);
|
||||
return newExecution;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -46,10 +46,8 @@ import org.springframework.batch.item.ExecutionAttributes;
|
||||
public class StepInstance extends Entity {
|
||||
|
||||
private JobInstance jobInstance;
|
||||
|
||||
private BatchStatus status;
|
||||
|
||||
private ExecutionAttributes executionAttributes = new ExecutionAttributes();
|
||||
|
||||
private StepExecution lastExecution;
|
||||
|
||||
private int stepExecutionCount = 0;
|
||||
|
||||
@@ -84,22 +82,6 @@ public class StepInstance extends Entity {
|
||||
this.stepExecutionCount = stepExecutionCount;
|
||||
}
|
||||
|
||||
public ExecutionAttributes getExecutionAttributes() {
|
||||
return executionAttributes;
|
||||
}
|
||||
|
||||
public void setExecutionAttributes(ExecutionAttributes executionAttributes) {
|
||||
this.executionAttributes = executionAttributes;
|
||||
}
|
||||
|
||||
public BatchStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(BatchStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public JobInstance getJobInstance() {
|
||||
return jobInstance;
|
||||
}
|
||||
@@ -111,10 +93,18 @@ public class StepInstance extends Entity {
|
||||
public Long getJobId() {
|
||||
return jobInstance==null ? null : jobInstance.getId();
|
||||
}
|
||||
|
||||
public void setLastExecution(StepExecution lastExecution) {
|
||||
this.lastExecution = lastExecution;
|
||||
}
|
||||
|
||||
public StepExecution getLastExecution() {
|
||||
return lastExecution;
|
||||
}
|
||||
|
||||
// @Override
|
||||
public String toString() {
|
||||
return super.toString() + ", name=" + name + ", status=" + getStatus() + " in " + jobInstance;
|
||||
return super.toString() + ", name=" + name + " in " + jobInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user