Package com.commafeed.backend.model

Examples of com.commafeed.backend.model.FeedEntry


public class Entry implements Serializable {

  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));
View Full Code Here


public class FeedREST {

  private static final FeedEntry TEST_ENTRY = initTestEntry();

  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

  @Before
  public void init() {
    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");
View Full Code Here

  private final FeedEntryDAO feedEntryDAO;
  private final FeedEntryTagDAO feedEntryTagDAO;

  public void updateTags(User user, Long entryId, List<String> tagNames) {
    FeedEntry entry = feedEntryDAO.findById(entryId);
    if (entry == null) {
      return;
    }

    List<FeedEntryTag> tags = feedEntryTagDAO.findByEntry(user, entry);
View Full Code Here

      for (Tuple tuple : tuples) {
        Long id = tuple.get(entry.id);
        Date updated = tuple.get(entry.updated);
        Long statusId = tuple.get(status.id);

        FeedEntry entry = new FeedEntry();
        entry.setId(id);
        entry.setUpdated(updated);

        FeedEntryStatus status = new FeedEntryStatus();
        status.setId(statusId);
        status.setEntryUpdated(updated);
        status.setEntry(entry);
        status.setSubscription(sub);

        set.add(status);
      }
    }

    List<FeedEntryStatus> placeholders = set.asList();
    int size = placeholders.size();
    if (size < offset) {
      return Lists.newArrayList();
    }
    placeholders = placeholders.subList(Math.max(offset, 0), size);

    List<FeedEntryStatus> statuses = null;
    if (onlyIds) {
      statuses = placeholders;
    } else {
      statuses = Lists.newArrayList();
      for (FeedEntryStatus placeholder : placeholders) {
        Long statusId = placeholder.getId();
        FeedEntry entry = feedEntryDAO.findById(placeholder.getEntry().getId());
        FeedEntryStatus status = handleStatus(user, statusId == null ? null : findById(statusId), placeholder.getSubscription(),
            entry);
        status = fetchTags(user, status);
        statuses.add(status);
      }
View Full Code Here

  private final FeedEntryStatusDAO feedEntryStatusDAO;
  private final CacheService cache;

  public void markEntry(User user, Long entryId, boolean read) {

    FeedEntry entry = feedEntryDAO.findById(entryId);
    if (entry == null) {
      return;
    }

    FeedSubscription sub = feedSubscriptionDAO.findByFeed(user, entry.getFeed());
    if (sub == null) {
      return;
    }

    FeedEntryStatus status = feedEntryStatusDAO.getStatus(user, sub, entry);
View Full Code Here

    FeedSubscription sub = feedSubscriptionDAO.findById(user, subscriptionId);
    if (sub == null) {
      return;
    }

    FeedEntry entry = feedEntryDAO.findById(entryId);
    if (entry == null) {
      return;
    }

    FeedEntryStatus status = feedEntryStatusDAO.getStatus(user, sub, entry);
View Full Code Here

      feed.setUrl(feedUrl);
      feed.setLink(rss.getLink());
      List<SyndEntry> items = rss.getEntries();

      for (SyndEntry item : items) {
        FeedEntry entry = new FeedEntry();

        String guid = item.getUri();
        if (StringUtils.isBlank(guid)) {
          guid = item.getLink();
        }
        if (StringUtils.isBlank(guid)) {
          // no guid and no link, skip entry
          continue;
        }
        entry.setGuid(FeedUtils.truncate(guid, 2048));
        entry.setUpdated(validateDate(getEntryUpdateDate(item), true));
        entry.setUrl(FeedUtils.truncate(FeedUtils.toAbsoluteUrl(item.getLink(), feed.getLink(), feed.getUrlAfterRedirect()), 2048));

        // 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);
      }
      Date lastEntryDate = null;
      Date publishedDate = validateDate(rss.getPublishedDate(), false);
View Full Code Here

TOP

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

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.