use of org.olat.modules.qpool.QuestionItemShort in project OpenOLAT by OpenOLAT.
the class QuestionPoolServiceImpl method addItemToCollection.
@Override
public void addItemToCollection(List<? extends QuestionItemShort> items, List<QuestionItemCollection> collections) {
List<Long> keys = new ArrayList<>(items.size());
for (QuestionItemShort item : items) {
collectionDao.addItemToCollection(item, collections);
keys.add(item.getKey());
}
lifeIndexer.indexDocument(QItemDocument.TYPE, keys);
}
use of org.olat.modules.qpool.QuestionItemShort in project OpenOLAT by OpenOLAT.
the class QuestionItemDAO method removeFromShares.
public int removeFromShares(List<? extends QuestionItemShort> items) {
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)");
return dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("itemKeys", keys).executeUpdate();
}
use of org.olat.modules.qpool.QuestionItemShort in project OpenOLAT by OpenOLAT.
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();
}
use of org.olat.modules.qpool.QuestionItemShort in project OpenOLAT by OpenOLAT.
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();
}
use of org.olat.modules.qpool.QuestionItemShort in project OpenOLAT by OpenOLAT.
the class RightsMetadataEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == groupController) {
if (event instanceof IdentitiesAddEvent) {
IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
List<Identity> list = identitiesAddedEvent.getAddIdentities();
qpoolService.addAuthors(list, Collections.<QuestionItemShort>singletonList(item));
identitiesAddedEvent.getAddedIdentities().addAll(list);
} else if (event instanceof IdentitiesRemoveEvent) {
IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
qpoolService.removeAuthors(list, Collections.<QuestionItemShort>singletonList(item));
}
reloadAuthors();
// cmc.deactivate();
// cleanUp();
} else if (source == cmc) {
fireEvent(ureq, new QItemEdited(item));
cleanUp();
}
super.event(ureq, source, event);
}
Aggregations