use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class RightsMetadataEditController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (item instanceof QuestionItemImpl) {
QuestionItemImpl itemImpl = (QuestionItemImpl) item;
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
builder.withBefore(itemImpl);
if (licenseModule.isEnabled(licenseHandler)) {
if (licenseEl != null && licenseEl.isOneSelected()) {
String licenseTypeKey = licenseEl.getSelectedKey();
LicenseType licneseType = licenseService.loadLicenseTypeByKey(licenseTypeKey);
license.setLicenseType(licneseType);
}
String licensor = null;
String freetext = null;
if (licensorEl != null && licensorEl.isVisible()) {
licensor = StringHelper.containsNonWhitespace(licensorEl.getValue()) ? licensorEl.getValue() : null;
}
if (licenseFreetextEl != null && licenseFreetextEl.isVisible()) {
freetext = StringHelper.containsNonWhitespace(licenseFreetextEl.getValue()) ? licenseFreetextEl.getValue() : null;
}
license.setLicensor(licensor);
license.setFreetext(freetext);
license = licenseService.update(license);
licensorEl.setValue(license.getLicensor());
licenseFreetextEl.setValue(license.getFreetext());
}
item = qpoolService.updateItem(item);
builder.withAfter(itemImpl);
qpoolService.persist(builder.create());
fireEvent(ureq, new QItemEdited(item));
}
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class TechnicalMetadataEditController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (item instanceof QuestionItemImpl) {
QuestionItemImpl itemImpl = (QuestionItemImpl) item;
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
builder.withBefore(itemImpl);
itemImpl.setItemVersion(versionEl.getValue());
item = qpoolService.updateItem(item);
builder.withAfter(itemImpl);
qpoolService.persist(builder.create());
fireEvent(ureq, new QItemEdited(item));
}
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class CopyConfirmationController method logAudit.
private void logAudit(List<QuestionItem> items) {
for (QuestionItem item : items) {
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.CREATE_QUESTION_ITEM_BY_COPY);
builder.withAfter(item);
qpoolService.persist(builder.create());
}
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class QuestionPoolWebService method importQuestionItem.
private QuestionItemVOes importQuestionItem(Identity owner, String filename, File tmpFile, String language, Identity executor) {
Locale locale = CoreSpringFactory.getImpl(I18nManager.class).getLocaleOrDefault(language);
QPoolService qpoolService = CoreSpringFactory.getImpl(QPoolService.class);
List<QuestionItem> items = qpoolService.importItems(owner, locale, filename, tmpFile);
for (QuestionItem item : items) {
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(executor, Action.CREATE_QUESTION_ITEM_BY_IMPORT);
builder.withAfter(item);
qpoolService.persist(builder.create());
}
QuestionItemVOes voes = new QuestionItemVOes();
QuestionItemVO[] voArray = new QuestionItemVO[items.size()];
for (int i = items.size(); i-- > 0; ) {
voArray[i] = new QuestionItemVO(items.get(i));
}
voes.setQuestionItems(voArray);
voes.setTotalCount(items.size());
return voes;
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project OpenOLAT by OpenOLAT.
the class TechnicalMetadataEditController method formOK.
@Override
protected void formOK(UserRequest ureq) {
if (item instanceof QuestionItemImpl) {
QuestionItemImpl itemImpl = (QuestionItemImpl) item;
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
builder.withBefore(itemImpl);
itemImpl.setItemVersion(versionEl.getValue());
item = qpoolService.updateItem(item);
builder.withAfter(itemImpl);
qpoolService.persist(builder.create());
fireEvent(ureq, new QItemEdited(item));
}
}
Aggregations