use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class QuestionListController method doCreateNewItem.
private void doCreateNewItem(UserRequest ureq, String title, TaxonomyLevel taxonomyLevel, QItemFactory factory) {
QuestionItem item = factory.createItem(getIdentity(), title, getLocale());
List<QuestionItem> newItems = Collections.singletonList(item);
getSource().postImport(newItems, false);
if (taxonomyLevel != null && item instanceof QuestionItemImpl) {
QuestionItemImpl itemImpl = (QuestionItemImpl) item;
itemImpl.setTaxonomyLevel(taxonomyLevel);
qpoolService.updateItem(itemImpl);
}
if (licenseModule.isEnabled(licenseHandler)) {
// The QItemFactory may create a no license as part of the import process.
// But for new question items the default license should be created.
// So delete the no license first, so that the default license can be created.
licenseService.delete(item);
licenseService.createDefaultLicense(item, licenseHandler, getIdentity());
}
getItemsTable().reset();
dbInstance.commit();
qpoolService.index(newItems);
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.CREATE_QUESTION_ITEM_NEW);
builder.withAfter(item);
qpoolService.persist(builder.create());
QPoolEvent qce = new QPoolEvent(QPoolEvent.ITEM_CREATED);
fireEvent(ureq, qce);
doOpenDetails(ureq, item);
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class QuestionListController method doDelete.
private void doDelete(List<QuestionItemShort> items) {
for (QuestionItemShort item : items) {
QuestionItem qitem = qpoolService.loadItemById(item.getKey());
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.DELETE_QUESTION_ITEM);
builder.withBefore(qitem);
qpoolService.persist(builder.create());
}
qpoolService.deleteItems(items);
getItemsTable().reset(true, true, true);
showInfo("item.deleted");
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class QuestionItemDetailsController method doDelete.
private void doDelete(UserRequest ureq, List<QuestionItemShort> items) {
for (QuestionItemShort item : items) {
QuestionItem qitem = qpoolService.loadItemById(item.getKey());
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.DELETE_QUESTION_ITEM);
builder.withBefore(qitem);
qpoolService.persist(builder.create());
}
qpoolService.deleteItems(items);
fireEvent(ureq, new QPoolEvent(QPoolEvent.ITEM_DELETED));
showInfo("item.deleted");
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class QuestionItemDetailsController method finishQuestionEdition.
private void finishQuestionEdition() {
if (questionEdited) {
QuestionItem item = metadatasCtrl.getItem();
qpoolService.backupQuestion(item);
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION).withBefore(item).withAfter(item);
qpoolService.persist(builder.create());
}
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class ConversionConfirmationController method logAudit.
private void logAudit(List<QuestionItem> items) {
for (QuestionItem item : items) {
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.CREATE_QUESTION_ITEM_BY_CONVERSION);
builder.withAfter(item);
qpoolService.persist(builder.create());
}
}
Aggregations