IN PROGRESS - issue BATCH-340: Refactor JobRepository for greater clarity and consistency.

http://jira.springframework.org/browse/BATCH-340

removed unused getExecution(Long) method from JobExecutionDao
This commit is contained in:
robokaso
2008-02-18 12:15:08 +00:00
parent 3ddafe60e9
commit 283db955bd
3 changed files with 0 additions and 53 deletions

View File

@@ -13,7 +13,6 @@ import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.repository.NoSuchBatchDomainObjectException;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
import org.springframework.util.Assert;
@@ -51,9 +50,6 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
private static final String FIND_JOB_EXECUTIONS = "SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%JOB_EXECUTION"
+ " where JOB_INSTANCE_ID = ?";
private static final String GET_JOB_EXECUTION = "SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%JOB_EXECUTION"
+ " where JOB_EXECUTION_ID = ?";
private DataFieldMaxValueIncrementer jobExecutionIncrementer;
public List findJobExecutions(final JobInstance job) {
@@ -65,28 +61,6 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
new Object[] { job.getId() }, new JobExecutionRowMapper(job));
}
public JobExecution getJobExecution(Long jobExecutionId) {
Assert.notNull(jobExecutionId, "Job Execution id must not be null.");
List executions = getJdbcTemplate().query(getQuery(GET_JOB_EXECUTION),
new Object[] { jobExecutionId }, new JobExecutionRowMapper(null));
JobExecution jobExecution;
if (executions.size() == 1) {
jobExecution = (JobExecution) executions.get(0);
}
else if (executions.size() == 0) {
jobExecution = null;
}
else {
throw new IncorrectResultSizeDataAccessException("Only one JobExecution may exist for given id: ["
+ jobExecutionId + "]", 1, executions.size());
}
return jobExecution;
}
/**
* @see JobDao#getJobExecutionCount(JobInstance)
* @throws IllegalArgumentException if jobId is null.

View File

@@ -49,18 +49,4 @@ public interface JobExecutionDao {
*/
List findJobExecutions(JobInstance jobInstance);
/**
* Given an id, return the matching JobExecution.
*
* @param jobExecutionId - id of the execution to be returned.
* @return {@link JobExecution} matching the id.
* @throws {@link IncorrectResultSizeDataAccessException} if more than one
* execution is found for the given id.
*/
JobExecution getJobExecution(Long jobExecutionId);
// /**
// * @return return the last execution for the given instance
// */
// JobExecution getLastJobExecution(JobInstance jobInstance);
}

View File

@@ -152,19 +152,6 @@ public abstract class AbstractJobDaoTests extends
assertEquals(0, jobs.size());
}
public void testGetJobExecution(){
JobExecution tempExecution = jobExecutionDao.getJobExecution(jobExecution.getId());
assertEquals(jobExecution, tempExecution);
}
public void testJobInstanceLastExecution(){
//ensure the last execution id is being stored
JobExecution lastJobExecution = jobExecutionDao.getJobExecution(jobInstance.getLastExecution().getId());
assertEquals(lastJobExecution, jobExecution);
}
public void testUpdateJobExecution() {