org.springframework.batch.core.launch.support.ScheduledJobParametersFactory Maven / Gradle / Ivy
/*
* Copyright 2006-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.launch.support;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.springframework.batch.core.JobParameter;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.converter.JobParametersConverter;
import org.springframework.lang.Nullable;
/**
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
* @deprecated as of v4.3 in favor of
* {@link org.springframework.batch.core.converter.DefaultJobParametersConverter}
* and scheduled for removal in v5.0.
*/
@Deprecated
public class ScheduledJobParametersFactory implements JobParametersConverter {
public static final String SCHEDULE_DATE_KEY = "schedule.date";
private DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
/*
* (non-Javadoc)
*
* @see org.springframework.batch.core.runtime.JobParametersFactory#getJobParameters(java.util.Properties)
*/
@Override
public JobParameters getJobParameters(@Nullable Properties props) {
if (props == null || props.isEmpty()) {
return new JobParameters();
}
JobParametersBuilder propertiesBuilder = new JobParametersBuilder();
for (Entry