当前位置: 首页>>代码示例>>Java>>正文


Java PropertiesConverter类代码示例

本文整理汇总了Java中org.springframework.batch.support.PropertiesConverter的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConverter类的具体用法?Java PropertiesConverter怎么用?Java PropertiesConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertiesConverter类属于org.springframework.batch.support包,在下文中一共展示了PropertiesConverter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJobParametersWithIncrementerIfAvailable

import org.springframework.batch.support.PropertiesConverter; //导入依赖的package包/类
private JobParameters createJobParametersWithIncrementerIfAvailable(String parameters, Job job) throws JobParametersNotFoundException {
	JobParameters jobParameters = jobParametersConverter.getJobParameters(PropertiesConverter.stringToProperties(parameters));
	// use JobParametersIncrementer to create JobParameters if incrementer is set and only if the job is no restart
	if (job.getJobParametersIncrementer() != null){
		JobExecution lastJobExecution = jobRepository.getLastJobExecution(job.getName(), jobParameters);
		boolean restart = false;
		// check if job failed before
		if (lastJobExecution != null) {
			BatchStatus status = lastJobExecution.getStatus();
			if (status.isUnsuccessful() && status != BatchStatus.ABANDONED) {
				restart = true;
			}
		}
		// if it's not a restart, create new JobParameters with the incrementer
		if (!restart) {
			JobParameters nextParameters = getNextJobParameters(job);
			Map<String, JobParameter> map = new HashMap<String, JobParameter>(nextParameters.getParameters());
			map.putAll(jobParameters.getParameters());
			jobParameters = new JobParameters(map);
		}
	}
	return jobParameters;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:24,代码来源:JobOperationsController.java

示例2: fromJobParameters

import org.springframework.batch.support.PropertiesConverter; //导入依赖的package包/类
/**
 * @param oldParameters the latest job parameters
 * @return a String representation for rendering the job parameters from the last
 * instance
 */
private String fromJobParameters(JobParameters oldParameters) {

	String properties = PropertiesConverter.propertiesToString(converter.getProperties(oldParameters));
	if (properties.startsWith("#")) {
		properties = properties.substring(properties.indexOf(LINE_SEPARATOR) + LINE_SEPARATOR.length());
	}
	properties = properties.replace("\\:", ":");
	return properties;

}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:16,代码来源:JobExecutionResource.java

示例3: extractJobDataMap

import org.springframework.batch.support.PropertiesConverter; //导入依赖的package包/类
/**
 * <p>
 * Returns a map with the job parameters
 * </p>
 *
 * @param jobName
 * @param params
 * @return Map<String, Object>
 */
public static Map<String, Object> extractJobDataMap(String jobName, String params) {
    Map<String, Object> jobDataMap = new HashMap<String, Object>();
    // Adding the job name
    jobDataMap.put(Constants.JOB_NAME, jobName);

    Properties properties = PropertiesConverter.stringToProperties(params);
    for (String propertyName : properties.stringPropertyNames()) {
        jobDataMap.put(propertyName, properties.getProperty(propertyName));
    }

    return jobDataMap;
}
 
开发者ID:smuralee,项目名称:spring-batch-quartz-admin,代码行数:22,代码来源:Util.java


注:本文中的org.springframework.batch.support.PropertiesConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。