Search in sources :

Example 1 with LectureBlockToGroupImpl

use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project openolat by klemens.

the class LectureBlockToGroupDAO method remove.

public void remove(LectureBlockToGroup lectureBlockToGroup) {
    LectureBlockToGroupImpl ref = dbInstance.getCurrentEntityManager().getReference(LectureBlockToGroupImpl.class, lectureBlockToGroup.getKey());
    dbInstance.getCurrentEntityManager().remove(ref);
}
Also used : LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl)

Example 2 with LectureBlockToGroupImpl

use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project openolat by klemens.

the class LectureBlockToGroupDAO method createAndPersist.

public LectureBlockToGroup createAndPersist(LectureBlock lectureBlock, Group group) {
    LectureBlockToGroupImpl blockToGroup = new LectureBlockToGroupImpl();
    blockToGroup.setLectureBlock(lectureBlock);
    blockToGroup.setGroup(group);
    dbInstance.getCurrentEntityManager().persist(blockToGroup);
    return blockToGroup;
}
Also used : LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl)

Example 3 with LectureBlockToGroupImpl

use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project OpenOLAT by OpenOLAT.

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());
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) Group(org.olat.basesecurity.Group) LectureBlockToGroup(org.olat.modules.lecture.LectureBlockToGroup) BusinessGroup(org.olat.group.BusinessGroup) LectureBlockToGroup(org.olat.modules.lecture.LectureBlockToGroup) LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl) RepositoryEntry(org.olat.repository.RepositoryEntry) LectureBlockImpl(org.olat.modules.lecture.model.LectureBlockImpl) Date(java.util.Date) Test(org.junit.Test)

Example 4 with LectureBlockToGroupImpl

use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project OpenOLAT by OpenOLAT.

the class LectureBlockToGroupDAO method remove.

public void remove(LectureBlockToGroup lectureBlockToGroup) {
    LectureBlockToGroupImpl ref = dbInstance.getCurrentEntityManager().getReference(LectureBlockToGroupImpl.class, lectureBlockToGroup.getKey());
    dbInstance.getCurrentEntityManager().remove(ref);
}
Also used : LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl)

Example 5 with LectureBlockToGroupImpl

use of org.olat.modules.lecture.model.LectureBlockToGroupImpl in project OpenOLAT by OpenOLAT.

the class LectureBlockToGroupDAO method createAndPersist.

public LectureBlockToGroup createAndPersist(LectureBlock lectureBlock, Group group) {
    LectureBlockToGroupImpl blockToGroup = new LectureBlockToGroupImpl();
    blockToGroup.setLectureBlock(lectureBlock);
    blockToGroup.setGroup(group);
    dbInstance.getCurrentEntityManager().persist(blockToGroup);
    return blockToGroup;
}
Also used : LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl)

Aggregations

LectureBlockToGroupImpl (org.olat.modules.lecture.model.LectureBlockToGroupImpl)8 LectureBlockImpl (org.olat.modules.lecture.model.LectureBlockImpl)4 Date (java.util.Date)2 Test (org.junit.Test)2 Group (org.olat.basesecurity.Group)2 BusinessGroup (org.olat.group.BusinessGroup)2 LectureBlock (org.olat.modules.lecture.LectureBlock)2 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2