Search in sources :

Example 41 with QuestionItemAuditLogBuilder

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);
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) QuestionItem(org.olat.modules.qpool.QuestionItem)

Example 42 with QuestionItemAuditLogBuilder

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));
    }
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) QEducationalContext(org.olat.modules.qpool.model.QEducationalContext)

Aggregations

QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)42 QuestionItem (org.olat.modules.qpool.QuestionItem)32 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)16 QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)8 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)6 QPoolEvent (org.olat.modules.qpool.ui.events.QPoolEvent)6 UserRequest (org.olat.core.gui.UserRequest)4 WindowControl (org.olat.core.gui.control.WindowControl)4 Step (org.olat.core.gui.control.generic.wizard.Step)4 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)4 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)4 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)4 QTIQPoolServiceProvider (org.olat.ims.qti.qpool.QTIQPoolServiceProvider)4 QTI21QPoolServiceProvider (org.olat.ims.qti21.pool.QTI21QPoolServiceProvider)4 AssessmentItemAndMetadata (org.olat.ims.qti21.questionimport.AssessmentItemAndMetadata)4 AssessmentItemsPackage (org.olat.ims.qti21.questionimport.AssessmentItemsPackage)4 ImportOptions (org.olat.ims.qti21.questionimport.ImportOptions)4 QImport_1_InputStep (org.olat.ims.qti21.questionimport.QImport_1_InputStep)4 QPoolService (org.olat.modules.qpool.QPoolService)4 Export_1_TypeStep (org.olat.modules.qpool.ui.wizard.Export_1_TypeStep)4