Search in sources :

Example 21 with PageBody

use of org.olat.modules.portfolio.PageBody in project openolat by klemens.

the class PageDAOTest method persistPart.

@Test
public void persistPart() {
    Page page = pageDao.createAndPersist("Page 1", "A page with content.", null, null, true, null, null);
    dbInstance.commitAndCloseSession();
    HTMLPart htmlPart = new HTMLPart();
    PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.persistPart(reloadedBody, htmlPart);
    dbInstance.commitAndCloseSession();
    TitlePart titlePart = new TitlePart();
    reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.persistPart(reloadedBody, titlePart, 0);
    dbInstance.commitAndCloseSession();
    // reload
    List<PagePart> reloadedPageParts = pageDao.getParts(reloadedBody);
    Assert.assertNotNull(reloadedPageParts);
    Assert.assertEquals(2, reloadedPageParts.size());
    Assert.assertEquals(titlePart, reloadedPageParts.get(0));
    Assert.assertEquals(htmlPart, reloadedPageParts.get(1));
}
Also used : PagePart(org.olat.modules.portfolio.PagePart) HTMLPart(org.olat.modules.portfolio.model.HTMLPart) TitlePart(org.olat.modules.portfolio.model.TitlePart) Page(org.olat.modules.portfolio.Page) PageBody(org.olat.modules.portfolio.PageBody) Test(org.junit.Test)

Example 22 with PageBody

use of org.olat.modules.portfolio.PageBody in project openolat by klemens.

the class PageDAOTest method deletePart.

@Test
public void deletePart() {
    Page page = pageDao.createAndPersist("Page 10", "A page with content.", null, null, true, null, null);
    dbInstance.commitAndCloseSession();
    HTMLPart htmlPart = new HTMLPart();
    PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.persistPart(reloadedBody, htmlPart);
    dbInstance.commitAndCloseSession();
    TitlePart titlePart = new TitlePart();
    reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.persistPart(reloadedBody, titlePart, 0);
    dbInstance.commitAndCloseSession();
    // reload
    Page reloadedPage = pageDao.loadByKey(page.getKey());
    pageDao.deletePage(reloadedPage);
    dbInstance.commit();
}
Also used : HTMLPart(org.olat.modules.portfolio.model.HTMLPart) TitlePart(org.olat.modules.portfolio.model.TitlePart) Page(org.olat.modules.portfolio.Page) PageBody(org.olat.modules.portfolio.PageBody) Test(org.junit.Test)

Example 23 with PageBody

use of org.olat.modules.portfolio.PageBody in project openolat by klemens.

the class EvaluationFormSessionDAOTest method createSessionForPortfolio.

@Test
public void createSessionForPortfolio() {
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("eva-1");
    BinderImpl binder = binderDao.createAndPersist("Binder evaluation 1", "A binder with an evaluation", null, null);
    Section section = binderDao.createSection("Section", "First section", null, null, binder);
    dbInstance.commit();
    Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
    Page page = pageDao.createAndPersist("Page 1", "A page with an evalutation.", null, null, true, reloadedSection, null);
    dbInstance.commit();
    RepositoryEntry formEntry = createFormEntry("Eva. form for session");
    PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
    EvaluationFormSession session = evaluationFormSessionDao.createSessionForPortfolio(id, reloadedBody, formEntry);
    dbInstance.commit();
    Assert.assertNotNull(session);
    Assert.assertNotNull(session.getKey());
    Assert.assertNotNull(session.getCreationDate());
    Assert.assertNotNull(session.getLastModified());
    Assert.assertEquals(reloadedBody, session.getPageBody());
    Assert.assertEquals(id, session.getIdentity());
}
Also used : EvaluationFormSession(org.olat.modules.forms.EvaluationFormSession) BinderImpl(org.olat.modules.portfolio.model.BinderImpl) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Section(org.olat.modules.portfolio.Section) PageBody(org.olat.modules.portfolio.PageBody) Test(org.junit.Test)

Example 24 with PageBody

use of org.olat.modules.portfolio.PageBody in project openolat by klemens.

the class PortfolioServiceImpl method moveUpPagePart.

@Override
public void moveUpPagePart(Page page, PagePart part) {
    PageBody body = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.moveUpPart(body, part);
}
Also used : PageBody(org.olat.modules.portfolio.PageBody)

Example 25 with PageBody

use of org.olat.modules.portfolio.PageBody in project openolat by klemens.

the class PortfolioServiceImpl method removePagePart.

@Override
public void removePagePart(Page page, PagePart part) {
    PageBody body = pageDao.loadPageBodyByKey(page.getBody().getKey());
    pageDao.removePart(body, part);
}
Also used : PageBody(org.olat.modules.portfolio.PageBody)

Aggregations

PageBody (org.olat.modules.portfolio.PageBody)26 Test (org.junit.Test)14 Page (org.olat.modules.portfolio.Page)14 Section (org.olat.modules.portfolio.Section)8 HTMLPart (org.olat.modules.portfolio.model.HTMLPart)8 Identity (org.olat.core.id.Identity)6 PagePart (org.olat.modules.portfolio.PagePart)6 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)6 TitlePart (org.olat.modules.portfolio.model.TitlePart)6 RepositoryEntry (org.olat.repository.RepositoryEntry)6 EvaluationFormSession (org.olat.modules.forms.EvaluationFormSession)4 EvaluationFormController (org.olat.modules.forms.ui.EvaluationFormController)4 Assignment (org.olat.modules.portfolio.Assignment)4 PortfolioService (org.olat.modules.portfolio.PortfolioService)4 EvaluationFormPart (org.olat.modules.portfolio.model.EvaluationFormPart)4 MultiEvaluationFormController (org.olat.modules.portfolio.ui.MultiEvaluationFormController)4 File (java.io.File)2 BigDecimal (java.math.BigDecimal)2 Path (java.nio.file.Path)2 PersistenceHelper.makeFuzzyQueryString (org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString)2