Search in sources :

Example 86 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method updatePageUserInfosRestricted_nothing.

@Test
public void updatePageUserInfosRestricted_nothing() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-5");
    BinderImpl binder = binderDao.createAndPersist("Binder pui5", "A binder with a page for infos to batch udate", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // update
    pageUserInfosDao.updateStatus(page, PageUserStatus.done, PageUserStatus.incoming);
    dbInstance.commitAndCloseSession();
    // check nothing changed
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(PageUserStatus.inProcess, reloadedInfos.getStatus());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 87 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method getPageUserInfos.

@Test
public void getPageUserInfos() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-2");
    BinderImpl binder = binderDao.createAndPersist("Binder pui1", "A binder with a page for infos", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(coach, reloadedInfos.getIdentity());
    Assert.assertEquals(page, reloadedInfos.getPage());
    Assert.assertEquals(PageUserStatus.inProcess, reloadedInfos.getStatus());
    Assert.assertFalse(reloadedInfos.isMark());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 88 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method updatePageUserInfos.

@Test
public void updatePageUserInfos() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-2");
    BinderImpl binder = binderDao.createAndPersist("Binder pui1", "A binder with a page for infos", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // update
    pageUserInfosDao.updateStatus(page, PageUserStatus.done);
    dbInstance.commitAndCloseSession();
    // check
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    Assert.assertEquals(PageUserStatus.done, reloadedInfos.getStatus());
    dbInstance.commit();
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 89 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class PageUserInfosDAOTest method deletePageUserInfosRestricted_page.

@Test
public void deletePageUserInfosRestricted_page() {
    Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("pui-6");
    BinderImpl binder = binderDao.createAndPersist("Binder pui6", "A binder with a page for infos to delete", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    Page page = pageDao.createAndPersist("New page", "A brand new page.", null, null, true, section, null);
    PageUserInformations infos = pageUserInfosDao.create(PageUserStatus.inProcess, page, coach);
    dbInstance.commitAndCloseSession();
    // check that we have something to delete
    PageUserInformations reloadedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNotNull(reloadedInfos);
    Assert.assertEquals(infos, reloadedInfos);
    // update
    pageUserInfosDao.delete(page);
    dbInstance.commitAndCloseSession();
    // check that we have deleted something
    PageUserInformations deletedInfos = pageUserInfosDao.getPageUserInfos(page, coach);
    Assert.assertNull(deletedInfos);
}
Also used : PageUserInformations(org.olat.modules.portfolio.PageUserInformations) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) Test(org.junit.Test)

Example 90 with Page

use of org.olat.modules.portfolio.Page in project OpenOLAT by OpenOLAT.

the class DeletedPageListController method doRestorePage.

private void doRestorePage(UserRequest ureq, PortfolioElementRow row) {
    Page reloadedPage = portfolioService.getPageByKey(row.getPage().getKey());
    restorePageCtrl = new RestorePageController(ureq, getWindowControl(), reloadedPage);
    listenTo(restorePageCtrl);
    String title = translate("restore.page");
    cmc = new CloseableModalController(getWindowControl(), null, restorePageCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Page(org.olat.modules.portfolio.Page)

Aggregations

Page (org.olat.modules.portfolio.Page)136 Section (org.olat.modules.portfolio.Section)98 Test (org.junit.Test)70 Identity (org.olat.core.id.Identity)64 Binder (org.olat.modules.portfolio.Binder)44 ArrayList (java.util.ArrayList)32 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)32 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)26 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)26 Assignment (org.olat.modules.portfolio.Assignment)24 RepositoryEntry (org.olat.repository.RepositoryEntry)22 HashMap (java.util.HashMap)20 SectionRef (org.olat.modules.portfolio.SectionRef)20 PageUserInformations (org.olat.modules.portfolio.PageUserInformations)18 AssessedPage (org.olat.modules.portfolio.model.AssessedPage)16 PageBody (org.olat.modules.portfolio.PageBody)14 OLATResourceable (org.olat.core.id.OLATResourceable)12 AccessRights (org.olat.modules.portfolio.model.AccessRights)12 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)10 Date (java.util.Date)8