use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class PortfolioHandler method createResource.
@Override
public RepositoryEntry createResource(Identity initialAuthor, String displayname, String description, Object createObject, Locale locale) {
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
EPStructureManager eSTMgr = CoreSpringFactory.getImpl(EPStructureManager.class);
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
OLATResource resource = eSTMgr.createPortfolioMapTemplateResource();
RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
PortfolioStructureMap mapTemp = eSTMgr.createAndPersistPortfolioMapTemplateFromEntry(initialAuthor, re);
// add a page, as each map should have at least one per default!
Translator pt = Util.createPackageTranslator(EPCreateMapController.class, locale);
String pageTitle = pt.translate("new.page.title");
String pageDescription = pt.translate("new.page.desc");
ePFMgr.createAndPersistPortfolioPage(mapTemp, pageTitle, pageDescription);
DBFactory.getInstance().commit();
return re;
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPImportTest method testImportFromOpenOLAT_81_Hibernate3.
@Test
public void testImportFromOpenOLAT_81_Hibernate3() throws URISyntaxException {
URL mapUrl = EPImportTest.class.getResource("map_81.xml.zip");
assertNotNull(mapUrl);
File mapFile = new File(mapUrl.toURI());
PortfolioStructure rootStructure = EPXStreamHandler.getAsObject(mapFile, false);
OLATResource resource = epStructureManager.createPortfolioMapTemplateResource();
// import the map
PortfolioStructureMap importedMap = epFrontendManager.importPortfolioMapTemplate(rootStructure, resource);
Assert.assertNotNull(importedMap);
dbInstance.commitAndCloseSession();
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPPolicyManagerTest method getOwners.
@Test
public void getOwners() {
// create a map
Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("Policy-User-1-");
PortfolioStructureMap originalMap = epFrontendManager.createAndPersistPortfolioDefaultMap(user, "Title", "Description");
PortfolioStructure page1 = epFrontendManager.createAndPersistPortfolioPage(originalMap, "Page title", "Page description");
assertNotNull(page1);
dbInstance.commitAndCloseSession();
List<Identity> owners = policyManager.getOwners(originalMap);
Assert.assertNotNull(owners);
Assert.assertEquals(1, owners.size());
Assert.assertEquals(user, owners.get(0));
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPPolicyManagerTest method isMapShared_HQL.
@Test
public void isMapShared_HQL() {
Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("Policy-User-2-");
PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioDefaultMap(user, "Title", "Description");
dbInstance.commitAndCloseSession();
boolean shared = policyManager.isMapShared(map.getOlatResource());
Assert.assertFalse(shared);
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPMultipleMapController method activateMap.
private void activateMap(UserRequest ureq, Long mapKey) {
if (mapKey == null)
return;
boolean foundTheMap = false;
// we have a key, find the corresponding map with the current option (restrcited view or not)
for (PortfolioStructureMap map : userMaps) {
if (map.getKey().equals(mapKey) || (map.getResourceableId().equals(mapKey))) {
activateMap(ureq, map);
fireEvent(ureq, new EPMapEvent(EPStructureEvent.SELECT, map));
foundTheMap = true;
break;
}
}
if (!foundTheMap) {
// map not found, switch the option and retry to found the map
restrictShareView = !restrictShareView;
initOrUpdateMaps(ureq);
for (PortfolioStructureMap map : userMaps) {
if (map.getKey().equals(mapKey) || (map.getResourceableId().equals(mapKey))) {
activateMap(ureq, map);
fireEvent(ureq, new EPMapEvent(EPStructureEvent.SELECT, map));
break;
}
}
}
}
Aggregations