public void processIntervalTrigger(final IntervalTriggerDetail intervalTriggerDetails) throws ParseException, SchedulerException, InternalError { Trigger schedTrigger = null; if (SECOND.equals(intervalTriggerDetails.getRepeatUnit())) { schedTrigger = TriggerUtils.makeSecondlyTrigger(intervalTriggerDetails.getRepeatInterval()); } else if (MINUTE.equals(intervalTriggerDetails.getRepeatUnit())) { schedTrigger = TriggerUtils.makeMinutelyTrigger(intervalTriggerDetails.getRepeatInterval()); } else if (HOUR.equals(intervalTriggerDetails.getRepeatUnit())) { schedTrigger = TriggerUtils.makeHourlyTrigger(intervalTriggerDetails.getRepeatInterval()); } else { throw new InternalError( "Could not work out which interval to use for the schedule of an @" + Every.class.getName() + " observer"); } schedTrigger.setJobGroup(SCHEDULE_JOB_GROUP); scheduleJob(schedTrigger, intervalTriggerDetails); }
@Override public void visit(FixedPeriodJobTrigger trigger) { switch (trigger.getTimeUnit()) { case SECOND: quartzTrigger = TriggerUtils.makeSecondlyTrigger(trigger.getTimeInterval()); break; case MINUTE: quartzTrigger = TriggerUtils.makeMinutelyTrigger(trigger.getTimeInterval()); break; case HOUR: quartzTrigger = TriggerUtils.makeHourlyTrigger(trigger.getTimeInterval()); break; } if (trigger.getStartDate() != null) { quartzTrigger.setStartTime(trigger.getStartDate()); } else { quartzTrigger.setStartTime(quartzTrigger.getFireTimeAfter(new Date())); } }