Package org.rssowl.core.persist.reference

Examples of org.rssowl.core.persist.reference.FeedLinkReference


  @Test
  public void testFeedLinkReferenceEqualsAndHashCode() throws Exception {
    String url1 = "http://url1.com";
    String url3 = "http://url3.com";

    FeedLinkReference feedRef1 = new FeedLinkReference(new URI(url1));
    FeedLinkReference feedRef2 = new FeedLinkReference(new URI(url1));

    assertEquals(feedRef1, feedRef2);
    assertEquals(feedRef1.hashCode(), feedRef2.hashCode());

    FeedLinkReference feedRef3 = new FeedLinkReference(new URI(url3));
    assertFalse(feedRef1.equals(feedRef3));
    assertFalse(feedRef1.hashCode() == feedRef3.hashCode());
  }
View Full Code Here


  @Test
  public void testRemoveBookMarkWithoutFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    IFeed feed = createFeed("http://www.someurl.com");
    feed = DynamicDAO.save(feed);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
    IFolder savedFolder = DynamicDAO.save(folder);
    IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
    DynamicDAO.delete(savedMark);
    assertNotNull(DynamicDAO.load(IFolder.class, savedFolder.getId()));
  }
View Full Code Here

  public void testRemoveBookMarkAndFeed() throws Exception {
    {
      IFolder folder = fFactory.createFolder(null, null, "Folder");
      IFeed feed = createFeed("http://www.someurl.com");
      feed = DynamicDAO.save(feed);
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
      IFolder savedFolder = DynamicDAO.save(folder);
      IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
      IFeed savedFeed = savedMark.getFeedLinkReference().resolve();
      DynamicDAO.delete(savedMark);
      assertNull("Feed must also be deleted since no more bookmarks reference it", DynamicDAO.load(IFeed.class, savedFeed.getId()));
    }
    {
      IFolder folder = fFactory.createFolder(null, null, "AnotherFolder");
      IFeed feed = createFeed("http://www.anotherurl.com");
      feed = DynamicDAO.save(feed);
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark1");
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark2");
      IFolder savedFolder = DynamicDAO.save(folder);
      IBookMark savedMark1 = (IBookMark) savedFolder.getMarks().get(0);
      IBookMark savedMark2 = (IBookMark) savedFolder.getMarks().get(1);
      if (savedMark1.getName().equals("Mark2")) {
        IBookMark tempMark = savedMark1;
View Full Code Here

            IFeed feed = Owl.getModelFactory().createFeed(null, newFeedLink);
            feed = DynamicDAO.save(feed);
          }

          /* Remember the old Reference */
          FeedLinkReference oldFeedRef = bookmark.getFeedLinkReference();

          /* Apply the new Reference */
          bookmark.setFeedLinkReference(new FeedLinkReference(newFeedLink));
          entitiesToSave.add(bookmark);

          /* Check if the old reference can be deleted now */
          if (daoService.getBookMarkDAO().loadAll(oldFeedRef).size() == 1)
            DynamicDAO.delete(oldFeedRef.resolve());

          /* Delete the Favicon since the feed has changed */
          OwlUI.deleteImage(bookmark.getId());
        }

View Full Code Here

          }
        }

        feed = DynamicDAO.save(feed);

        IBookMark bookmark = new BookMark(null, rootFolder, new FeedLinkReference(feed.getLink()), "Bookmark");

        if (withRetention)
          Owl.getPreferenceService().getEntityScope(bookmark).putBoolean(DefaultPreferences.DEL_READ_NEWS_STATE, true);

        rootFolder.addMark(bookmark, null, false);
View Full Code Here

        int endIndex = news.size() * 4 / 5;
        for (int i = 0; i < endIndex; ++i) {
          news.get(i).setState(INews.State.READ);
        }
      }
      feedRefs.add(new FeedLinkReference(DynamicDAO.save(feed).getLink()));
    }

    feeds = null;
    System.gc();

View Full Code Here

   * @see org.rssowl.core.model.types.IBookMark#getFeedLinkReference()
   */
  public synchronized FeedLinkReference getFeedLinkReference() {
    if (fFeedLinkReference == null) {
      try {
        fFeedLinkReference = new FeedLinkReference(new URI(fFeedLink));
      } catch (URISyntaxException e) {
        throw new IllegalStateException("Malformed URI was stored somehow: " + fFeedLink); //$NON-NLS-1$
      }
    }
    return fFeedLinkReference;
View Full Code Here

    IFeed feed = new Feed(new URI("http://www.rssowl.org/rssowl2dg/tests/manager/rss_2_0.xml"));
    feed = DynamicDAO.save(feed);

    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Folder");
    folder = DynamicDAO.save(folder);
    IBookMark bookmark = Owl.getModelFactory().createBookMark(1L, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    Controller.getDefault().reload(bookmark, null, new NullProgressMonitor());

    assertEquals(new FeedReference(feed.getId()).resolve().getFormat(), "RSS 2.0"); //$NON-NLS-1$
  }
View Full Code Here

    IFeed feed = new Feed(new URI("http://www.rssowl.org/rssowl2dg/tests/not_existing.xml"));
    feed = DynamicDAO.save(feed);

    IFolder folder = Owl.getModelFactory().createFolder(null, null, "Folder");
    folder = DynamicDAO.save(folder);
    IBookMark bookmark = Owl.getModelFactory().createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");

    Controller.getDefault().reload(bookmark, null, new NullProgressMonitor());

    assertEquals(true, new BookMarkReference(bookmark.getId()).resolve().isErrorLoading());
  }
View Full Code Here

    assertEquals(true, new BookMarkReference(bookmark.getId()).resolve().isErrorLoading());
  }

  private int getNewCount(IFeed feed) {
    NewsService service = Controller.getDefault().getNewsService();
    return service.getNewCount(new FeedLinkReference(feed.getLink()));
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.reference.FeedLinkReference

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.