use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
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 klemens.
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 klemens.
the class EPStructureManagerTest method testUseStructureMapTemplate.
@Test
public void testUseStructureMapTemplate() {
// save parent and 20 children
PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(ident1, "paged-parent-structure-el", "parent-structure-element");
epStructureManager.savePortfolioStructure(template);
dbInstance.commitAndCloseSession();
PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioStructuredMap(template, ident1, "cloned-map", "cloned-map-from-template", null, null, null);
((EPStructuredMap) map).setReturnDate(new Date());
EPTargetResource targetResource = ((EPStructuredMap) map).getTargetResource();
targetResource.setResourceableTypeName("CourseModule");
targetResource.setResourceableId(234l);
targetResource.setSubPath("3894580");
targetResource.setBusinessPath("[RepositoryEntry:23647598][CourseNode:934598]");
epStructureManager.savePortfolioStructure(map);
dbInstance.commitAndCloseSession();
// test
PortfolioStructureMap retrievedMap = (PortfolioStructureMap) epFrontendManager.loadPortfolioStructureByKey(map.getKey());
assertNotNull(retrievedMap);
assertNotNull(((EPStructuredMap) retrievedMap).getReturnDate());
assertNotNull(((EPStructuredMap) retrievedMap).getStructuredMapSource());
assertNotNull(((EPStructuredMap) retrievedMap).getTargetResource());
EPTargetResource retriviedTargetResource = ((EPStructuredMap) retrievedMap).getTargetResource();
assertEquals("CourseModule", retriviedTargetResource.getResourceableTypeName());
assertEquals(new Long(234l), retriviedTargetResource.getResourceableId());
assertEquals("3894580", retriviedTargetResource.getSubPath());
assertEquals("[RepositoryEntry:23647598][CourseNode:934598]", retriviedTargetResource.getBusinessPath());
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPStructureManagerTest method loadPortfolioStructure_resourceable.
@Test
public void loadPortfolioStructure_resourceable() {
Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("EP-res-tmp-");
// a template
PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(user, "resourced-el", "resource-element");
epStructureManager.savePortfolioStructure(template);
dbInstance.commitAndCloseSession();
OLATResource resource = template.getOlatResource();
PortfolioStructure structure = epStructureManager.loadPortfolioStructure(resource);
Assert.assertNotNull(structure);
Assert.assertEquals(template, structure);
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPStructureManager method createPortfolioStructure.
/**
* Create a basic structure element
* @param title
* @param description
* @return The structure element
*/
protected PortfolioStructure createPortfolioStructure(PortfolioStructure root, String title, String description) {
EPStructureElement el = new EPStructureElement();
el.setRoot((EPStructureElement) root);
if (root != null && root.getRootMap() == null && root instanceof PortfolioStructureMap) {
el.setRootMap((PortfolioStructureMap) root);
} else if (root != null) {
el.setRootMap(root.getRootMap());
}
return fillStructureElement(el, title, description);
}
Aggregations