Beispiel #1
0
        /// <summary>
        /// Enhances the given job with incrementer, validator and job execution listeners, if provided.
        /// </summary>
        /// <param name="target"></param>
        protected void Enhance(IJob target)
        {
            var job = target as AbstractJob;

            if (job != null)
            {
                job.Restartable   = Properties.Restartable;
                job.JobRepository = Properties.JobRepository;

                IJobParametersIncrementer jobParametersIncrementer = Properties.JobParametersIncrementer;
                if (jobParametersIncrementer != null)
                {
                    job.JobParametersIncrementer = jobParametersIncrementer;
                }

                IJobParametersValidator jobParametersValidator = Properties.JobParametersValidator;
                if (jobParametersValidator != null)
                {
                    job.JobParametersValidator = jobParametersValidator;
                }

                List <IJobExecutionListener> listeners = Properties.JobExecutionListeners;
                if (listeners.Any())
                {
                    job.SetJobExecutionListeners(listeners.ToArray());
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Add a job parameters validator.
 /// </summary>
 /// <param name="jobParametersValidator"></param>
 /// <returns></returns>
 public JobBuilderHelper Validator(IJobParametersValidator jobParametersValidator)
 {
     Properties.JobParametersValidator = jobParametersValidator;
     return(this);
 }
 /// <summary>
 /// Add a job parameters validator.
 /// </summary>
 /// <param name="jobParametersValidator"></param>
 /// <returns></returns>
 public JobBuilderHelper Validator(IJobParametersValidator jobParametersValidator)
 {
     Properties.JobParametersValidator = jobParametersValidator;
     return this;
 }