Search in sources :

Example 1 with CommentAndRatingService

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;
}
Also used : CommentAndRatingService(org.olat.core.commons.services.commentAndRating.CommentAndRatingService) SyndFeed(com.rometools.rome.feed.synd.SyndFeed) Feed(org.olat.modules.webFeed.Feed) RSSFeed(org.olat.modules.webFeed.RSSFeed)

Example 2 with CommentAndRatingService

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;
}
Also used : CommentAndRatingService(org.olat.core.commons.services.commentAndRating.CommentAndRatingService) Date(java.util.Date) SyndFeed(com.rometools.rome.feed.synd.SyndFeed) Feed(org.olat.modules.webFeed.Feed) RSSFeed(org.olat.modules.webFeed.RSSFeed)

Example 3 with CommentAndRatingService

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);
    }
}
Also used : EPAbstractMap(org.olat.portfolio.model.structel.EPAbstractMap) EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CommentAndRatingService(org.olat.core.commons.services.commentAndRating.CommentAndRatingService) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext)

Example 4 with CommentAndRatingService

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;
}
Also used : CommentAndRatingService(org.olat.core.commons.services.commentAndRating.CommentAndRatingService) SyndFeed(com.rometools.rome.feed.synd.SyndFeed) Feed(org.olat.modules.webFeed.Feed) RSSFeed(org.olat.modules.webFeed.RSSFeed)

Example 5 with CommentAndRatingService

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);
    }
}
Also used : EPAbstractMap(org.olat.portfolio.model.structel.EPAbstractMap) EPStructuredMapTemplate(org.olat.portfolio.model.structel.EPStructuredMapTemplate) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CommentAndRatingService(org.olat.core.commons.services.commentAndRating.CommentAndRatingService) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext)

Aggregations

CommentAndRatingService (org.olat.core.commons.services.commentAndRating.CommentAndRatingService)6 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)4 Feed (org.olat.modules.webFeed.Feed)4 RSSFeed (org.olat.modules.webFeed.RSSFeed)4 Date (java.util.Date)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2 EPAbstractMap (org.olat.portfolio.model.structel.EPAbstractMap)2 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2