Search in sources :

Example 1 with PoolToItem

use of org.olat.modules.qpool.model.PoolToItem in project OpenOLAT by OpenOLAT.

the class PoolDAO method addItemToPool.

public void addItemToPool(QuestionItemShort item, List<Pool> pools, boolean editable) {
    QuestionItem lockedItem = questionItemDao.loadForUpdate(item);
    for (Pool pool : pools) {
        if (!isInPool(lockedItem, pool)) {
            PoolToItem p2i = new PoolToItem();
            p2i.setCreationDate(new Date());
            p2i.setItem(lockedItem);
            p2i.setEditable(editable);
            p2i.setPool(pool);
            dbInstance.getCurrentEntityManager().persist(p2i);
        }
    }
    // release lock asap
    dbInstance.commit();
}
Also used : PoolToItem(org.olat.modules.qpool.model.PoolToItem) QuestionItem2Pool(org.olat.modules.qpool.QuestionItem2Pool) Pool(org.olat.modules.qpool.Pool) QuestionItem(org.olat.modules.qpool.QuestionItem) Date(java.util.Date)

Example 2 with PoolToItem

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

the class PoolDAO method addItemToPool.

public void addItemToPool(QuestionItemShort item, List<Pool> pools, boolean editable) {
    QuestionItem lockedItem = questionItemDao.loadForUpdate(item);
    for (Pool pool : pools) {
        if (!isInPool(lockedItem, pool)) {
            PoolToItem p2i = new PoolToItem();
            p2i.setCreationDate(new Date());
            p2i.setItem(lockedItem);
            p2i.setEditable(editable);
            p2i.setPool(pool);
            dbInstance.getCurrentEntityManager().persist(p2i);
        }
    }
    // release lock asap
    dbInstance.commit();
}
Also used : PoolToItem(org.olat.modules.qpool.model.PoolToItem) QuestionItem2Pool(org.olat.modules.qpool.QuestionItem2Pool) Pool(org.olat.modules.qpool.Pool) QuestionItem(org.olat.modules.qpool.QuestionItem) Date(java.util.Date)

Aggregations

Date (java.util.Date)2 Pool (org.olat.modules.qpool.Pool)2 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QuestionItem2Pool (org.olat.modules.qpool.QuestionItem2Pool)2 PoolToItem (org.olat.modules.qpool.model.PoolToItem)2