Search in sources :

Example 1 with Article

use of org.finos.symphony.rssbot.feed.Article in project spring-bot by finos.

the class CachingCheckingArticleSender method alreadyPosted.

@Override
protected boolean alreadyPosted(Addressable a, Article article) {
    SoftReference<Set<Article>> articles = alreadySent.get(a);
    if (articles != null) {
        Set<Article> inner = articles.get();
        if (inner != null) {
            for (Article article2 : inner) {
                if (article2.getUri().equals(article.getUri())) {
                    return true;
                }
            }
        }
    }
    boolean out = super.alreadyPosted(a, article);
    if (out) {
        recordSent(a, article);
    }
    return out;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Article(org.finos.symphony.rssbot.feed.Article)

Example 2 with Article

use of org.finos.symphony.rssbot.feed.Article in project spring-bot by finos.

the class TimedAlerter method allItemsInFeed.

private int allItemsInFeed(Feed f, Addressable a, FeedList fl) {
    int count = 0;
    try {
        for (SyndEntry e : loader.createSyndFeed(f).getEntries()) {
            if (passesFilter(e, fl)) {
                HashTag fht = createFeedHashTag(f);
                HashTag aht = createArticleHashTag(e.getLink());
                Article article = new Article(e.getTitle(), e.getAuthor(), f.getName(), e.getLink(), fl, fht, aht);
                count += sender.post(a, article);
            }
        }
    } catch (Exception e) {
        LOG.error("Coulnd't process feed" + f.getName(), e);
    }
    return count;
}
Also used : SyndEntry(com.rometools.rome.feed.synd.SyndEntry) HashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag) Article(org.finos.symphony.rssbot.feed.Article)

Aggregations

Article (org.finos.symphony.rssbot.feed.Article)2 SyndEntry (com.rometools.rome.feed.synd.SyndEntry)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 HashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag)1