use of org.olat.portfolio.model.structel.EPStructureToArtefactLink in project openolat by klemens.
the class EPStructureManager method copyEPStructureElementRecursively.
private void copyEPStructureElementRecursively(EPStructureElement sourceEl, EPStructureElement targetEl, boolean withArtefacts, boolean cloneRestrictions) {
// needed if the sourceEl come from a link. Hibernate doesn't initialize the list properly
sourceEl = (EPStructureElement) dbInstance.loadObject(sourceEl);
if (withArtefacts) {
List<EPStructureToArtefactLink> artefactLinks = sourceEl.getInternalArtefacts();
for (EPStructureToArtefactLink artefactLink : artefactLinks) {
EPStructureToArtefactLink link = instantiateClone(artefactLink);
// make the pseudo
link.setStructureElement(targetEl);
// bidirectional relations
targetEl.getInternalArtefacts().add(link);
}
}
// clone the links
List<EPStructureToStructureLink> childLinks = sourceEl.getInternalChildren();
for (EPStructureToStructureLink childLink : childLinks) {
copy(childLink, targetEl, withArtefacts, false, cloneRestrictions);
}
savePortfolioStructure(targetEl);
}
Aggregations