use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.
the class QuestionPoolServiceImpl method removeItemsInPool.
@Override
public void removeItemsInPool(List<QuestionItemShort> items, Pool pool) {
poolDao.removeFromPool(items, pool);
List<Long> keys = new ArrayList<>(items.size());
for (QuestionItemShort item : items) {
keys.add(item.getKey());
}
lifeIndexer.indexDocument(QItemDocument.TYPE, keys);
}
use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.
the class QuestionPoolServiceImpl method addItemsInPools.
@Override
public void addItemsInPools(List<? extends QuestionItemShort> items, List<Pool> pools, boolean editable) {
if (items == null || items.isEmpty() || pools == null || pools.isEmpty()) {
// nothing to do
return;
}
List<Long> keys = new ArrayList<>(items.size());
for (QuestionItemShort item : items) {
poolDao.addItemToPool(item, pools, editable);
keys.add(item.getKey());
}
dbInstance.commit();
lifeIndexer.indexDocument(QItemDocument.TYPE, keys);
}
use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.
the class QuestionPoolServiceImpl method index.
@Override
public void index(List<? extends QuestionItemShort> items) {
if (items == null || items.isEmpty())
return;
List<Long> keys = new ArrayList<>();
for (QuestionItemShort item : items) {
keys.add(item.getKey());
}
lifeIndexer.indexDocument(QItemDocument.TYPE, keys);
}
use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.
the class QuestionPoolServiceImpl method shareItemsWithGroups.
@Override
public void shareItemsWithGroups(List<? extends QuestionItemShort> items, List<BusinessGroup> groups, boolean editable) {
if (items == null || items.isEmpty() || groups == null || groups.isEmpty()) {
// nothing to do
return;
}
List<OLATResource> resources = new ArrayList<OLATResource>(groups.size());
for (BusinessGroup group : groups) {
resources.add(group.getResource());
}
for (QuestionItemShort item : items) {
questionItemDao.share(item, resources, editable);
}
index(items);
}
use of org.olat.modules.qpool.QuestionItemShort in project openolat by klemens.
the class QuestionItemDAO method removeFromShare.
public int removeFromShare(List<QuestionItemShort> items, OLATResource resource) {
List<Long> keys = new ArrayList<>();
for (QuestionItemShort item : items) {
keys.add(item.getKey());
}
StringBuilder sb = new StringBuilder();
sb.append("delete from qshareitem share where share.item.key in (:itemKeys) and share.resource.key=:resourceKey");
return dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("itemKeys", keys).setParameter("resourceKey", resource.getKey()).executeUpdate();
}
Aggregations