use of org.olat.modules.lecture.LectureBlockAuditLog in project openolat by klemens.
the class LectureBlockAuditLogDAOTest method getAuditLog_byRepositoryEntry.
@Test
public void getAuditLog_byRepositoryEntry() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("audit-4-");
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("audit-5-");
lectureBlockAuditLogDao.auditLog(LectureBlockAuditLog.Action.updateAuthorizedAbsence, "Before", "After", "Update absence of course", null, null, entry, identity, author);
dbInstance.commitAndCloseSession();
// load the audit log
List<LectureBlockAuditLog> auditLog = lectureBlockAuditLogDao.getAuditLog(entry);
Assert.assertNotNull(auditLog);
Assert.assertEquals(1, auditLog.size());
// check the entry
LectureBlockAuditLog logEntry = auditLog.get(0);
Assert.assertEquals(identity.getKey(), logEntry.getIdentityKey());
Assert.assertEquals(author.getKey(), logEntry.getAuthorKey());
Assert.assertEquals(entry.getKey(), logEntry.getEntryKey());
Assert.assertEquals("Before", logEntry.getBefore());
Assert.assertEquals("After", logEntry.getAfter());
Assert.assertEquals("Update absence of course", logEntry.getMessage());
Assert.assertEquals(LectureBlockAuditLog.Action.updateAuthorizedAbsence.name(), logEntry.getAction());
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project openolat by klemens.
the class LectureRepositoryAdminController method doExportLog.
private void doExportLog(UserRequest ureq) {
List<LectureBlockAuditLog> auditLog = lectureService.getAuditLog(entry);
RepositoryEntryAuditLogExport archive = new RepositoryEntryAuditLogExport(entry, auditLog, authorizedAbsenceEnabled, getTranslator());
ureq.getDispatchResult().setResultingMediaResource(archive);
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project openolat by klemens.
the class AbstractLectureBlockAuditLogExport method addContent.
private void addContent(OpenXMLWorksheet exportSheet, OpenXMLWorkbook workbook) {
for (LectureBlockAuditLog logEntry : auditLog) {
int pos = 0;
Row row = exportSheet.newRow();
Date creationDate = logEntry.getCreationDate();
row.addCell(pos++, creationDate, workbook.getStyles().getDateTimeStyle());
row.addCell(pos++, logEntry.getAction());
// repo entry title
row.addCell(pos++, getRepositoryEntryDisplayName(logEntry.getEntryKey()), null);
// lecture block
row.addCell(pos++, getLectureBlockTitle(logEntry.getLectureBlockKey()), null);
// date start / end
// planned / effective
LectureBlock auditBlock = null;
LectureBlockRollCall auditRollCall = null;
LectureParticipantSummary auditSummary = null;
if (logEntry.getRollCallKey() != null) {
auditRollCall = getAuditRollCall(logEntry.getAfter());
}
if (auditRollCall == null) {
if (logEntry.getLectureBlockKey() != null) {
auditBlock = getAuditLectureBlock(logEntry.getAfter());
} else {
auditSummary = getAuditLectureParticipantSummary(logEntry.getAfter());
}
}
if (auditBlock != null) {
if (auditBlock.getStatus() == null) {
pos++;
} else {
row.addCell(pos++, auditBlock.getStatus().name(), null);
}
row.addCell(pos++, auditBlock.getPlannedLecturesNumber(), null);
row.addCell(pos++, auditBlock.getEffectiveLecturesNumber(), null);
row.addCell(pos++, auditBlock.getEffectiveEndDate(), workbook.getStyles().getDateTimeStyle());
} else {
pos += 4;
}
if (auditRollCall != null) {
Long assessedIdentityKey = logEntry.getIdentityKey();
String fullname = userManager.getUserDisplayName(assessedIdentityKey);
row.addCell(pos++, fullname);
row.addCell(pos++, auditRollCall.getLecturesAttendedNumber(), null);
row.addCell(pos++, auditRollCall.getLecturesAbsentNumber(), null);
if (authorizedAbsenceEnabled) {
if (auditRollCall.getAbsenceAuthorized() != null && auditRollCall.getAbsenceAuthorized().booleanValue()) {
row.addCell(pos++, "x");
} else {
pos++;
}
row.addCell(pos++, auditRollCall.getAbsenceReason(), null);
}
row.addCell(pos++, auditRollCall.getComment(), null);
} else if (auditSummary != null) {
Long assessedIdentityKey = logEntry.getIdentityKey();
String fullname = userManager.getUserDisplayName(assessedIdentityKey);
row.addCell(pos++, fullname);
pos += 2;
if (authorizedAbsenceEnabled) {
pos += 2;
}
String summaryComment = getSummaryComment(getAuditLectureParticipantSummary(logEntry.getBefore()), auditSummary);
row.addCell(pos++, summaryComment, null);
} else {
pos += 4;
if (authorizedAbsenceEnabled) {
pos += 2;
}
}
Long authorKey = logEntry.getAuthorKey();
if (authorKey != null) {
String fullname = userManager.getUserDisplayName(authorKey);
row.addCell(pos++, fullname);
}
}
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project OpenOLAT by OpenOLAT.
the class LectureBlockAuditLogDAOTest method getAuditLog_byRepositoryEntry.
@Test
public void getAuditLog_byRepositoryEntry() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
Identity identity = JunitTestHelper.createAndPersistIdentityAsRndUser("audit-4-");
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("audit-5-");
lectureBlockAuditLogDao.auditLog(LectureBlockAuditLog.Action.updateAuthorizedAbsence, "Before", "After", "Update absence of course", null, null, entry, identity, author);
dbInstance.commitAndCloseSession();
// load the audit log
List<LectureBlockAuditLog> auditLog = lectureBlockAuditLogDao.getAuditLog(entry);
Assert.assertNotNull(auditLog);
Assert.assertEquals(1, auditLog.size());
// check the entry
LectureBlockAuditLog logEntry = auditLog.get(0);
Assert.assertEquals(identity.getKey(), logEntry.getIdentityKey());
Assert.assertEquals(author.getKey(), logEntry.getAuthorKey());
Assert.assertEquals(entry.getKey(), logEntry.getEntryKey());
Assert.assertEquals("Before", logEntry.getBefore());
Assert.assertEquals("After", logEntry.getAfter());
Assert.assertEquals("Update absence of course", logEntry.getMessage());
Assert.assertEquals(LectureBlockAuditLog.Action.updateAuthorizedAbsence.name(), logEntry.getAction());
}
use of org.olat.modules.lecture.LectureBlockAuditLog in project OpenOLAT by OpenOLAT.
the class LectureBlockAuditLogDAOTest method getAuditLog_byLectureBlock.
@Test
public void getAuditLog_byLectureBlock() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("I will be loged");
lectureBlock = lectureBlockDao.update(lectureBlock);
lectureBlockAuditLogDao.auditLog(LectureBlockAuditLog.Action.autoclose, "Before", "After", "Close the absence of course", lectureBlock, null, entry, null, null);
dbInstance.commitAndCloseSession();
// load the audit log
List<LectureBlockAuditLog> auditLog = lectureBlockAuditLogDao.getAuditLog(lectureBlock);
Assert.assertNotNull(auditLog);
Assert.assertEquals(1, auditLog.size());
// check the entry
LectureBlockAuditLog logEntry = auditLog.get(0);
Assert.assertEquals(entry.getKey(), logEntry.getEntryKey());
Assert.assertEquals("Before", logEntry.getBefore());
Assert.assertEquals("After", logEntry.getAfter());
Assert.assertEquals("Close the absence of course", logEntry.getMessage());
Assert.assertEquals(LectureBlockAuditLog.Action.autoclose.name(), logEntry.getAction());
}
Aggregations