use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method duplicateReminder.
@Test
public void duplicateReminder() {
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-12");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder reminderToCopy = createAndSaveReminder(entry, creator, 12);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(reminderToCopy);
Reminder duplicate = reminderDao.duplicate(reminderToCopy, creator);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(duplicate);
Assert.assertNotNull(duplicate.getKey());
ReminderImpl reloadedDuplicate = (ReminderImpl) reminderDao.loadByKey(duplicate.getKey());
Assert.assertNotNull(reloadedDuplicate);
Assert.assertEquals(creator, reloadedDuplicate.getCreator());
Assert.assertEquals(entry, reloadedDuplicate.getEntry());
Assert.assertEquals(reminderToCopy.getEmailBody(), reloadedDuplicate.getEmailBody());
Assert.assertEquals(reminderToCopy.getEmailSubject(), reloadedDuplicate.getEmailSubject());
Assert.assertTrue(reloadedDuplicate.getDescription().startsWith(reminderToCopy.getDescription()));
Assert.assertEquals(reminderToCopy.getConfiguration(), reloadedDuplicate.getConfiguration());
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method createAndPersistSendReminder.
@Test
public void createAndPersistSendReminder() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-2");
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("mind-1");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder reminder = reminderDao.createReminder(entry, creator);
reminder.setConfiguration("<rules></rules>");
reminder.setDescription("Reminder - 2");
reminder.setEmailSubject("This is a subject");
reminder.setEmailBody("Hello world");
Reminder savedReminder = reminderDao.save(reminder);
Assert.assertNotNull(savedReminder);
dbInstance.commitAndCloseSession();
// mark as sent
reminderDao.markAsSend(reminder, id, "ok");
dbInstance.commitAndCloseSession();
// reload
List<SentReminder> sentReminders = reminderDao.getSendReminders(savedReminder);
Assert.assertNotNull(sentReminders);
Assert.assertEquals(1, sentReminders.size());
SentReminder sentReminder = sentReminders.get(0);
Assert.assertNotNull(sentReminder);
Assert.assertNotNull(sentReminder.getCreationDate());
Assert.assertEquals(id, sentReminder.getIdentity());
Assert.assertEquals(savedReminder, sentReminder.getReminder());
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method markAsSend.
@Test
public void markAsSend() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-5");
Identity recepient = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-5");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder savedReminder = createAndSaveReminder(entry, creator, 5);
Assert.assertNotNull(savedReminder);
dbInstance.commitAndCloseSession();
SentReminderImpl sentReminder = reminderDao.markAsSend(savedReminder, recepient, "ok");
dbInstance.commitAndCloseSession();
Assert.assertNotNull(sentReminder);
Assert.assertNotNull(sentReminder.getKey());
Assert.assertEquals("ok", sentReminder.getStatus());
Assert.assertEquals(savedReminder, sentReminder.getReminder());
Assert.assertEquals(recepient, sentReminder.getIdentity());
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class CourseReminderListController method doDelete.
private void doDelete(ReminderRow row) {
Reminder reminder = reminderManager.loadByKey(row.getKey());
reminderManager.delete(reminder);
updateModel();
}
use of org.olat.modules.reminder.Reminder in project OpenOLAT by OpenOLAT.
the class CourseReminderListController method doSendReminderList.
private void doSendReminderList(UserRequest ureq, Long reminderKey) {
removeAsListenerAndDispose(sendReminderListCtrl);
OLATResourceable ores = OresHelper.createOLATResourceableInstance("SentReminders", reminderKey);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
Reminder reminder = reminderManager.loadByKey(reminderKey);
sendReminderListCtrl = new CourseSendReminderListController(ureq, bwControl, reminder);
listenTo(sendReminderListCtrl);
addToHistory(ureq, sendReminderListCtrl);
toolbarPanel.pushController(translate("send.reminder"), sendReminderListCtrl);
}
Aggregations