Search in sources :

Example 31 with QuestionItemShort

use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.

the class ConversionConfirmationController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String format = formatEl.isOneSelected() ? formatEl.getSelectedKey() : null;
    List<QuestionItemShort> itemsToConvert = formatToItems.get(format);
    List<QuestionItem> convertedItems = qpoolService.convertItems(getIdentity(), itemsToConvert, format, getLocale());
    addToItemsSource(convertedItems);
    logAudit(convertedItems);
    fireEvent(ureq, new QItemsProcessedEvent(convertedItems, itemsToConvert.size(), itemsToConvert.size() - convertedItems.size()));
}
Also used : QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) QItemsProcessedEvent(org.olat.modules.qpool.ui.events.QItemsProcessedEvent) QuestionItem(org.olat.modules.qpool.QuestionItem)

Example 32 with QuestionItemShort

use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.

the class QTIQPoolServiceProvider method assembleTest.

public void assembleTest(List<QuestionItemShort> items, ZipOutputStream zout) {
    List<Long> itemKeys = new ArrayList<>();
    for (QuestionItemShort item : items) {
        itemKeys.add(item.getKey());
    }
    List<QuestionItemFull> fullItems = questionItemDao.loadByIds(itemKeys);
    QTIExportProcessor processor = new QTIExportProcessor(qpoolFileStorage);
    processor.assembleTest(fullItems, zout);
}
Also used : QuestionItemFull(org.olat.modules.qpool.QuestionItemFull) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) ArrayList(java.util.ArrayList)

Example 33 with QuestionItemShort

use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.

the class CollectionDAO method removeItemFromCollection.

public int removeItemFromCollection(List<QuestionItemShort> items, QuestionItemCollection collection) {
    // noting to do
    if (items == null || items.isEmpty())
        return 0;
    List<Long> keys = new ArrayList<>();
    for (QuestionItemShort item : items) {
        keys.add(item.getKey());
    }
    StringBuilder sb = new StringBuilder();
    sb.append("delete from qcollection2item coll2item where coll2item.item.key in (:itemKeys) and coll2item.collection.key=:collectionKey");
    return dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("itemKeys", keys).setParameter("collectionKey", collection.getKey()).executeUpdate();
}
Also used : QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) ArrayList(java.util.ArrayList)

Example 34 with QuestionItemShort

use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.

the class CollectionDAO method deleteItemFromCollections.

public int deleteItemFromCollections(List<? extends QuestionItemShort> items) {
    // noting to do
    if (items == null || items.isEmpty())
        return 0;
    List<Long> keys = new ArrayList<>();
    for (QuestionItemShort item : items) {
        keys.add(item.getKey());
    }
    StringBuilder sb = new StringBuilder();
    sb.append("delete from qcollection2item coll2item where coll2item.item.key in (:itemKeys)");
    return dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("itemKeys", keys).executeUpdate();
}
Also used : QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) ArrayList(java.util.ArrayList)

Example 35 with QuestionItemShort

use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.

the class PoolDAO method removeFromPools.

public int removeFromPools(List<? extends QuestionItemShort> items) {
    if (items == null || items.isEmpty())
        return 0;
    List<Long> keys = new ArrayList<>();
    for (QuestionItemShort item : items) {
        keys.add(item.getKey());
    }
    StringBuilder sb = new StringBuilder();
    sb.append("delete from qpool2item pool2item where pool2item.item.key in (:itemKeys)");
    return dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("itemKeys", keys).executeUpdate();
}
Also used : QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) ArrayList(java.util.ArrayList)

Aggregations

QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)76 ArrayList (java.util.ArrayList)52 QuestionItem (org.olat.modules.qpool.QuestionItem)28 Identity (org.olat.core.id.Identity)14 List (java.util.List)12 BusinessGroup (org.olat.group.BusinessGroup)12 Test (org.junit.Test)10 QPoolSPI (org.olat.modules.qpool.QPoolSPI)10 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)10 QItemType (org.olat.modules.qpool.model.QItemType)8 HashMap (java.util.HashMap)6 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)6 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)6 QuestionItemFull (org.olat.modules.qpool.QuestionItemFull)6 QuestionItemView (org.olat.modules.qpool.QuestionItemView)6 QItemList (org.olat.modules.qpool.model.QItemList)6 QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)6 QPoolEvent (org.olat.modules.qpool.ui.events.QPoolEvent)6 QuestionItemCollection (org.olat.modules.qpool.QuestionItemCollection)5 Path (javax.ws.rs.Path)4