use of org.olat.modules.lecture.model.LecturesBlockSearchParameters in project openolat by klemens.
the class LectureBlockDAOTest method loadByTeachers_startDate.
@Test
public void loadByTeachers_startDate() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-3");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
// search lectures with the string
LecturesBlockSearchParameters searchNowParams = new LecturesBlockSearchParameters();
Calendar now = Calendar.getInstance();
now.add(Calendar.DATE, -1);
searchNowParams.setStartDate(now.getTime());
List<LectureBlock> blocks = lectureBlockDao.loadByTeacher(teacher, searchNowParams);
Assert.assertNotNull(blocks);
Assert.assertEquals(1, blocks.size());
Assert.assertEquals(lectureBlock, blocks.get(0));
// search in future
LecturesBlockSearchParameters searchFutureParams = new LecturesBlockSearchParameters();
now.add(Calendar.DATE, 2);
searchFutureParams.setStartDate(now.getTime());
List<LectureBlock> futureBlocks = lectureBlockDao.loadByTeacher(teacher, searchFutureParams);
Assert.assertNotNull(futureBlocks);
Assert.assertEquals(0, futureBlocks.size());
}
use of org.olat.modules.lecture.model.LecturesBlockSearchParameters in project openolat by klemens.
the class LectureBlockDAOTest method loadByTeachers.
@Test
public void loadByTeachers() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-1");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
// search all
LecturesBlockSearchParameters searchParams = new LecturesBlockSearchParameters();
List<LectureBlock> blocks = lectureBlockDao.loadByTeacher(teacher, searchParams);
Assert.assertNotNull(blocks);
Assert.assertEquals(1, blocks.size());
Assert.assertEquals(lectureBlock, blocks.get(0));
}
use of org.olat.modules.lecture.model.LecturesBlockSearchParameters in project openolat by klemens.
the class AbstractTeacherOverviewController method doSearch.
private void doSearch(SearchLecturesBlockEvent event) {
LecturesBlockSearchParameters searchParams = new LecturesBlockSearchParameters();
searchParams.setSearchString(event.getSearchString());
searchParams.setStartDate(event.getStartDate());
searchParams.setEndDate(event.getEndDate());
loadModel(searchParams);
}
use of org.olat.modules.lecture.model.LecturesBlockSearchParameters in project OpenOLAT by OpenOLAT.
the class LectureBlockDAOTest method loadByTeachers_startDate.
@Test
public void loadByTeachers_startDate() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-3");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
// search lectures with the string
LecturesBlockSearchParameters searchNowParams = new LecturesBlockSearchParameters();
Calendar now = Calendar.getInstance();
now.add(Calendar.DATE, -1);
searchNowParams.setStartDate(now.getTime());
List<LectureBlock> blocks = lectureBlockDao.loadByTeacher(teacher, searchNowParams);
Assert.assertNotNull(blocks);
Assert.assertEquals(1, blocks.size());
Assert.assertEquals(lectureBlock, blocks.get(0));
// search in future
LecturesBlockSearchParameters searchFutureParams = new LecturesBlockSearchParameters();
now.add(Calendar.DATE, 2);
searchFutureParams.setStartDate(now.getTime());
List<LectureBlock> futureBlocks = lectureBlockDao.loadByTeacher(teacher, searchFutureParams);
Assert.assertNotNull(futureBlocks);
Assert.assertEquals(0, futureBlocks.size());
}
use of org.olat.modules.lecture.model.LecturesBlockSearchParameters in project OpenOLAT by OpenOLAT.
the class LectureBlockDAOTest method loadByTeachers_searchString.
@Test
public void loadByTeachers_searchString() {
Identity teacher = JunitTestHelper.createAndPersistIdentityAsRndUser("teacher-1");
RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
LectureBlock lectureBlock = createMinimalLectureBlock(entry);
dbInstance.commitAndCloseSession();
lectureService.addTeacher(lectureBlock, teacher);
dbInstance.commitAndCloseSession();
// search lectures with the string
LecturesBlockSearchParameters searchParams = new LecturesBlockSearchParameters();
searchParams.setSearchString("lecturers");
List<LectureBlock> blocks = lectureBlockDao.loadByTeacher(teacher, searchParams);
Assert.assertNotNull(blocks);
Assert.assertEquals(1, blocks.size());
Assert.assertEquals(lectureBlock, blocks.get(0));
// search lectures with a string which is not available to this teacher
LecturesBlockSearchParameters searchNegativeParams = new LecturesBlockSearchParameters();
searchNegativeParams.setSearchString("goodbye");
List<LectureBlock> negativeBlocks = lectureBlockDao.loadByTeacher(teacher, searchNegativeParams);
Assert.assertNotNull(negativeBlocks);
Assert.assertEquals(0, negativeBlocks.size());
}
Aggregations