本文整理汇总了Java中org.springframework.batch.core.JobInstance.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Java JobInstance.setVersion方法的具体用法?Java JobInstance.setVersion怎么用?Java JobInstance.setVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.batch.core.JobInstance
的用法示例。
在下文中一共展示了JobInstance.setVersion方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJobInstance
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
/**
* @param jobId
* Set the job id
* @param jobName
* Set the job name
* @param authorityName
* Set the authority name
* @param version
* Set the version
*/
public void createJobInstance(String jobId,
String jobName, String authorityName,
String version) {
enableAuthentication();
Long id = null;
if (jobId != null && jobId.length() > 0) {
id = Long.parseLong(jobId);
}
Integer v = null;
if (version != null && version.length() > 0) {
v = Integer.parseInt(version);
}
Map<String, JobParameter> jobParameterMap = new HashMap<String, JobParameter>();
if (authorityName != null && authorityName.length() > 0) {
jobParameterMap.put("authority.name", new JobParameter(
authorityName));
}
JobParameters jobParameters = new JobParameters(jobParameterMap);
JobInstance jobInstance = new JobInstance(id, jobParameters, jobName);
jobInstance.setVersion(v);
data.push(jobInstance);
jobInstanceService.save(jobInstance);
disableAuthentication();
}
示例2: testWriteJobInstance
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
/**
*
* @throws Exception
* if there is a problem serializing the object
*/
@Test
public void testWriteJobInstance() throws Exception {
Map<String, JobParameter> jobParameterMap
= new HashMap<String, JobParameter>();
jobParameterMap.put("authority.name", new JobParameter("test"));
JobInstance jobInstance = new JobInstance(1L, new JobParameters(
jobParameterMap), "testJob");
jobInstance.setVersion(1);
try {
objectMapper.writeValueAsString(jobInstance);
} catch (Exception e) {
fail("No exception expected here");
}
}
示例3: mapRow
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
/**
* @param resultSet
* Set the result set
* @param rowNumber
* Set the row number
* @throws SQLException
* if there is a problem
* @return a job execution instance
*/
public final JobInstance mapRow(final ResultSet resultSet,
final int rowNumber) throws SQLException {
JobInstance jobInstance = new JobInstance(resultSet.getBigDecimal(
"JOB_INSTANCE_ID").longValue(), jobParameters,
resultSet.getString("JOB_NAME"));
BigDecimal version = resultSet.getBigDecimal("VERSION");
if (version != null) {
jobInstance.setVersion(version.intValue());
}
return jobInstance;
}
示例4: testJobExecution
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
/**
*
*/
@Test
public final void testJobExecution() {
Map<String, JobParameter> jobParametersMap = new HashMap<String, JobParameter>();
jobParametersMap.put("authority.name", new JobParameter("test"));
JobInstance jobInstance = new JobInstance(1L, new JobParameters(
jobParametersMap), "testJob");
jobInstance.setVersion(1);
jobInstanceDao.save(jobInstance);
JobExecution jobExecution = new JobExecution(jobInstance, 1L);
jobExecution.setCreateTime(new Date());
jobExecutionDao.save(jobExecution);
jobExecutionDao.delete(1L);
jobInstanceDao.delete(1L);
}
示例5: AdaptedJobInstance
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
public AdaptedJobInstance(JobInstance jobInstance) {
this.id = jobInstance.getId();
if (jobInstance.getVersion() == null) {
jobInstance.setVersion(0);
} else {
this.setVersion(jobInstance.getVersion());
}
this.jobName = jobInstance.getJobName();
}
示例6: unmarshal
import org.springframework.batch.core.JobInstance; //导入方法依赖的package包/类
@Override
public JobInstance unmarshal(AdaptedJobInstance v) throws Exception {
JobInstance jobInstance = new JobInstance(v.getId(), v.getJobName());
jobInstance.setVersion(v.getVersion());
return jobInstance;
}