Search in sources :

Example 21 with LectureBlockImpl

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

the class LectureServiceImpl method autoCloseRollCall.

@Override
public void autoCloseRollCall() {
    int period = lectureModule.getRollCallAutoClosePeriod();
    if (period > 0) {
        Date now = new Date();
        Calendar cal = Calendar.getInstance();
        cal.setTime(now);
        cal.add(Calendar.DATE, -period);
        Date endDate = cal.getTime();
        List<LectureBlockImpl> blocks = lectureBlockDao.loadOpenBlocksBefore(endDate);
        for (LectureBlockImpl block : blocks) {
            autoClose(block);
            dbInstance.commitAndCloseSession();
        }
    }
}
Also used : Calendar(java.util.Calendar) LectureBlockImpl(org.olat.modules.lecture.model.LectureBlockImpl) Date(java.util.Date)

Example 22 with LectureBlockImpl

use of org.olat.modules.lecture.model.LectureBlockImpl 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;
}
Also used : LectureBlockToGroupImpl(org.olat.modules.lecture.model.LectureBlockToGroupImpl) LectureBlockImpl(org.olat.modules.lecture.model.LectureBlockImpl)

Aggregations

LectureBlockImpl (org.olat.modules.lecture.model.LectureBlockImpl)22 Date (java.util.Date)12 Group (org.olat.basesecurity.Group)8 BusinessGroup (org.olat.group.BusinessGroup)8 LectureBlockToGroup (org.olat.modules.lecture.LectureBlockToGroup)8 ArrayList (java.util.ArrayList)4 Calendar (java.util.Calendar)4 Test (org.junit.Test)4 Identity (org.olat.core.id.Identity)4 LectureBlock (org.olat.modules.lecture.LectureBlock)4 LectureBlockRollCall (org.olat.modules.lecture.LectureBlockRollCall)4 LectureBlockToGroupImpl (org.olat.modules.lecture.model.LectureBlockToGroupImpl)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 File (java.io.File)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Locale (java.util.Locale)2 Map (java.util.Map)2