use of org.olat.modules.reminder.model.ImportExportReminders in project OpenOLAT by OpenOLAT.
the class ReminderServiceImpl method exportReminders.
@Override
public void exportReminders(RepositoryEntry entry, File fExportedDataDir) {
List<Reminder> reminders = reminderDao.getReminders(entry);
if (reminders.size() > 0) {
try (OutputStream fOut = new FileOutputStream(new File(fExportedDataDir, REMINDERS_XML))) {
ImportExportReminders exportReminders = new ImportExportReminders();
for (Reminder reminder : reminders) {
ImportExportReminder exportReminder = new ImportExportReminder(reminder);
exportReminders.getReminders().add(exportReminder);
}
ruleXStream.toXML(exportReminders, fOut);
} catch (Exception e) {
log.error("", e);
}
}
}
use of org.olat.modules.reminder.model.ImportExportReminders in project OpenOLAT by OpenOLAT.
the class ReminderServiceImpl method importRawReminders.
@Override
public List<Reminder> importRawReminders(Identity creator, RepositoryEntry newEntry, File fExportedDataDir) {
File reminderFile = new File(fExportedDataDir, REMINDERS_XML);
List<Reminder> reminders = new ArrayList<>();
if (reminderFile.exists()) {
try (InputStream in = new FileInputStream(reminderFile)) {
ImportExportReminders importReminders = (ImportExportReminders) ruleXStream.fromXML(in);
List<ImportExportReminder> importReminderList = importReminders.getReminders();
for (ImportExportReminder importReminder : importReminderList) {
Reminder reminder = reminderDao.createReminder(newEntry, creator);
reminder.setDescription(importReminder.getDescription());
reminder.setEmailBody(importReminder.getEmailBody());
reminder.setEmailSubject(importReminder.getEmailSubject() == null ? importReminder.getDescription() : importReminder.getEmailSubject());
reminder.setConfiguration(importReminder.getConfiguration());
reminders.add(reminder);
}
} catch (Exception e) {
log.error("", e);
}
}
return reminders;
}
use of org.olat.modules.reminder.model.ImportExportReminders in project openolat by klemens.
the class ReminderServiceImpl method exportReminders.
@Override
public void exportReminders(RepositoryEntry entry, File fExportedDataDir) {
List<Reminder> reminders = reminderDao.getReminders(entry);
if (reminders.size() > 0) {
try (OutputStream fOut = new FileOutputStream(new File(fExportedDataDir, REMINDERS_XML))) {
ImportExportReminders exportReminders = new ImportExportReminders();
for (Reminder reminder : reminders) {
ImportExportReminder exportReminder = new ImportExportReminder(reminder);
exportReminders.getReminders().add(exportReminder);
}
ruleXStream.toXML(exportReminders, fOut);
} catch (Exception e) {
log.error("", e);
}
}
}
use of org.olat.modules.reminder.model.ImportExportReminders in project openolat by klemens.
the class ReminderServiceImpl method importRawReminders.
@Override
public List<Reminder> importRawReminders(Identity creator, RepositoryEntry newEntry, File fExportedDataDir) {
File reminderFile = new File(fExportedDataDir, REMINDERS_XML);
List<Reminder> reminders = new ArrayList<>();
if (reminderFile.exists()) {
try (InputStream in = new FileInputStream(reminderFile)) {
ImportExportReminders importReminders = (ImportExportReminders) ruleXStream.fromXML(in);
List<ImportExportReminder> importReminderList = importReminders.getReminders();
for (ImportExportReminder importReminder : importReminderList) {
Reminder reminder = reminderDao.createReminder(newEntry, creator);
reminder.setDescription(importReminder.getDescription());
reminder.setEmailBody(importReminder.getEmailBody());
reminder.setEmailSubject(importReminder.getEmailSubject() == null ? importReminder.getDescription() : importReminder.getEmailSubject());
reminder.setConfiguration(importReminder.getConfiguration());
reminders.add(reminder);
}
} catch (Exception e) {
log.error("", e);
}
}
return reminders;
}
Aggregations