use of org.olat.modules.portfolio.model.MediaPart in project OpenOLAT by OpenOLAT.
the class MediaUploadController method getPageElement.
@Override
public PageElement getPageElement() {
MediaPart part = new MediaPart();
part.setMedia(mediaReference);
return part;
}
use of org.olat.modules.portfolio.model.MediaPart in project OpenOLAT by OpenOLAT.
the class CollectVideoMediaController method getPageElement.
@Override
public PageElement getPageElement() {
MediaPart part = new MediaPart();
part.setMedia(mediaReference);
return part;
}
use of org.olat.modules.portfolio.model.MediaPart in project OpenOLAT by OpenOLAT.
the class CollectFileMediaController method getPageElement.
@Override
public PageElement getPageElement() {
MediaPart part = new MediaPart();
part.setMedia(mediaReference);
return part;
}
use of org.olat.modules.portfolio.model.MediaPart in project OpenOLAT by OpenOLAT.
the class MediaDAOTest method usedInBinders.
@Test
public void usedInBinders() {
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("pf-media-2");
Binder binder = portfolioService.createNewBinder("Binder p2", "A binder with 2 page", null, author);
Section section = binderDao.createSection("Section", "First section", null, null, binder);
dbInstance.commitAndCloseSession();
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Page page = pageDao.createAndPersist("Page 1", "A page with content.", null, null, true, reloadedSection, null);
Media media = mediaDao.createMedia("Media", "Binder", "Une citation sur les classeurs", TextHandler.TEXT_MEDIA, "[Media:0]", null, 10, author);
dbInstance.commitAndCloseSession();
MediaPart mediaPart = new MediaPart();
mediaPart.setMedia(media);
PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
pageDao.persistPart(reloadedBody, mediaPart);
dbInstance.commitAndCloseSession();
// reload
List<BinderPageUsage> binders = mediaDao.usedInBinders(media);
Assert.assertNotNull(binders);
Assert.assertEquals(1, binders.size());
Assert.assertTrue(binders.get(0).getBinderKey().equals(binder.getKey()));
}
use of org.olat.modules.portfolio.model.MediaPart in project openolat by klemens.
the class MediaDAOTest method usedInBinders.
@Test
public void usedInBinders() {
Identity author = JunitTestHelper.createAndPersistIdentityAsRndUser("pf-media-2");
Binder binder = portfolioService.createNewBinder("Binder p2", "A binder with 2 page", null, author);
Section section = binderDao.createSection("Section", "First section", null, null, binder);
dbInstance.commitAndCloseSession();
Section reloadedSection = binderDao.loadSectionByKey(section.getKey());
Page page = pageDao.createAndPersist("Page 1", "A page with content.", null, null, true, reloadedSection, null);
Media media = mediaDao.createMedia("Media", "Binder", "Une citation sur les classeurs", TextHandler.TEXT_MEDIA, "[Media:0]", null, 10, author);
dbInstance.commitAndCloseSession();
MediaPart mediaPart = new MediaPart();
mediaPart.setMedia(media);
PageBody reloadedBody = pageDao.loadPageBodyByKey(page.getBody().getKey());
pageDao.persistPart(reloadedBody, mediaPart);
dbInstance.commitAndCloseSession();
// reload
List<BinderPageUsage> binders = mediaDao.usedInBinders(media);
Assert.assertNotNull(binders);
Assert.assertEquals(1, binders.size());
Assert.assertTrue(binders.get(0).getBinderKey().equals(binder.getKey()));
}
Aggregations