use of org.olat.core.commons.services.commentAndRating.CommentAndRatingService in project OpenOLAT by OpenOLAT.
the class FeedManagerImpl method deleteFeed.
@Override
public void deleteFeed(OLATResourceable ores) {
// delete the container on the file system
fileResourceManager.deleteFileResource(ores);
// delete comments and ratings
CommentAndRatingService commentAndRatingService = CoreSpringFactory.getImpl(CommentAndRatingService.class);
commentAndRatingService.deleteAllIgnoringSubPath(ores);
// delete the feed and all items from the database
Feed feed = feedDAO.loadFeed(ores);
itemDAO.removeItems(feed);
feedDAO.removeFeedForResourceable(ores);
resourceManager.deleteOLATResourceable(ores);
feed = null;
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingService in project OpenOLAT by OpenOLAT.
the class FeedManagerImpl method deleteItem.
@Override
public Feed deleteItem(Item item) {
Feed feed = item.getFeed();
// delete the item from the database
itemDAO.removeItem(item);
// delete the item container from the file system
feedFileStorage.deleteItemContainer(item);
// delete comments and ratings
CommentAndRatingService commentAndRatingService = CoreSpringFactory.getImpl(CommentAndRatingService.class);
commentAndRatingService.deleteAll(feed, item.getGuid());
// reload the Feed
Feed reloadedFeed = feedDAO.loadFeed(feed.getKey());
// or from an external source.
if (!hasItems(reloadedFeed)) {
// set undefined
reloadedFeed.setExternal(null);
}
reloadedFeed.setLastModified(new Date());
reloadedFeed = feedDAO.updateFeed(reloadedFeed);
return reloadedFeed;
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingService 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.core.commons.services.commentAndRating.CommentAndRatingService in project openolat by klemens.
the class FeedManagerImpl method deleteFeed.
@Override
public void deleteFeed(OLATResourceable ores) {
// delete the container on the file system
fileResourceManager.deleteFileResource(ores);
// delete comments and ratings
CommentAndRatingService commentAndRatingService = CoreSpringFactory.getImpl(CommentAndRatingService.class);
commentAndRatingService.deleteAllIgnoringSubPath(ores);
// delete the feed and all items from the database
Feed feed = feedDAO.loadFeed(ores);
itemDAO.removeItems(feed);
feedDAO.removeFeedForResourceable(ores);
resourceManager.deleteOLATResourceable(ores);
feed = null;
}
use of org.olat.core.commons.services.commentAndRating.CommentAndRatingService in project openolat by klemens.
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);
}
}
Aggregations