IN PROGRESS - BATCH-571: Remove reference to Step from StepExecution
step reference replaced with stepName string
This commit is contained in:
@@ -142,7 +142,7 @@ public class JobExecution extends Entity {
|
||||
* Register a step execution with the current job execution.
|
||||
*/
|
||||
public StepExecution createStepExecution(Step step) {
|
||||
StepExecution stepExecution = new StepExecution(step, this, null);
|
||||
StepExecution stepExecution = new StepExecution(step.getName(), this, null);
|
||||
this.stepExecutions.add(stepExecution);
|
||||
return stepExecution;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class StepExecution extends Entity {
|
||||
|
||||
private JobExecution jobExecution;
|
||||
|
||||
private Step step;
|
||||
private String stepName;
|
||||
|
||||
private BatchStatus status = BatchStatus.STARTING;
|
||||
|
||||
@@ -69,25 +69,25 @@ public class StepExecution extends Entity {
|
||||
/**
|
||||
* Constructor with mandatory properties.
|
||||
*
|
||||
* @param step the step to which this execution belongs
|
||||
* @param stepName the step to which this execution belongs
|
||||
* @param jobExecution the current job execution
|
||||
* @param id the id of this execution
|
||||
*/
|
||||
public StepExecution(Step step, JobExecution jobExecution, Long id) {
|
||||
public StepExecution(String stepName, JobExecution jobExecution, Long id) {
|
||||
super(id);
|
||||
Assert.notNull(step);
|
||||
this.step = step;
|
||||
Assert.hasLength(stepName);
|
||||
this.stepName = stepName;
|
||||
this.jobExecution = jobExecution;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that substitutes in null for the execution id
|
||||
*
|
||||
* @param step the step to which this execution belongs
|
||||
* @param stepName the step to which this execution belongs
|
||||
* @param jobExecution the current job execution
|
||||
*/
|
||||
public StepExecution(Step step, JobExecution jobExecution) {
|
||||
this(step, jobExecution, null);
|
||||
public StepExecution(String stepName, JobExecution jobExecution) {
|
||||
this(stepName, jobExecution, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +211,7 @@ public class StepExecution extends Entity {
|
||||
* @return the name of the step
|
||||
*/
|
||||
public String getStepName() {
|
||||
return step.getName();
|
||||
return stepName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,17 +232,14 @@ public class StepExecution extends Entity {
|
||||
* @see org.springframework.batch.container.common.domain.Entity#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
// TODO make sure the equality makes sense
|
||||
|
||||
Object jobExecutionId = getJobExecutionId();
|
||||
if (step == null && jobExecutionId == null || !(obj instanceof StepExecution) || getId() == null) {
|
||||
if (jobExecutionId == null || !(obj instanceof StepExecution) || getId() == null) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
StepExecution other = (StepExecution) obj;
|
||||
if (step == null) {
|
||||
return jobExecutionId.equals(other.getJobExecutionId());
|
||||
}
|
||||
return step.getName().equals(other.getStepName())
|
||||
&& (jobExecutionId == null || jobExecutionId.equals(other.getJobExecutionId()));
|
||||
|
||||
return stepName.equals(other.getStepName()) && (jobExecutionId.equals(other.getJobExecutionId()));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -252,12 +249,12 @@ public class StepExecution extends Entity {
|
||||
*/
|
||||
public int hashCode() {
|
||||
Object jobExecutionId = getJobExecutionId();
|
||||
return super.hashCode() + 31 * (step.getName() != null ? step.getName().hashCode() : 0) + 91
|
||||
return super.hashCode() + 31 * (stepName != null ? stepName.hashCode() : 0) + 91
|
||||
* (jobExecutionId != null ? jobExecutionId.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString() + ", name=" + step.getName() + ", itemCount=" + itemCount + ", commitCount="
|
||||
return super.toString() + ", name=" + stepName + ", itemCount=" + itemCount + ", commitCount="
|
||||
+ commitCount + ", rollbackCount=" + rollbackCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
|
||||
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
|
||||
StepExecution stepExecution = new StepExecution(step, jobExecution, new Long(rs.getLong(1)));
|
||||
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution, new Long(rs.getLong(1)));
|
||||
stepExecution.setStartTime(rs.getTimestamp(3));
|
||||
stepExecution.setEndTime(rs.getTimestamp(4));
|
||||
stepExecution.setStatus(BatchStatus.getStatus(rs.getString(5)));
|
||||
|
||||
Reference in New Issue
Block a user