From c8436459c32dd93122c797b41abd89a64dc1a37e Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Mon, 19 Aug 2019 17:30:10 +0200 Subject: [PATCH] OO-4150: write notifier and authorizer in absence notice --- .../olat/modules/lecture/AbsenceNotice.java | 4 ++ .../olat/modules/lecture/LectureService.java | 6 ++- .../lecture/manager/AbsenceNoticeDAO.java | 5 +- .../lecture/manager/LectureServiceImpl.java | 21 ++++++-- .../lecture/ui/coach/AbsencesController.java | 2 +- .../ui/coach/DispensationsController.java | 2 +- .../ui/coach/EditNoticeController.java | 12 ++++- .../IdentitiesLecturesRollCallController.java | 2 +- .../ui/profile/IdentityProfileController.java | 2 +- .../lecture/manager/AbsenceNoticeDAOTest.java | 52 ++++++++++++++----- .../AbsenceNoticeToLectureBlockDAOTest.java | 2 +- ...AbsenceNoticeToRepositoryEntryDAOTest.java | 6 +-- .../lecture/manager/LectureServiceTest.java | 6 +-- 13 files changed, 88 insertions(+), 34 deletions(-) diff --git a/src/main/java/org/olat/modules/lecture/AbsenceNotice.java b/src/main/java/org/olat/modules/lecture/AbsenceNotice.java index 0458f684abf..3f7ded1046c 100644 --- a/src/main/java/org/olat/modules/lecture/AbsenceNotice.java +++ b/src/main/java/org/olat/modules/lecture/AbsenceNotice.java @@ -63,5 +63,9 @@ public interface AbsenceNotice extends AbsenceNoticeRef, ModifiedInfo, CreateInf public Boolean getAbsenceAuthorized(); public void setAbsenceAuthorized(Boolean absenceAuthorized); + + public Identity getNotifier(); + + public Identity getAuthorizer(); } diff --git a/src/main/java/org/olat/modules/lecture/LectureService.java b/src/main/java/org/olat/modules/lecture/LectureService.java index adbeb120e48..caf6315e9e0 100644 --- a/src/main/java/org/olat/modules/lecture/LectureService.java +++ b/src/main/java/org/olat/modules/lecture/LectureService.java @@ -286,16 +286,18 @@ public interface LectureService { */ public AbsenceNotice createAbsenceNotice(Identity absentIdentity, AbsenceNoticeType type, AbsenceNoticeTarget target, Date startDate, Date endDate, AbsenceCategory category, String absenceRason, Boolean authorized, - List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks); + List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks, Identity actingIdentity); /** * * @param absenceNotice The absence notice to update + * @param authorizer The user which authorize the absence (or null) * @param entries A new list of repository entries * @param lectureBlocks Or a new list of lecture blocks * @return A refreshed absence notice */ - public AbsenceNotice updateAbsenceNotice(AbsenceNotice absenceNotice, List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks); + public AbsenceNotice updateAbsenceNotice(AbsenceNotice absenceNotice, Identity authorizer, + List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks); /** * Reload the absence notice. diff --git a/src/main/java/org/olat/modules/lecture/manager/AbsenceNoticeDAO.java b/src/main/java/org/olat/modules/lecture/manager/AbsenceNoticeDAO.java index fe46eb3c336..b508120255e 100644 --- a/src/main/java/org/olat/modules/lecture/manager/AbsenceNoticeDAO.java +++ b/src/main/java/org/olat/modules/lecture/manager/AbsenceNoticeDAO.java @@ -62,7 +62,8 @@ public class AbsenceNoticeDAO { private DB dbInstance; public AbsenceNotice createAbsenceNotice(Identity identity, AbsenceNoticeType type, AbsenceNoticeTarget target, - Date start, Date end, AbsenceCategory category, String absenceRason, Boolean authorized) { + Date start, Date end, AbsenceCategory category, String absenceRason, Boolean authorized, + Identity authorizer, Identity notifier) { AbsenceNoticeImpl notice = new AbsenceNoticeImpl(); notice.setCreationDate(new Date()); notice.setLastModified(notice.getCreationDate()); @@ -74,6 +75,8 @@ public class AbsenceNoticeDAO { notice.setNoticeTarget(target); notice.setAbsenceAuthorized(authorized); notice.setIdentity(identity); + notice.setNotifier(notifier); + notice.setAuthorizer(authorizer); dbInstance.getCurrentEntityManager().persist(notice); return notice; } diff --git a/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java b/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java index a48c2f67a17..3d9d5035318 100644 --- a/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java +++ b/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java @@ -87,6 +87,7 @@ import org.olat.modules.lecture.LectureRollCallStatus; import org.olat.modules.lecture.LectureService; import org.olat.modules.lecture.Reason; import org.olat.modules.lecture.RepositoryEntryLectureConfiguration; +import org.olat.modules.lecture.model.AbsenceNoticeImpl; import org.olat.modules.lecture.model.AbsenceNoticeInfos; import org.olat.modules.lecture.model.AggregatedLectureBlocksStatistics; import org.olat.modules.lecture.model.IdentityRateWarning; @@ -513,11 +514,18 @@ public class LectureServiceImpl implements LectureService, UserDataDeletable, De @Override public AbsenceNotice createAbsenceNotice(Identity absentIdentity, AbsenceNoticeType type, AbsenceNoticeTarget target, Date start, Date end, - AbsenceCategory category, String absenceRason, Boolean authorized, List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks) { + AbsenceCategory category, String absenceRason, Boolean authorized, List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks, + Identity actingIdentity) { if(type == AbsenceNoticeType.dispensation) { authorized = Boolean.TRUE; } - AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(absentIdentity, type, target, start, end, category, absenceRason, authorized); + Identity authorizer = null; + if(authorized != null && authorized.booleanValue()) { + authorizer = actingIdentity; + } + + AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(absentIdentity, type, target, start, end, + category, absenceRason, authorized, authorizer, actingIdentity); if(entries != null && !entries.isEmpty()) { for(RepositoryEntry entry:entries) { absenceNoticeToRepositoryEntryDao.createRelation(notice, entry); @@ -535,9 +543,12 @@ public class LectureServiceImpl implements LectureService, UserDataDeletable, De } @Override - public AbsenceNotice updateAbsenceNotice(AbsenceNotice absenceNotice, List<RepositoryEntry> entries, - List<LectureBlock> lectureBlocks) { - + public AbsenceNotice updateAbsenceNotice(AbsenceNotice absenceNotice, Identity authorizer, + List<RepositoryEntry> entries, List<LectureBlock> lectureBlocks) { + + if(authorizer != null && absenceNotice.getAuthorizer() == null) { + ((AbsenceNoticeImpl)absenceNotice).setAuthorizer(authorizer); + } AbsenceNotice notice = absenceNoticeDao.updateAbsenceNotice(absenceNotice); List<AbsenceNoticeToLectureBlock> currentNoticeToBlocks = absenceNoticeToLectureBlockDao.getRelations(absenceNotice); List<AbsenceNoticeToRepositoryEntry> currentNoticeToEntries = absenceNoticeToRepositoryEntryDao.getRelations(absenceNotice); diff --git a/src/main/java/org/olat/modules/lecture/ui/coach/AbsencesController.java b/src/main/java/org/olat/modules/lecture/ui/coach/AbsencesController.java index a8529e73f81..7a5c17c2259 100644 --- a/src/main/java/org/olat/modules/lecture/ui/coach/AbsencesController.java +++ b/src/main/java/org/olat/modules/lecture/ui/coach/AbsencesController.java @@ -182,7 +182,7 @@ public class AbsencesController extends BasicController { lectureService.createAbsenceNotice(absentIdentity, noticeWrapper.getAbsenceNoticeType(), noticeWrapper.getAbsenceNoticeTarget(), noticeWrapper.getStartDate(), noticeWrapper.getEndDate(), noticeWrapper.getAbsenceCategory(), noticeWrapper.getAbsenceReason(), noticeWrapper.getAuthorized(), - noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks()); + noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks(), getIdentity()); } if(noticeWrapper.getIdentitiesToContact() != null && !noticeWrapper.getIdentitiesToContact().isEmpty()) { diff --git a/src/main/java/org/olat/modules/lecture/ui/coach/DispensationsController.java b/src/main/java/org/olat/modules/lecture/ui/coach/DispensationsController.java index 60ea054d4f8..216dd591c79 100644 --- a/src/main/java/org/olat/modules/lecture/ui/coach/DispensationsController.java +++ b/src/main/java/org/olat/modules/lecture/ui/coach/DispensationsController.java @@ -180,7 +180,7 @@ public class DispensationsController extends BasicController { lectureService.createAbsenceNotice(absentIdentity, noticeWrapper.getAbsenceNoticeType(), noticeWrapper.getAbsenceNoticeTarget(), noticeWrapper.getStartDate(), noticeWrapper.getEndDate(), noticeWrapper.getAbsenceCategory(), noticeWrapper.getAbsenceReason(), noticeWrapper.getAuthorized(), - noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks()); + noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks(), getIdentity()); } if(noticeWrapper.getIdentitiesToContact() != null && !noticeWrapper.getIdentitiesToContact().isEmpty()) { diff --git a/src/main/java/org/olat/modules/lecture/ui/coach/EditNoticeController.java b/src/main/java/org/olat/modules/lecture/ui/coach/EditNoticeController.java index 5cb96ad75a9..ad38d9a9c9d 100644 --- a/src/main/java/org/olat/modules/lecture/ui/coach/EditNoticeController.java +++ b/src/main/java/org/olat/modules/lecture/ui/coach/EditNoticeController.java @@ -28,6 +28,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormBasicController; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; +import org.olat.core.id.Identity; import org.olat.modules.lecture.AbsenceNotice; import org.olat.modules.lecture.AbsenceNoticeTarget; import org.olat.modules.lecture.AbsenceNoticeToLectureBlock; @@ -103,6 +104,8 @@ public class EditNoticeController extends FormBasicController { datesAndLecturesCtrl.formOK(ureq); absenceNotice = lectureService.getAbsenceNotice(absenceNotice); + Boolean authorized = absenceNotice.getAbsenceAuthorized(); + absenceNotice.setStartDate(noticeWrapper.getStartDate()); absenceNotice.setEndDate(noticeWrapper.getEndDate()); absenceNotice.setAbsenceAuthorized(noticeWrapper.getAuthorized()); @@ -117,7 +120,14 @@ public class EditNoticeController extends FormBasicController { } else if(noticeWrapper.getAbsenceNoticeTarget() == AbsenceNoticeTarget.lectureblocks) { lectureBlocks = noticeWrapper.getLectureBlocks(); } - absenceNotice = lectureService.updateAbsenceNotice(absenceNotice, entries, lectureBlocks); + + Identity authorizer = null; + if(absenceNotice.getAbsenceAuthorized() != null && absenceNotice.getAbsenceAuthorized().booleanValue() + && (authorized == null || !authorized.booleanValue())) { + authorizer = getIdentity(); + } + + absenceNotice = lectureService.updateAbsenceNotice(absenceNotice, authorizer, entries, lectureBlocks); fireEvent(ureq, Event.CHANGED_EVENT); } diff --git a/src/main/java/org/olat/modules/lecture/ui/coach/IdentitiesLecturesRollCallController.java b/src/main/java/org/olat/modules/lecture/ui/coach/IdentitiesLecturesRollCallController.java index f225bdc88d1..52bed771106 100644 --- a/src/main/java/org/olat/modules/lecture/ui/coach/IdentitiesLecturesRollCallController.java +++ b/src/main/java/org/olat/modules/lecture/ui/coach/IdentitiesLecturesRollCallController.java @@ -450,7 +450,7 @@ public class IdentitiesLecturesRollCallController extends FormBasicController { lectureService.createAbsenceNotice(absentIdentity, noticeWrapper.getAbsenceNoticeType(), noticeWrapper.getAbsenceNoticeTarget(), noticeWrapper.getStartDate(), noticeWrapper.getEndDate(), noticeWrapper.getAbsenceCategory(), noticeWrapper.getAbsenceReason(), noticeWrapper.getAuthorized(), - noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks()); + noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks(), getIdentity()); } return StepsMainRunController.DONE_MODIFIED; }; diff --git a/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java b/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java index ce90739574a..fded61848a9 100644 --- a/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java +++ b/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java @@ -228,7 +228,7 @@ public class IdentityProfileController extends BasicController implements Activa lectureService.createAbsenceNotice(absentIdentity, noticeWrapper.getAbsenceNoticeType(), noticeWrapper.getAbsenceNoticeTarget(), noticeWrapper.getStartDate(), noticeWrapper.getEndDate(), noticeWrapper.getAbsenceCategory(), noticeWrapper.getAbsenceReason(), noticeWrapper.getAuthorized(), - noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks()); + noticeWrapper.getEntries(), noticeWrapper.getLectureBlocks(), getIdentity()); } if(noticeWrapper.getIdentitiesToContact() != null && !noticeWrapper.getIdentitiesToContact().isEmpty()) { diff --git a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeDAOTest.java b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeDAOTest.java index 8bc3294cdea..860b49dffa9 100644 --- a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeDAOTest.java +++ b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeDAOTest.java @@ -78,25 +78,43 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { @Test public void createAbsenceNotice() { Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-1"); + Identity notifier = JunitTestHelper.createAndPersistIdentityAsRndUser("notifier-1"); + Identity authorizer = JunitTestHelper.createAndPersistIdentityAsRndUser("authorizer-1"); + + Date start = CalendarUtils.startOfDay(new Date()); + Date end = CalendarUtils.endOfDay(new Date()); + AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null); + start, end, null, "A very good reason", Boolean.TRUE, authorizer, notifier); dbInstance.commitAndCloseSession(); Assert.assertNotNull(notice); Assert.assertNotNull(notice.getKey()); Assert.assertNotNull(notice.getCreationDate()); Assert.assertNotNull(notice.getLastModified()); + Assert.assertNotNull(notice.getStartDate()); + Assert.assertNotNull(notice.getEndDate()); Assert.assertEquals(identity, notice.getIdentity()); + Assert.assertEquals(notifier, notice.getNotifier()); + Assert.assertEquals(authorizer, notice.getAuthorizer()); + Assert.assertEquals(Boolean.TRUE, notice.getAbsenceAuthorized()); + Assert.assertEquals("A very good reason", notice.getAbsenceReason()); Assert.assertEquals(AbsenceNoticeType.absence, notice.getNoticeType()); Assert.assertEquals(AbsenceNoticeTarget.lectureblocks, notice.getNoticeTarget()); } @Test public void createAbsenceNoticeToRollCall() { - Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-1"); + Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-2"); + Identity notifier = JunitTestHelper.createAndPersistIdentityAsRndUser("notifier-2"); + Identity authorizer = JunitTestHelper.createAndPersistIdentityAsRndUser("authorizer-2"); + + Date start = CalendarUtils.startOfDay(new Date()); + Date end = CalendarUtils.endOfDay(new Date()); + LectureBlock lectureBlock = createMinimalLectureBlock(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null); + start, end, null, "Too sleepy", Boolean.FALSE, authorizer, notifier); LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, notice, null, null); dbInstance.commitAndCloseSession(); @@ -108,7 +126,13 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { Assert.assertEquals(rollCall, reloadedRollCall); Assert.assertEquals(identity, reloadedRollCall.getIdentity()); Assert.assertEquals(identity, reloadedNotice.getIdentity()); + Assert.assertEquals(notifier, reloadedNotice.getNotifier()); + Assert.assertEquals(authorizer, reloadedNotice.getAuthorizer()); Assert.assertEquals(notice, reloadedNotice); + Assert.assertEquals(Boolean.FALSE, reloadedNotice.getAbsenceAuthorized()); + Assert.assertEquals("Too sleepy", reloadedNotice.getAbsenceReason()); + Assert.assertNotNull(reloadedNotice.getStartDate()); + Assert.assertNotNull(reloadedNotice.getEndDate()); Assert.assertEquals(AbsenceNoticeType.absence, reloadedNotice.getNoticeType()); Assert.assertEquals(AbsenceNoticeTarget.lectureblocks, reloadedNotice.getNoticeTarget()); } @@ -121,7 +145,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { dbInstance.commitAndCloseSession(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, - null, null, null, null, null); + null, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); linkNoticeToRollCall(rollCall, notice); @@ -145,7 +169,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { public void searchAbsenceNotice() { Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-3"); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - null, null, null, null, null); + null, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); AbsenceNoticeSearchParameters searchParams = new AbsenceNoticeSearchParameters(); @@ -168,7 +192,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { AbsenceCategory absenceCategory = absenceCategoryDao .createAbsenceCategory(UUID.randomUUID().toString(), "Test category"); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - null, null, null, null, null); + null, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); Assert.assertNotNull(notice); @@ -196,7 +220,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - null, null, null, null, null); + null, null, null, null, null, null, null); linkNoticeToRollCall(rollCall, notice); List<LectureBlockRollCall> noticedRollCalls = absenceNoticeDao.getRollCalls(notice); @@ -212,7 +236,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null); + null, null, null, null, null, null, null); linkNoticeToRollCall(rollCall, notice); absenceNoticeToLectureBlockDao.createRelation(notice, lectureBlock); dbInstance.commitAndCloseSession(); @@ -239,7 +263,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, - null, null, null, null, null); + null, null, null, null, null, null, null); linkNoticeToRollCall(rollCall, notice); absenceNoticeToRepositoryEntryDao.createRelation(notice, lectureBlock.getEntry()); dbInstance.commitAndCloseSession(); @@ -270,7 +294,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null); + CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null, null, null); dbInstance.commitAndCloseSession(); Assert.assertNotNull(rollCall); @@ -293,7 +317,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { public void loadAbsenceNotice() { Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-8"); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null); + CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null, null, null); dbInstance.commitAndCloseSession(); AbsenceNotice reloadedNotice = absenceNoticeDao.loadAbsenceNotice(notice.getKey()); @@ -308,7 +332,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null); + null, null, null, null, null, null, null); linkNoticeToRollCall(rollCall, notice); absenceNoticeToLectureBlockDao.createRelation(notice, lectureBlock); dbInstance.commitAndCloseSession(); @@ -327,7 +351,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, - null, null, null, null, null); + null, null, null, null, null, null, null); linkNoticeToRollCall(rollCall, notice); absenceNoticeToRepositoryEntryDao.createRelation(notice, lectureBlock.getEntry()); dbInstance.commitAndCloseSession(); @@ -350,7 +374,7 @@ public class AbsenceNoticeDAOTest extends OlatTestCase { LectureBlockRollCall rollCall = lectureBlockRollCallDao.createAndPersistRollCall(lectureBlock, identity, null, null, null, null, null, null); dbInstance.commit(); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, - CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null); + CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), null, null, null, null, null); dbInstance.commitAndCloseSession(); Assert.assertNotNull(rollCall); diff --git a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToLectureBlockDAOTest.java b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToLectureBlockDAOTest.java index 6b043007275..84218e5ae07 100644 --- a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToLectureBlockDAOTest.java +++ b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToLectureBlockDAOTest.java @@ -56,7 +56,7 @@ public class AbsenceNoticeToLectureBlockDAOTest extends OlatTestCase { public void createAbsenceNoticeToLectureBlock() { Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-1"); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null); + null, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); LectureBlock lectureBlock = createLectureBlock(); diff --git a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToRepositoryEntryDAOTest.java b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToRepositoryEntryDAOTest.java index 46061d703c3..f4d3ba75f74 100644 --- a/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToRepositoryEntryDAOTest.java +++ b/src/test/java/org/olat/modules/lecture/manager/AbsenceNoticeToRepositoryEntryDAOTest.java @@ -69,7 +69,7 @@ public class AbsenceNoticeToRepositoryEntryDAOTest extends OlatTestCase { RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry(); Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("absent-1"); AbsenceNotice notice = absenceNoticeDao.createAbsenceNotice(identity, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, - null, null, null, null, null); + null, null, null, null, null, null, null); dbInstance.commitAndCloseSession(); AbsenceNoticeToRepositoryEntry relation = absenceNoticeToRepositoryEntryDao.createRelation(notice, entry); @@ -91,7 +91,7 @@ public class AbsenceNoticeToRepositoryEntryDAOTest extends OlatTestCase { repositoryEntryRelationDAO.addRole(participant, entry, GroupRole.participant.name()); AbsenceNotice notice = lectureService.createAbsenceNotice(participant, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), - null, null, Boolean.TRUE, Collections.singletonList(entry), null); + null, null, Boolean.TRUE, Collections.singletonList(entry), null, null); dbInstance.commit(); LectureBlockRollCall rollCall = lectureService.getOrCreateRollCall(participant, lectureBlock, null, null, null); @@ -120,7 +120,7 @@ public class AbsenceNoticeToRepositoryEntryDAOTest extends OlatTestCase { repositoryEntryRelationDAO.addRole(participant, entry, GroupRole.participant.name()); AbsenceNotice notice = lectureService.createAbsenceNotice(participant, AbsenceNoticeType.absence, AbsenceNoticeTarget.allentries, CalendarUtils.startOfDay(new Date()), CalendarUtils.endOfDay(new Date()), - null, null, Boolean.TRUE, Collections.singletonList(entry), null); + null, null, Boolean.TRUE, Collections.singletonList(entry), null, null); dbInstance.commit(); LectureBlockRollCall rollCall = lectureService.getOrCreateRollCall(participant, lectureBlock, null, null, null); diff --git a/src/test/java/org/olat/modules/lecture/manager/LectureServiceTest.java b/src/test/java/org/olat/modules/lecture/manager/LectureServiceTest.java index ee25d9b3844..c25c9ab1234 100644 --- a/src/test/java/org/olat/modules/lecture/manager/LectureServiceTest.java +++ b/src/test/java/org/olat/modules/lecture/manager/LectureServiceTest.java @@ -380,7 +380,7 @@ public class LectureServiceTest extends OlatTestCase { List<LectureBlock> lectureBlocks = new ArrayList<>(); lectureBlocks.add(block1); AbsenceNotice notice = lectureService.createAbsenceNotice(participant, AbsenceNoticeType.absence, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null, null, lectureBlocks); + null, null, null, null, null, null, lectureBlocks, teacher); dbInstance.commitAndCloseSession(); // first roll call @@ -421,7 +421,7 @@ public class LectureServiceTest extends OlatTestCase { List<RepositoryEntry> entries = new ArrayList<>(); entries.add(entry); AbsenceNotice notice = lectureService.createAbsenceNotice(participant, AbsenceNoticeType.absence, AbsenceNoticeTarget.entries, - null, null, null, null, null, entries, null); + null, null, null, null, null, entries, null, teacher); dbInstance.commitAndCloseSession(); // first roll call @@ -471,7 +471,7 @@ public class LectureServiceTest extends OlatTestCase { lectureBlocks.add(block1); lectureBlocks.add(block2); AbsenceNotice notice = lectureService.createAbsenceNotice(participant, AbsenceNoticeType.notified, AbsenceNoticeTarget.lectureblocks, - null, null, null, null, null, null, lectureBlocks); + null, null, null, null, null, null, lectureBlocks, teacher); dbInstance.commitAndCloseSession(); Assert.assertNotNull(notice); -- GitLab