Search in sources :

Example 6 with CommentAndRatingService

use of org.olat.core.commons.services.commentAndRating.CommentAndRatingService in project openolat by klemens.

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)

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