use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPFrontendManager method createAndPersistPortfolioDefaultMap.
/**
* Create a map for a group
* @param root
* @param group
* @param title
* @param description
* @return
*/
public PortfolioStructureMap createAndPersistPortfolioDefaultMap(String title, String description) {
PortfolioStructureMap map = structureManager.createPortfolioDefaultMap(title, description);
structureManager.savePortfolioStructure(map);
return map;
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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 OpenOLAT.
the class UserDeletionManagerTest method testDeleteIdentity.
@Test
public void testDeleteIdentity() {
String username = "id-to-del-" + UUID.randomUUID();
String email = username + "@frentix.com";
User user = userManager.createUser("first" + username, "last" + username, email);
user.setProperty(UserConstants.COUNTRY, "");
user.setProperty(UserConstants.CITY, "Basel");
user.setProperty(UserConstants.INSTITUTIONALNAME, "Del-23");
user.setProperty(UserConstants.INSTITUTIONALUSERIDENTIFIER, "Del-24");
Identity identity = securityManager.createAndPersistIdentityAndUser(username, null, user, BaseSecurityModule.getDefaultAuthProviderIdentifier(), username, "secret");
dbInstance.commitAndCloseSession();
// add some stuff
// a default map
PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioDefaultMap(identity, "A map to delete", "This map must be deleted");
Assert.assertNotNull(map);
// a template
PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(identity, "A template to delete", "This template must be deleted");
epStructureManager.savePortfolioStructure(template);
// an artefact
AbstractArtefact artefact = epFrontendManager.createAndPersistArtefact(identity, "Forum");
dbInstance.commit();
Assert.assertNotNull(artefact);
// a group
BusinessGroup group = businessGroupService.createBusinessGroup(identity, "Group", "Group", -1, -1, false, false, null);
Assert.assertNotNull(group);
dbInstance.commitAndCloseSession();
// delete the identity
userDeletionManager.deleteIdentity(identity);
dbInstance.commit();
// check
Identity deletedIdentity = securityManager.loadIdentityByKey(identity.getKey());
Assert.assertNotNull(deletedIdentity);
// check that the artefacts are deleted
List<AbstractArtefact> artefacts = epFrontendManager.getArtefactPoolForUser(deletedIdentity);
Assert.assertNull(artefacts);
// check that the maps are deleted (1)
List<PortfolioStructure> maps = epFrontendManager.getStructureElementsForUser(deletedIdentity, ElementType.DEFAULT_MAP);
Assert.assertNotNull(maps);
Assert.assertEquals(0, maps.size());
// check that the maps are deleted (2)
PortfolioStructure deletedMap = epStructureManager.loadPortfolioStructureByKey(map.getKey());
Assert.assertNull(deletedMap);
// check membership of group
boolean isMember = businessGroupService.isIdentityInBusinessGroup(deletedIdentity, group);
Assert.assertFalse(isMember);
User deletedUser = deletedIdentity.getUser();
String institutionalName = deletedUser.getProperty(UserConstants.INSTITUTIONALNAME, null);
Assert.assertFalse(StringHelper.containsNonWhitespace(institutionalName));
String institutionalId = deletedUser.getProperty(UserConstants.INSTITUTIONALUSERIDENTIFIER, null);
Assert.assertFalse(StringHelper.containsNonWhitespace(institutionalId));
String deletedEmail = deletedUser.getProperty(UserConstants.EMAIL, null);
Assert.assertNotNull(deletedEmail);
Assert.assertFalse(email.equals(deletedEmail));
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPFrontendManagerTest method isMapOwner.
@Test
public void isMapOwner() {
// create a map
PortfolioStructureMap originalMap = epFrontendManager.createAndPersistPortfolioDefaultMap(ident1, "Title", "Description");
PortfolioStructure page1 = epFrontendManager.createAndPersistPortfolioPage(originalMap, "Page title", "Page description");
assertNotNull(page1);
dbInstance.commitAndCloseSession();
// check if ident1 is owner
assertTrue(epFrontendManager.isMapOwner(ident1, originalMap.getOlatResource()));
// check if ident2 is not owner
assertFalse(epFrontendManager.isMapOwner(ident2, originalMap.getOlatResource()));
}
Aggregations