use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPFrontendManager method createAndPersistPortfolioStructuredMap.
/**
* Create a structured map, based on template.
*
* @param identity The author/owner of the map
* @param title
* @param description
* @return The structure element
*/
public PortfolioStructureMap createAndPersistPortfolioStructuredMap(PortfolioStructureMap template, Identity identity, String title, String description, OLATResourceable targetOres, String targetSubPath, String targetBusinessPath) {
PortfolioStructureMap map = structureManager.createPortfolioStructuredMap(template, identity, title, description, targetOres, targetSubPath, targetBusinessPath);
structureManager.savePortfolioStructure(map);
return map;
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPFrontendManager method createAndPersistPortfolioDefaultMap.
/**
* Create a map for a user
* @param root
* @param identity
* @param title
* @param description
* @return
*/
public PortfolioStructureMap createAndPersistPortfolioDefaultMap(Identity identity, String title, String description) {
PortfolioStructureMap map = structureManager.createPortfolioDefaultMap(identity, title, description);
structureManager.savePortfolioStructure(map);
return map;
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPMapRunController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == createMapBox) {
popDownCreateMapBox();
} else if (source == createMapCtrl) {
if (event instanceof EPMapCreatedEvent) {
PortfolioStructureMap newMap = ((EPMapCreatedEvent) event).getPortfolioStructureMap();
multiMapCtrl.activateMap(ureq, newMap);
}
createMapBox.deactivate();
popDownCreateMapBox();
toogleHeader(false);
} else if (source == searchTemplateCtrl) {
if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
RepositoryEntry repoEntry = searchTemplateCtrl.getSelectedEntry();
PortfolioStructureMap newMap = createMapFromTemplate(repoEntry);
multiMapCtrl.activateMap(ureq, newMap);
}
createMapBox.deactivate();
popDownCreateMapBox();
} else if (source == multiMapCtrl) {
if (event instanceof EPMapEvent) {
String cmd = event.getCommand();
if (EPStructureEvent.SELECT.equals(cmd)) {
toogleHeader(false);
} else if (EPStructureEvent.CLOSE.equals(cmd)) {
toogleHeader(true);
}
}
} else if (source == mapCreateCalloutCtrl && event == CloseableCalloutWindowController.CLOSE_WINDOW_EVENT) {
removeAsListenerAndDispose(mapCreateCalloutCtrl);
mapCreateCalloutCtrl = null;
}
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPMapRunController method createMapFromTemplate.
private PortfolioStructureMap createMapFromTemplate(RepositoryEntry repoEntry) {
PortfolioStructureMap template = (PortfolioStructureMap) ePFMgr.loadPortfolioStructure(repoEntry.getOlatResource());
PortfolioStructureMap copy = ePFMgr.createAndPersistPortfolioDefaultMap(getIdentity(), template.getTitle(), template.getDescription());
ePFMgr.copyStructureRecursively(template, copy, true);
return copy;
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.
the class EPFrontendManagerTest method allMapPolicies.
@Test
public void allMapPolicies() {
// create a map
PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioDefaultMap(ident1, "Policies", "Description");
PortfolioStructure page1 = epFrontendManager.createAndPersistPortfolioPage(map, "Page policies", "Page description");
assertNotNull(page1);
dbInstance.commitAndCloseSession();
// save a list of policies
List<EPMapPolicy> policies = new ArrayList<EPMapPolicy>();
// user policy
EPMapPolicy userPolicy = new EPMapPolicy();
userPolicy.setType(Type.user);
userPolicy.getIdentities().add(ident2);
userPolicy.getIdentities().add(ident3);
policies.add(userPolicy);
// invitation
Invitation invitation = invitationDao.createAndPersistInvitation();
invitation.setFirstName("John");
invitation.setLastName("Doe");
invitation.setMail("john@doe.ch");
EPMapPolicy invitationPolicy = new EPMapPolicy();
invitationPolicy.setType(Type.invitation);
invitationPolicy.setInvitation(invitation);
policies.add(invitationPolicy);
epFrontendManager.updateMapPolicies(map, policies);
dbInstance.commitAndCloseSession();
// check visiblity (is owner)
assertTrue(epFrontendManager.isMapVisible(ident1, map.getOlatResource()));
// check visibility (is in policy)
assertTrue(epFrontendManager.isMapVisible(ident2, map.getOlatResource()));
// check visible (is in policy)
assertTrue(epFrontendManager.isMapVisible(ident3, map.getOlatResource()));
// retrieved policies
List<EPMapPolicy> savedPolicies = epFrontendManager.getMapPolicies(map);
assertTrue(!savedPolicies.isEmpty());
}
Aggregations