Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolder


   */
  @Test
  public void testProcessBookMarkByAgeAndCountAndStateWithStickyNews() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 10);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark1");

    DynamicDAO.save(folder);

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(100, countNews(bookmark));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here


   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByAge() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByCount() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByCountThatExceedLimit() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByState() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByAgeAndCount() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByAgeAndState() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByCountAndState() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

   */
  @Test
  public void testProcessFeedWithUnpersistedNewsByAgeAndCountAndState() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 20, today - 7 * DAY, today - 6 * DAY, 0);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    DynamicDAO.save(folder);

    /* Add unpersisted News */
    INews news1 = fFactory.createNews(null, feed, new Date());
    news1.setTitle("News #1");
    news1.setState(INews.State.READ);
    INews news2 = fFactory.createNews(null, feed, new Date());
    news2.setTitle("News #2");
    news2.setPublishDate(new Date(today - 7 * DAY));
    fFactory.createNews(null, feed, new Date()).setTitle("News #3");

    IBookMark bookmark = (IBookMark) folder.getMarks().get(0);
    assertEquals(103, countNews(feed));

    /* Preferences */
    IPreferenceScope prefs1 = Owl.getPreferenceService().getEntityScope(bookmark);

View Full Code Here

  private int countNews(IEntity entity) throws PersistenceException {
    int count = 0;

    if (entity instanceof IFolder) {
      IFolder folder = new FolderReference(entity.getId()).resolve();
      List<IMark> marks = folder.getMarks();
      for (IMark mark : marks) {
        if (mark instanceof IBookMark) {
          IFeed feed = ((IBookMark) mark).getFeedLinkReference().resolve();
          count += feed.getVisibleNews().size();
        }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IFolder

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.