use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPStructureManager method copy.
/**
* Copy/Import structure elements recursively
* @param refLink
* @param targetEl
* @param withArtefacts Copy the artefacts
* @param importEl Don't load elements from the DB
* @param cloneRestrictions should the collect-restrictions be applied? you could also do this manually by copyCollectRestriction()
*/
private void copy(EPStructureToStructureLink refLink, EPStructureElement targetEl, boolean withArtefacts, boolean importEl, boolean cloneRestrictions) {
EPStructureElement childSourceEl = (EPStructureElement) refLink.getChild();
EPStructureElement clonedChildEl = instantiateClone(refLink.getChild());
if (clonedChildEl == null) {
log.warn("Attempt to clone an unsupported structure type: " + refLink.getChild(), null);
} else {
OLATResource resource = resourceManager.createOLATResourceInstance(clonedChildEl.getClass());
clonedChildEl.setOlatResource(resource);
// set root
if (targetEl.getRoot() == null) {
// it's the root element
clonedChildEl.setRoot(targetEl);
} else {
clonedChildEl.setRoot(targetEl.getRoot());
}
if (targetEl.getRootMap() == null && targetEl instanceof PortfolioStructureMap) {
clonedChildEl.setRootMap((PortfolioStructureMap) targetEl);
} else {
clonedChildEl.setRootMap(targetEl.getRootMap());
}
if (!importEl)
clonedChildEl.setStructureElSource(childSourceEl.getKey());
if (cloneRestrictions)
copyOrUpdateCollectRestriction(childSourceEl, clonedChildEl, true);
if (importEl) {
importEPStructureElementRecursively(childSourceEl, clonedChildEl);
} else {
copyEPStructureElementRecursively(childSourceEl, clonedChildEl, withArtefacts, cloneRestrictions);
}
EPStructureToStructureLink link = new EPStructureToStructureLink();
link.setParent(targetEl);
link.setChild(clonedChildEl);
targetEl.getInternalChildren().add(link);
}
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
the class EPStructureManager method createPortfolioPage.
/**
* Create a page element
* @param title
* @param description
* @return The structure element
*/
protected PortfolioStructure createPortfolioPage(PortfolioStructure root, String title, String description) {
EPPage el = new EPPage();
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);
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class EPFrontendManager method closeMapAfterDeadline.
/**
* Close all maps after the deadline if there is a deadline. It can be a long running
* process if a lot of maps are involved.
*/
public void closeMapAfterDeadline() {
List<PortfolioStructureMap> mapsToClose = structureManager.getOpenStructuredMapAfterDeadline();
int count = 0;
for (PortfolioStructureMap mapToClose : mapsToClose) {
submitMap(mapToClose, false, Role.auto);
if (count % 5 == 0) {
// this possibly takes longer than connection timeout, so do intermediatecommits.
dbInstance.intermediateCommit();
}
}
}
use of org.olat.portfolio.model.structel.PortfolioStructureMap in project OpenOLAT by OpenOLAT.
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;
}
Aggregations