TimerSchedule timerSchedule = (TimerSchedule) schedule;
if (timerSchedule.getIntervalDuration() != null)
{
if ( timerSchedule.getExpiration()!=null )
{
SimpleTrigger trigger = new SimpleTrigger(triggerName, null,
timerSchedule.getExpiration(),
timerSchedule.getFinalExpiration(),
SimpleTrigger.REPEAT_INDEFINITELY,
timerSchedule.getIntervalDuration());
scheduler.scheduleJob( jobDetail, trigger );
}
else if ( timerSchedule.getDuration()!=null )
{
SimpleTrigger trigger = new SimpleTrigger(triggerName, null,
calculateDelayedDate(timerSchedule.getDuration()),
timerSchedule.getFinalExpiration(), SimpleTrigger.REPEAT_INDEFINITELY,
timerSchedule.getIntervalDuration());
scheduler.scheduleJob( jobDetail, trigger );
}
else
{
SimpleTrigger trigger = new SimpleTrigger(triggerName, null, new Date(),
timerSchedule.getFinalExpiration(),
SimpleTrigger.REPEAT_INDEFINITELY,
timerSchedule.getIntervalDuration());
scheduler.scheduleJob( jobDetail, trigger );
}
}
else
{
if ( schedule.getExpiration()!=null )
{
SimpleTrigger trigger = new SimpleTrigger (triggerName, null, schedule.getExpiration());
scheduler.scheduleJob(jobDetail, trigger);
}
else if ( schedule.getDuration()!=null )
{
SimpleTrigger trigger = new SimpleTrigger (triggerName, null,
calculateDelayedDate(schedule.getDuration()));
scheduler.scheduleJob(jobDetail, trigger);
}
else
{
SimpleTrigger trigger = new SimpleTrigger(triggerName, null);
scheduler.scheduleJob(jobDetail, trigger);
}
}
}