當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。