.withIdentity("Job" + i, Scheduler.DEFAULT_GROUP)
.withDescription(description)
.requestRecovery(recoverable)
.storeDurably(durable)
.build();
final TriggerBuilder tb = TriggerBuilder.newTrigger()
.forJob(detail)
.withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP)
.withDescription(description);
if (startTime != null) {
tb.startAt(parse(startTime));
}
if (endTime != null) {
tb.endAt(parse(endTime));
}
if (calendarName != null) {
tb.modifiedByCalendar(calendarName);
}
final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression());
if (timeZone != null) {
csb.inTimeZone(TimeZone.getTimeZone(timeZone));
}
trigger = tb.withSchedule(csb).build();
try {
((CronTriggerImpl) trigger).validate();
} catch (final SchedulerException e) {
throw new InvalidPropertyException(e);