use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class MetadataBulkChangeController method formOK.
@Override
protected void formOK(UserRequest ureq) {
updatedItems = new ArrayList<>();
for (QuestionItemShort item : items) {
QuestionItem fullItem = qpoolService.loadItemById(item.getKey());
if (fullItem instanceof QuestionItemImpl) {
QuestionItemImpl itemImpl = (QuestionItemImpl) fullItem;
QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
builder.withBefore(itemImpl);
formOKGeneral(itemImpl);
formOKQuestion(itemImpl);
formOKTechnical(itemImpl);
formOKRights(itemImpl);
QuestionItem merged = qpoolService.updateItem(itemImpl);
builder.withAfter(itemImpl);
qpoolService.persist(builder.create());
updatedItems.add(merged);
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.modules.qpool.QuestionItemAuditLogBuilder in project openolat by klemens.
the class GeneralMetadataEditController 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.setTopic(topicEl.getValue());
if (taxonomyLevelEl.isOneSelected()) {
String selectedKey = taxonomyLevelEl.getSelectedKey();
TaxonomyLevel taxonomyLevel = qpoolTaxonomyTreeBuilder.getTaxonomyLevel(selectedKey);
itemImpl.setTaxonomyLevel(taxonomyLevel);
} else {
itemImpl.setTaxonomyLevel(null);
}
QEducationalContext context = contextEl.isOneSelected() ? qpoolService.getEducationlContextByLevel(contextEl.getSelectedKey()) : null;
itemImpl.setEducationalContext(context);
if (StringHelper.containsNonWhitespace(keywordsEl.getValue())) {
itemImpl.setKeywords(keywordsEl.getValue());
} else {
itemImpl.setKeywords("");
}
if (StringHelper.containsNonWhitespace(coverageEl.getValue())) {
itemImpl.setCoverage(coverageEl.getValue());
} else {
itemImpl.setCoverage("");
}
if (StringHelper.containsNonWhitespace(addInfosEl.getValue())) {
itemImpl.setAdditionalInformations(addInfosEl.getValue());
} else {
itemImpl.setAdditionalInformations(null);
}
itemImpl.setLanguage(languageEl.getValue());
String assessmentType = assessmentTypeEl.isOneSelected() ? assessmentTypeEl.getSelectedKey() : null;
itemImpl.setAssessmentType(assessmentType);
item = qpoolService.updateItem(item);
builder.withAfter(itemImpl);
qpoolService.persist(builder.create());
fireEvent(ureq, new QItemEdited(item));
}
}
Aggregations