Search in sources :

Example 31 with QuestionItemAuditLogBuilder

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

Example 32 with QuestionItemAuditLogBuilder

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

Example 33 with QuestionItemAuditLogBuilder

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

Example 34 with QuestionItemAuditLogBuilder

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

Example 35 with QuestionItemAuditLogBuilder

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

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