Search in sources :

Example 16 with QuestionItemAuditLogBuilder

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));
    }
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 17 with QuestionItemAuditLogBuilder

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

Example 18 with QuestionItemAuditLogBuilder

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

Example 19 with QuestionItemAuditLogBuilder

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;
}
Also used : Locale(java.util.Locale) QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QPoolService(org.olat.modules.qpool.QPoolService) QuestionItem(org.olat.modules.qpool.QuestionItem) I18nManager(org.olat.core.util.i18n.I18nManager)

Example 20 with QuestionItemAuditLogBuilder

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

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