Search in sources :

Example 6 with EPDefaultMap

use of org.olat.portfolio.model.structel.EPDefaultMap in project openolat by klemens.

the class EPStructureManager method createPortfolioDefaultMap.

protected PortfolioStructureMap createPortfolioDefaultMap(Identity identity, String title, String description) {
    EPDefaultMap el = new EPDefaultMap();
    fillStructureElement(el, title, description);
    // create security group
    EPStructureElementToGroupRelation ownerGroup = createBaseGroup(el, identity);
    Set<EPStructureElementToGroupRelation> relations = new HashSet<>();
    relations.add(ownerGroup);
    el.setGroups(relations);
    return el;
}
Also used : EPDefaultMap(org.olat.portfolio.model.structel.EPDefaultMap) EPStructureElementToGroupRelation(org.olat.portfolio.model.structel.EPStructureElementToGroupRelation) HashSet(java.util.HashSet)

Example 7 with EPDefaultMap

use of org.olat.portfolio.model.structel.EPDefaultMap in project openolat by klemens.

the class EPFrontendManagerTest method closedArtefacts.

@Test
public void closedArtefacts() {
    // create two artefacts
    AbstractArtefact artefact1 = epFrontendManager.createAndPersistArtefact(ident1, "text");
    assertNotNull(artefact1);
    AbstractArtefact artefact2 = epFrontendManager.createAndPersistArtefact(ident1, "bc");
    assertNotNull(artefact2);
    dbInstance.commitAndCloseSession();
    // create a map with a page and the page has two artefacts
    PortfolioStructureMap originalMap = epFrontendManager.createAndPersistPortfolioDefaultMap(ident1, "Title", "Description");
    PortfolioStructure newPage = epFrontendManager.createAndPersistPortfolioPage(originalMap, "Page title", "Page description");
    boolean successfullLink1 = epFrontendManager.addArtefactToStructure(ident1, artefact1, newPage);
    assertTrue(successfullLink1);
    boolean successfullLink2 = epFrontendManager.addArtefactToStructure(ident1, artefact2, newPage);
    assertTrue(successfullLink2);
    dbInstance.commitAndCloseSession();
    // check if the artefact is in a closed map
    assertFalse(epFrontendManager.isArtefactClosed(artefact1));
    assertFalse(epFrontendManager.isArtefactClosed(artefact2));
    // closed the map artificially
    ((EPDefaultMap) originalMap).setStatus(StructureStatusEnum.CLOSED);
    dbInstance.updateObject(originalMap);
    dbInstance.commitAndCloseSession();
    // check if the artefact is in a closed map
    assertTrue(epFrontendManager.isArtefactClosed(artefact1));
    assertTrue(epFrontendManager.isArtefactClosed(artefact2));
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) EPDefaultMap(org.olat.portfolio.model.structel.EPDefaultMap) Test(org.junit.Test)

Example 8 with EPDefaultMap

use of org.olat.portfolio.model.structel.EPDefaultMap in project openolat by klemens.

the class EPChangelogController method updateChangelogDisplay.

/**
 * update the changelog-list according to selected date. this method is
 * invoked on initForm and again when user changes date in dateChooser
 */
private void updateChangelogDisplay() {
    // init the helper;
    String path = getWindowControl().getBusinessControl().getAsString();
    EPNotificationsHelper helper = new EPNotificationsHelper(path, getLocale());
    // get the date from the dateChooser component
    Date compareDate = dateChooser.getDate();
    EPMapShort mapShort = ePFMgr.loadMapShortByResourceId(map.getOlatResource().getResourceableId());
    List<SubscriptionListItem> allItems = new ArrayList<SubscriptionListItem>(0);
    // get subscriptionListItems according to map type
    if (map instanceof EPDefaultMap || map instanceof EPStructuredMapTemplate) {
        allItems = helper.getAllSubscrItemsDefault(compareDate, mapShort);
    } else if (map instanceof EPStructuredMap) {
        allItems = helper.getAllSubscrItemsStructured(compareDate, mapShort);
    }
    List<SubscriptionItemBundle> bundles = getItemBundlesForSubscriptionItems(allItems);
    flc.contextPut("subscriptionItems", bundles);
}
Also used : SubscriptionListItem(org.olat.core.commons.services.notifications.model.SubscriptionListItem) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) EPNotificationsHelper(org.olat.portfolio.manager.EPNotificationsHelper) ArrayList(java.util.ArrayList) EPDefaultMap(org.olat.portfolio.model.structel.EPDefaultMap) EPMapShort(org.olat.portfolio.model.structel.EPMapShort) Date(java.util.Date)

Aggregations

EPDefaultMap (org.olat.portfolio.model.structel.EPDefaultMap)8 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 SubscriptionListItem (org.olat.core.commons.services.notifications.model.SubscriptionListItem)2 EPNotificationsHelper (org.olat.portfolio.manager.EPNotificationsHelper)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2 EPMapShort (org.olat.portfolio.model.structel.EPMapShort)2 EPStructureElementToGroupRelation (org.olat.portfolio.model.structel.EPStructureElementToGroupRelation)2 EPStructuredMap (org.olat.portfolio.model.structel.EPStructuredMap)2 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)2