try {
quartzTrigger =
new CronTrigger( jobId.toString(), jobId.getUserName(), jobTrigger.getCronString() != null ? jobTrigger
.getCronString() : QuartzCronStringFactory.createCronString( (ComplexJobTrigger) jobTrigger ) );
} catch ( ParseException e ) {
throw new SchedulerException( Messages.getInstance().getString(
"QuartzScheduler.ERROR_0001_FAILED_TO_SCHEDULE_JOB", jobId.getJobName() ), e ); //$NON-NLS-1$
}
} else if ( jobTrigger instanceof SimpleJobTrigger ) {
SimpleJobTrigger simpleTrigger = (SimpleJobTrigger) jobTrigger;
long interval = simpleTrigger.getRepeatInterval();
if ( interval > 0 ) {
interval *= 1000;
}
int repeatCount =
simpleTrigger.getRepeatCount() < 0 ? SimpleTrigger.REPEAT_INDEFINITELY : simpleTrigger.getRepeatCount();
quartzTrigger =
new SimpleTrigger( jobId.toString(), jobId.getUserName(), simpleTrigger.getStartTime(), simpleTrigger
.getEndTime(), repeatCount, interval );
} else {
throw new SchedulerException( Messages.getInstance().getString( "QuartzScheduler.ERROR_0002_TRIGGER_WRONG_TYPE" ) ); //$NON-NLS-1$
}
if ( quartzTrigger instanceof SimpleTrigger ) {
quartzTrigger.setMisfireInstruction( SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT );
} else {
quartzTrigger.setMisfireInstruction( SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW );