use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project OpenOLAT by OpenOLAT.
the class LectureBlockDAO method addGroupToLectureBlock.
public LectureBlock addGroupToLectureBlock(LectureBlock block, Group group) {
LectureBlockImpl reloadedBlock = (LectureBlockImpl) loadByKey(block.getKey());
LectureBlockToGroupImpl blockToGroup = new LectureBlockToGroupImpl();
blockToGroup.setGroup(group);
blockToGroup.setLectureBlock(block);
dbInstance.getCurrentEntityManager().persist(blockToGroup);
return reloadedBlock;
}
use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project openolat by klemens.
the class LectureBlockDAOTest method addGroup.
@Test
public void addGroup() {
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = lectureBlockDao.createLectureBlock(entry);
lectureBlock.setStartDate(new Date());
lectureBlock.setEndDate(new Date());
lectureBlock.setTitle("Hello lecturers");
lectureBlock = lectureBlockDao.update(lectureBlock);
dbInstance.commitAndCloseSession();
Group defGroup = repositoryEntryRelationDao.getDefaultGroup(entry);
lectureBlockDao.addGroupToLectureBlock(lectureBlock, defGroup);
dbInstance.commitAndCloseSession();
LectureBlockImpl reloadedLectureBlock = (LectureBlockImpl) lectureBlockDao.loadByKey(lectureBlock.getKey());
Set<LectureBlockToGroup> blockToGroupSet = reloadedLectureBlock.getGroups();
Assert.assertNotNull(blockToGroupSet);
Assert.assertEquals(1, blockToGroupSet.size());
LectureBlockToGroupImpl defBlockToGroup = (LectureBlockToGroupImpl) blockToGroupSet.iterator().next();
Assert.assertEquals(defGroup, defBlockToGroup.getGroup());
Assert.assertEquals(lectureBlock, defBlockToGroup.getLectureBlock());
}
use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project openolat by klemens.
the class LectureBlockDAO method addGroupToLectureBlock.
public LectureBlock addGroupToLectureBlock(LectureBlock block, Group group) {
LectureBlockImpl reloadedBlock = (LectureBlockImpl) loadByKey(block.getKey());
LectureBlockToGroupImpl blockToGroup = new LectureBlockToGroupImpl();
blockToGroup.setGroup(group);
blockToGroup.setLectureBlock(block);
dbInstance.getCurrentEntityManager().persist(blockToGroup);
return reloadedBlock;
}
Aggregations