Package com.commafeed.backend.model

Examples of com.commafeed.backend.model.FeedEntryContent


  public static Entry build(FeedEntryStatus status, String publicUrl, boolean proxyImages) {
    Entry entry = new Entry();

    FeedEntry feedEntry = status.getEntry();
    FeedSubscription sub = status.getSubscription();
    FeedEntryContent content = feedEntry.getContent();

    entry.setId(String.valueOf(feedEntry.getId()));
    entry.setGuid(feedEntry.getGuid());
    entry.setRead(status.isRead());
    entry.setStarred(status.isStarred());
    entry.setMarkable(status.isMarkable());
    entry.setDate(feedEntry.getUpdated());
    entry.setInsertedDate(feedEntry.getInserted());
    entry.setUrl(feedEntry.getUrl());
    entry.setFeedName(sub.getTitle());
    entry.setFeedId(String.valueOf(sub.getId()));
    entry.setFeedUrl(sub.getFeed().getUrl());
    entry.setFeedLink(sub.getFeed().getLink());
    entry.setIconUrl(FeedUtils.getFaviconUrl(sub, publicUrl));

    List<String> tags = Lists.newArrayList();
    for (FeedEntryTag tag : status.getTags()) {
      tags.add(tag.getName());
    }
    entry.setTags(tags);

    if (content != null) {
      entry.setRtl(FeedUtils.isRTL(feedEntry));
      entry.setTitle(content.getTitle());
      entry.setContent(FeedUtils.proxyImages(content.getContent(), publicUrl, proxyImages));
      entry.setAuthor(content.getAuthor());
      entry.setEnclosureUrl(content.getEnclosureUrl());
      entry.setEnclosureType(content.getEnclosureType());
    }

    return entry;
  }
View Full Code Here


  private static FeedEntry initTestEntry() {
    FeedEntry entry = new FeedEntry();
    entry.setUrl("https://github.com/Athou/commafeed");

    FeedEntryContent content = new FeedEntryContent();
    content.setAuthor("Athou");
    content.setTitle("Merge pull request #662 from Athou/dw8");
    content.setContent("Merge pull request #662 from Athou/dw8");
    entry.setContent(content);
    return entry;
  }
View Full Code Here

    service = new FeedEntryFilteringService();

    entry = new FeedEntry();
    entry.setUrl("https://github.com/Athou/commafeed");

    content = new FeedEntryContent();
    content.setAuthor("Athou");
    content.setTitle("Merge pull request #662 from Athou/dw8");
    content.setContent("Merge pull request #662 from Athou/dw8");
    entry.setContent(content);
View Full Code Here

    Long existing = feedEntryDAO.findExisting(entry.getGuid(), feed);
    if (existing != null) {
      return false;
    }

    FeedEntryContent content = feedEntryContentService.findOrCreate(entry.getContent(), feed.getLink());
    entry.setGuidHash(DigestUtils.sha1Hex(entry.getGuid()));
    entry.setContent(content);
    entry.setInserted(new Date());
    entry.setFeed(feed);
    feedEntryDAO.saveOrUpdate(entry);
View Full Code Here

    String contentHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getContent()));
    String titleHash = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getTitle()));
    Long existingId = feedEntryContentDAO.findExisting(contentHash, titleHash);

    FeedEntryContent result = null;
    if (existingId == null) {
      content.setContentHash(contentHash);
      content.setTitleHash(titleHash);

      content.setAuthor(FeedUtils.truncate(FeedUtils.handleContent(content.getAuthor(), baseUrl, true), 128));
      content.setTitle(FeedUtils.truncate(FeedUtils.handleContent(content.getTitle(), baseUrl, true), 2048));
      content.setContent(FeedUtils.handleContent(content.getContent(), baseUrl, false));
      result = content;
      feedEntryContentDAO.saveOrUpdate(result);
    } else {
      result = new FeedEntryContent();
      result.setId(existingId);
    }
    return result;
  }
View Full Code Here

        // if link is empty but guid is used as url
        if (StringUtils.isBlank(entry.getUrl()) && StringUtils.startsWith(entry.getGuid(), "http")) {
          entry.setUrl(entry.getGuid());
        }

        FeedEntryContent content = new FeedEntryContent();
        content.setContent(getContent(item));
        content.setTitle(getTitle(item));
        content.setAuthor(StringUtils.trimToNull(item.getAuthor()));
        SyndEnclosure enclosure = Iterables.getFirst(item.getEnclosures(), null);
        if (enclosure != null) {
          content.setEnclosureUrl(FeedUtils.truncate(enclosure.getUrl(), 2048));
          content.setEnclosureType(enclosure.getType());
        }
        entry.setContent(content);

        entries.add(entry);
      }
View Full Code Here

    // the same time
    String key1 = StringUtils.trimToEmpty("" + feed.getId());

    // lock on content, make sure we are not updating the same entry
    // twice at the same time
    FeedEntryContent content = entry.getContent();
    String key2 = DigestUtils.sha1Hex(StringUtils.trimToEmpty(content.getContent() + content.getTitle()));

    Iterator<Lock> iterator = locks.bulkGet(Arrays.asList(key1, key2)).iterator();
    Lock lock1 = iterator.next();
    Lock lock2 = iterator.next();
    boolean locked1 = false;
View Full Code Here

TOP

Related Classes of com.commafeed.backend.model.FeedEntryContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.