use of org.motechproject.scheduler.contract.CronSchedulableJob in project motech by motech.
the class PasswordExpirationSchedulerInternal method schedulePasswordReminderJob.
/**
* Schedules password reminder job that will be run everyday at midnight.
*/
public void schedulePasswordReminderJob() {
CronSchedulableJob job = new CronSchedulableJob(new MotechEvent(PASSWORD_EXPIRATION_CHECK_EVENT), "0 0 0 * * ? *");
schedulerService.safeScheduleJob(job);
}
use of org.motechproject.scheduler.contract.CronSchedulableJob in project motech by motech.
the class MotechSchedulerActionProxyServiceImpl method scheduleCronJob.
@Override
public void scheduleCronJob(String subject, Map<Object, Object> parameters, String cronExpression, DateTime startTime, DateTime endTime, Boolean ignorePastFiresAtStart) {
MotechEvent motechEvent = new MotechEvent(subject, createMotechEventParameters(parameters));
CronSchedulableJob job = new CronSchedulableJob(motechEvent, cronExpression, startTime, endTime, ignorePastFiresAtStart);
scheduler.scheduleJob(job);
}
use of org.motechproject.scheduler.contract.CronSchedulableJob in project motech by motech.
the class MotechSchedulerServiceImpl method scheduleDayOfWeekJob.
private void scheduleDayOfWeekJob(DayOfWeekSchedulableJob job, boolean update) {
logObjectIfNotNull(job);
validateDayOfWeekSchedulableJob(job);
MotechEvent motechEvent = job.getMotechEvent();
Time time = job.getTime();
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.atHourAndMinuteOnGivenDaysOfWeek(time.getHour(), time.getMinute(), job.getCronDays().toArray(new Integer[job.getCronDays().size()]));
CronTriggerImpl cronTrigger = (CronTriggerImpl) cronScheduleBuilder.build();
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, cronTrigger.getCronExpression(), job.getStartDate(), job.getEndDate(), job.isIgnorePastFiresAtStart(), job.isUiDefined());
scheduleCronJob(cronSchedulableJob, true, update);
}
Aggregations