Search in sources :

Example 1 with ReminderModule

use of org.olat.modules.reminder.ReminderModule in project OpenOLAT by OpenOLAT.

the class ReminderJob method executeWithDB.

@Override
public void executeWithDB(JobExecutionContext context) throws JobExecutionException {
    ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
    if (reminderModule.isEnabled()) {
        ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
        reminderService.remindAll();
    }
}
Also used : ReminderService(org.olat.modules.reminder.ReminderService) ReminderModule(org.olat.modules.reminder.ReminderModule)

Example 2 with ReminderModule

use of org.olat.modules.reminder.ReminderModule in project OpenOLAT by OpenOLAT.

the class CourseHandler method cloneReminders.

private void cloneReminders(Identity author, CourseEnvironmentMapper envMapper, RepositoryEntry source, RepositoryEntry target) {
    ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
    ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
    List<Reminder> reminders = reminderService.getReminders(source);
    for (Reminder reminder : reminders) {
        String configuration = reminder.getConfiguration();
        ReminderRules rules = reminderService.toRules(configuration);
        ReminderRules clonedRules = new ReminderRules();
        for (ReminderRule rule : rules.getRules()) {
            RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
            if (ruleSpi != null) {
                ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
                if (clonedRule != null)
                    clonedRules.getRules().add(clonedRule);
            }
        }
        Reminder clonedReminder = reminderService.createReminder(target, author);
        clonedReminder.setDescription(reminder.getDescription());
        clonedReminder.setEmailSubject(reminder.getEmailSubject());
        clonedReminder.setEmailBody(reminder.getEmailBody());
        clonedReminder.setConfiguration(reminderService.toXML(clonedRules));
        reminderService.save(clonedReminder);
    }
}
Also used : ReminderRule(org.olat.modules.reminder.ReminderRule) Reminder(org.olat.modules.reminder.Reminder) ReminderService(org.olat.modules.reminder.ReminderService) ReminderRules(org.olat.modules.reminder.model.ReminderRules) RuleSPI(org.olat.modules.reminder.RuleSPI) ReminderModule(org.olat.modules.reminder.ReminderModule)

Example 3 with ReminderModule

use of org.olat.modules.reminder.ReminderModule in project OpenOLAT by OpenOLAT.

the class CourseHandler method importReminders.

private void importReminders(RepositoryEntry re, File fImportBaseDirectory, CourseEnvironmentMapper envMapper, Identity initialAuthor) {
    ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
    ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
    List<Reminder> reminders = reminderService.importRawReminders(initialAuthor, re, fImportBaseDirectory);
    if (reminders.size() > 0) {
        for (Reminder reminder : reminders) {
            ReminderRules clonedRules = new ReminderRules();
            String configuration = reminder.getConfiguration();
            ReminderRules rules = reminderService.toRules(configuration);
            for (ReminderRule rule : rules.getRules()) {
                RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
                if (ruleSpi != null) {
                    ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
                    clonedRules.getRules().add(clonedRule);
                }
            }
            String convertedConfiguration = reminderService.toXML(clonedRules);
            reminder.setConfiguration(convertedConfiguration);
            reminderService.save(reminder);
        }
    }
}
Also used : ReminderRule(org.olat.modules.reminder.ReminderRule) Reminder(org.olat.modules.reminder.Reminder) ReminderService(org.olat.modules.reminder.ReminderService) ReminderRules(org.olat.modules.reminder.model.ReminderRules) RuleSPI(org.olat.modules.reminder.RuleSPI) ReminderModule(org.olat.modules.reminder.ReminderModule)

Example 4 with ReminderModule

use of org.olat.modules.reminder.ReminderModule in project openolat by klemens.

the class CourseHandler method cloneReminders.

private void cloneReminders(Identity author, CourseEnvironmentMapper envMapper, RepositoryEntry source, RepositoryEntry target) {
    ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
    ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
    List<Reminder> reminders = reminderService.getReminders(source);
    for (Reminder reminder : reminders) {
        String configuration = reminder.getConfiguration();
        ReminderRules rules = reminderService.toRules(configuration);
        ReminderRules clonedRules = new ReminderRules();
        for (ReminderRule rule : rules.getRules()) {
            RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
            if (ruleSpi != null) {
                ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
                if (clonedRule != null)
                    clonedRules.getRules().add(clonedRule);
            }
        }
        Reminder clonedReminder = reminderService.createReminder(target, author);
        clonedReminder.setDescription(reminder.getDescription());
        clonedReminder.setEmailSubject(reminder.getEmailSubject());
        clonedReminder.setEmailBody(reminder.getEmailBody());
        clonedReminder.setConfiguration(reminderService.toXML(clonedRules));
        reminderService.save(clonedReminder);
    }
}
Also used : ReminderRule(org.olat.modules.reminder.ReminderRule) Reminder(org.olat.modules.reminder.Reminder) ReminderService(org.olat.modules.reminder.ReminderService) ReminderRules(org.olat.modules.reminder.model.ReminderRules) RuleSPI(org.olat.modules.reminder.RuleSPI) ReminderModule(org.olat.modules.reminder.ReminderModule)

Example 5 with ReminderModule

use of org.olat.modules.reminder.ReminderModule in project openolat by klemens.

the class CourseHandler method importReminders.

private void importReminders(RepositoryEntry re, File fImportBaseDirectory, CourseEnvironmentMapper envMapper, Identity initialAuthor) {
    ReminderModule reminderModule = CoreSpringFactory.getImpl(ReminderModule.class);
    ReminderService reminderService = CoreSpringFactory.getImpl(ReminderService.class);
    List<Reminder> reminders = reminderService.importRawReminders(initialAuthor, re, fImportBaseDirectory);
    if (reminders.size() > 0) {
        for (Reminder reminder : reminders) {
            ReminderRules clonedRules = new ReminderRules();
            String configuration = reminder.getConfiguration();
            ReminderRules rules = reminderService.toRules(configuration);
            for (ReminderRule rule : rules.getRules()) {
                RuleSPI ruleSpi = reminderModule.getRuleSPIByType(rule.getType());
                if (ruleSpi != null) {
                    ReminderRule clonedRule = ruleSpi.clone(rule, envMapper);
                    clonedRules.getRules().add(clonedRule);
                }
            }
            String convertedConfiguration = reminderService.toXML(clonedRules);
            reminder.setConfiguration(convertedConfiguration);
            reminderService.save(reminder);
        }
    }
}
Also used : ReminderRule(org.olat.modules.reminder.ReminderRule) Reminder(org.olat.modules.reminder.Reminder) ReminderService(org.olat.modules.reminder.ReminderService) ReminderRules(org.olat.modules.reminder.model.ReminderRules) RuleSPI(org.olat.modules.reminder.RuleSPI) ReminderModule(org.olat.modules.reminder.ReminderModule)

Aggregations

ReminderModule (org.olat.modules.reminder.ReminderModule)6 ReminderService (org.olat.modules.reminder.ReminderService)6 Reminder (org.olat.modules.reminder.Reminder)4 ReminderRule (org.olat.modules.reminder.ReminderRule)4 RuleSPI (org.olat.modules.reminder.RuleSPI)4 ReminderRules (org.olat.modules.reminder.model.ReminderRules)4