use of org.xwiki.notifications.NotificationConfiguration in project xwiki-platform by xwiki.
the class NotificationEmailJob method executeJob.
@Override
protected void executeJob(JobExecutionContext jobContext) throws JobExecutionException {
NotificationConfiguration configuration = Utils.getComponent(NotificationConfiguration.class);
if (!configuration.isEnabled() || !configuration.areEmailsEnabled()) {
// do nothing
return;
}
DocumentReference schedulerJobDocument = getSchedulerJobDocument(jobContext);
BaseObjectReference emailJobObjectReference = getNotificationEmailJobObjectReference(schedulerJobDocument);
NotificationUserIterator userIterator = Utils.getComponent(NotificationUserIterator.class);
userIterator.initialize(getJobInterval(schedulerJobDocument));
NotificationEmailSender mailSender = Utils.getComponent(NotificationEmailSender.class);
mailSender.sendEmails(getPreviousFireTime(emailJobObjectReference), userIterator);
setPreviousFireTime(emailJobObjectReference);
}
Aggregations