use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPStructureManager method getStructureElementsFromOthersLimited.
protected List<PortfolioStructure> getStructureElementsFromOthersLimited(Identity ident, Identity choosenOwner, int limitFrom, int limitTo, ElementType... types) {
TypedQuery<PortfolioStructure> query = buildStructureElementsFromOthersLimitedQuery(choosenOwner, PortfolioStructure.class, types);
// limits
if (limitTo > 0 && (limitFrom < limitTo)) {
query.setFirstResult(limitFrom);
query.setMaxResults(limitTo - limitFrom);
}
query.setParameter("ident", ident).setParameter("date", new Date());
if (choosenOwner != null) {
query.setParameter("owner", choosenOwner);
}
return query.getResultList();
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPStructureManager method removeStructureRecursively.
public void removeStructureRecursively(PortfolioStructure struct) {
List<PortfolioStructure> children = loadStructureChildren(struct);
for (PortfolioStructure childstruct : children) {
removeStructureRecursively(childstruct);
}
// remove artefact-links
List<AbstractArtefact> thisStructsArtefacts = getArtefacts(struct);
for (AbstractArtefact artefact : thisStructsArtefacts) {
removeArtefactFromStructure(artefact, struct, false);
}
// remove from parent
PortfolioStructure parent = loadStructureParent(struct);
if (parent == null && struct.getRoot() != null)
parent = struct.getRoot();
removeStructure(parent, struct);
// remove collect restriction
struct.getCollectRestrictions().clear();
// remove sharings
if (struct instanceof EPAbstractMap) {
((EPAbstractMap) struct).getGroups().clear();
}
// remove comments and ratings
CommentAndRatingService commentAndRatingService = CoreSpringFactory.getImpl(CommentAndRatingService.class);
commentAndRatingService.deleteAllIgnoringSubPath(struct.getOlatResource());
// FXOLAT-431 remove subscriptions if the current struct is a map
if (struct instanceof EPAbstractMap) {
SubscriptionContext subsContext = new SubscriptionContext(EPNotificationsHandler.TYPENNAME, struct.getResourceableId(), EPNotificationsHandler.TYPENNAME);
NotificationsManager.getInstance().delete(subsContext);
}
// remove structure itself
struct = (EPStructureElement) dbInstance.loadObject((EPStructureElement) struct);
dbInstance.deleteObject(struct);
if (struct instanceof EPAbstractMap) {
removeBaseGroup((EPAbstractMap) struct);
}
// which need the resource
if (!(struct instanceof EPStructuredMapTemplate)) {
resourceManager.deleteOLATResourceable(struct);
}
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPStructureManager method getRestrictionStatisticsOfMap.
// count recursively
protected Integer[] getRestrictionStatisticsOfMap(PortfolioStructure structureMap, int done, int todo) {
final List<PortfolioStructure> children = loadStructureChildren(structureMap);
for (final PortfolioStructure child : children) {
Integer[] childStat = getRestrictionStatisticsOfMap(child, done, todo);
done = childStat[0];
todo = childStat[1];
}
// summarize
Integer[] statsArr = getRestrictionStatistics(structureMap);
if (statsArr != null) {
done += statsArr[0];
todo += statsArr[1];
}
return new Integer[] { done, todo };
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPStructureManager method getReferencedMapsForArtefact.
protected List<PortfolioStructure> getReferencedMapsForArtefact(AbstractArtefact artefact) {
List<PortfolioStructure> pfList = getAllReferencesForArtefact(artefact);
List<PortfolioStructure> mapList = new ArrayList<PortfolioStructure>();
for (Iterator<?> iterator = pfList.iterator(); iterator.hasNext(); ) {
EPStructureElement portfolioStructure = (EPStructureElement) iterator.next();
EPStructureElement actStruct = portfolioStructure;
while (actStruct.getRoot() != null) {
EPStructureElement actRoot = actStruct.getRoot();
if (actRoot != null) {
actStruct = actRoot;
}
}
if (!mapList.contains(actStruct))
mapList.add(actStruct);
}
return mapList;
}
use of org.olat.portfolio.model.structel.PortfolioStructure in project OpenOLAT by OpenOLAT.
the class EPFrontendManager method checkAllCollectRestrictionRec.
protected boolean checkAllCollectRestrictionRec(PortfolioStructure structure) {
boolean allOk = structureManager.checkCollectRestriction(structure);
List<PortfolioStructure> children = structureManager.loadStructureChildren(structure);
for (PortfolioStructure child : children) {
allOk &= checkAllCollectRestrictionRec(child);
}
return allOk;
}
Aggregations