Search in sources :

Example 61 with PortfolioStructureMap

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;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap)

Example 62 with PortfolioStructureMap

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;
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) RepositoryEntry(org.olat.repository.RepositoryEntry) EPMapEvent(org.olat.portfolio.ui.structel.EPMapEvent) EPMapCreatedEvent(org.olat.portfolio.ui.structel.EPMapCreatedEvent)

Example 63 with PortfolioStructureMap

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;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap)

Example 64 with PortfolioStructureMap

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));
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) User(org.olat.core.id.User) BusinessGroup(org.olat.group.BusinessGroup) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 65 with PortfolioStructureMap

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()));
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) Test(org.junit.Test)

Aggregations

PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)118 Test (org.junit.Test)64 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)54 Identity (org.olat.core.id.Identity)34 RepositoryEntry (org.olat.repository.RepositoryEntry)30 OLATResource (org.olat.resource.OLATResource)30 ArrayList (java.util.ArrayList)18 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)18 EPStructuredMap (org.olat.portfolio.model.structel.EPStructuredMap)18 EPMapPolicy (org.olat.portfolio.manager.EPMapPolicy)16 Date (java.util.Date)10 Invitation (org.olat.basesecurity.Invitation)8 Binder (org.olat.modules.portfolio.Binder)8 EPTargetResource (org.olat.portfolio.model.structel.EPTargetResource)8 EPSecurityCallback (org.olat.portfolio.EPSecurityCallback)6 EPStructureElement (org.olat.portfolio.model.structel.EPStructureElement)6 CalendarController (org.olat.commons.calendar.ui.CalendarController)4 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)4 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)4 Link (org.olat.core.gui.components.link.Link)4