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));
}
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();
}
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());
}
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);
}
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);
}
Aggregations