use of org.olat.modules.qpool.model.PoolImpl in project OpenOLAT by OpenOLAT.
the class PoolDAO method createPool.
public PoolImpl createPool(Identity owner, String name, boolean publicPool) {
PoolImpl pool = new PoolImpl();
pool.setCreationDate(new Date());
pool.setLastModified(new Date());
pool.setName(name);
pool.setPublicPool(publicPool);
SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
pool.setOwnerGroup(ownerGroup);
dbInstance.getCurrentEntityManager().persist(pool);
if (owner != null) {
securityManager.addIdentityToSecurityGroup(owner, ownerGroup);
}
return pool;
}
use of org.olat.modules.qpool.model.PoolImpl in project openolat by klemens.
the class PoolsAdminController method doManageOwners.
private void doManageOwners(UserRequest ureq, Pool pool) {
if (pool instanceof PoolImpl) {
PoolImpl poolImpl = (PoolImpl) pool;
groupCtrl = new GroupController(ureq, getWindowControl(), true, true, false, true, false, false, poolImpl.getOwnerGroup());
groupCtrl.setUserObject(pool);
listenTo(groupCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), groupCtrl.getInitialComponent(), true, translate("pool.owners"));
cmc.activate();
listenTo(cmc);
}
}
use of org.olat.modules.qpool.model.PoolImpl in project openolat by klemens.
the class PoolDAO method deletePool.
public void deletePool(Pool pool) {
StringBuilder sb = new StringBuilder();
sb.append("delete from qpool2item pool2item where pool2item.pool.key=:poolKey");
dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("poolKey", pool.getKey()).executeUpdate();
PoolImpl poolRef = dbInstance.getCurrentEntityManager().getReference(PoolImpl.class, pool.getKey());
dbInstance.getCurrentEntityManager().remove(poolRef);
}
use of org.olat.modules.qpool.model.PoolImpl in project OpenOLAT by OpenOLAT.
the class PoolDAO method deletePool.
public void deletePool(Pool pool) {
StringBuilder sb = new StringBuilder();
sb.append("delete from qpool2item pool2item where pool2item.pool.key=:poolKey");
dbInstance.getCurrentEntityManager().createQuery(sb.toString()).setParameter("poolKey", pool.getKey()).executeUpdate();
PoolImpl poolRef = dbInstance.getCurrentEntityManager().getReference(PoolImpl.class, pool.getKey());
dbInstance.getCurrentEntityManager().remove(poolRef);
}
use of org.olat.modules.qpool.model.PoolImpl in project OpenOLAT by OpenOLAT.
the class QuestionPoolServiceImpl method removeOwners.
@Override
public void removeOwners(List<Identity> owners, List<Pool> pools) {
if (owners == null || owners.isEmpty() || pools == null || pools.isEmpty()) {
// nothing to do
return;
}
List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(pools.size());
for (Pool pool : pools) {
SecurityGroup secGroup = ((PoolImpl) pool).getOwnerGroup();
secGroups.add(secGroup);
}
securityManager.removeIdentityFromSecurityGroups(owners, secGroups);
}
Aggregations