use of org.olat.modules.reminder.SentReminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method deleteReminder.
@Test
public void deleteReminder() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-9");
Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-9a");
Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-9b");
Identity recepient3 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-9c");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder reminderToDelete = createAndSaveReminder(entry, creator, 8);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(reminderToDelete);
// send 4 reminders
reminderDao.markAsSend(reminderToDelete, recepient1, "ok");
reminderDao.markAsSend(reminderToDelete, recepient2, "error");
reminderDao.markAsSend(reminderToDelete, recepient3, "error");
reminderDao.markAsSend(reminderToDelete, recepient2, "error");
dbInstance.commitAndCloseSession();
// check
List<SentReminder> sentReminders = reminderDao.getSendReminders(reminderToDelete);
Assert.assertNotNull(sentReminders);
Assert.assertEquals(4, sentReminders.size());
reminderDao.delete(reminderToDelete);
dbInstance.commit();
// check that the reminder is missing
List<Reminder> deletedReminders = reminderDao.getReminders(entry);
Assert.assertNotNull(deletedReminders);
Assert.assertEquals(0, deletedReminders.size());
}
use of org.olat.modules.reminder.SentReminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method getSendReminders_byRepositoryEntry.
@Test
public void getSendReminders_byRepositoryEntry() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-8");
Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8a");
Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-8b");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder savedReminder = createAndSaveReminder(entry, creator, 8);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(savedReminder);
// send 3 reminders
SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient2, "error");
dbInstance.commitAndCloseSession();
// load the sent reminder log
List<SentReminder> sentReminders = reminderDao.getSendReminders(entry);
Assert.assertNotNull(sentReminders);
Assert.assertEquals(3, sentReminders.size());
Assert.assertTrue(sentReminders.contains(sentReminder1));
Assert.assertTrue(sentReminders.contains(sentReminder2));
Assert.assertTrue(sentReminders.contains(sentReminder3));
}
use of org.olat.modules.reminder.SentReminder in project OpenOLAT by OpenOLAT.
the class ReminderDAOTest method getSendReminders_byReminder.
@Test
public void getSendReminders_byReminder() {
// create and reminder and an identity
Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("creator-rem-7");
Identity recepient1 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7a");
Identity recepient2 = JunitTestHelper.createAndPersistIdentityAsRndUser("recepient-rem-7b");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Reminder savedReminder = createAndSaveReminder(entry, creator, 7);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(savedReminder);
// send 3 reminders
SentReminderImpl sentReminder1 = reminderDao.markAsSend(savedReminder, recepient1, "ok");
SentReminderImpl sentReminder2 = reminderDao.markAsSend(savedReminder, recepient2, "error");
SentReminderImpl sentReminder3 = reminderDao.markAsSend(savedReminder, recepient1, "error");
dbInstance.commitAndCloseSession();
// load the sent reminder log
List<SentReminder> sentReminders = reminderDao.getSendReminders(savedReminder);
Assert.assertNotNull(sentReminders);
Assert.assertEquals(3, sentReminders.size());
Assert.assertTrue(sentReminders.contains(sentReminder1));
Assert.assertTrue(sentReminders.contains(sentReminder2));
Assert.assertTrue(sentReminders.contains(sentReminder3));
}
use of org.olat.modules.reminder.SentReminder in project OpenOLAT by OpenOLAT.
the class CourseReminderLogsController method updateModel.
protected void updateModel() {
List<SentReminder> sentReminders = reminderService.getSentReminders(repositoryEntry);
List<SentReminderRow> rows = new ArrayList<>(sentReminders.size());
for (SentReminder sentReminder : sentReminders) {
Identity identity = sentReminder.getIdentity();
Reminder reminder = sentReminder.getReminder();
SentReminderRow row = new SentReminderRow(reminder, sentReminder, identity, userPropertyHandlers, getLocale());
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset();
tableEl.setVisible(rows.size() > 0);
}
use of org.olat.modules.reminder.SentReminder in project OpenOLAT by OpenOLAT.
the class CourseSendReminderListController method updateModel.
private void updateModel() {
List<SentReminder> sentReminders = reminderService.getSentReminders(reminder);
List<SentReminderRow> rows = new ArrayList<>(sentReminders.size());
for (SentReminder sentReminder : sentReminders) {
Identity identity = sentReminder.getIdentity();
SentReminderRow row = new SentReminderRow(reminder, sentReminder, identity, userPropertyHandlers, getLocale());
rows.add(row);
}
tableModel.setObjects(rows);
tableEl.reset();
}
Aggregations