Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IBookMark


      IFolder childFolder = fFactory.createFolder(null, root, "Child");

      IFeed feed = fFactory.createFeed(null, new URI("feed"));
      DynamicDAO.save(feed);

      IBookMark bookmark = fFactory.createBookMark(null, root, new FeedLinkReference(feed.getLink()), "Bookmark");

      INewsBin bin = fFactory.createNewsBin(null, root, "Bin");

      ISearchMark searchMark = fFactory.createSearchMark(null, root, "Search");
      ISearchField field = fFactory.createSearchField(INews.TITLE, INews.class.getName());
      searchMark.addSearchCondition(fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, "Foo"));

      DynamicDAO.save(root);

      listener = new SearchConditionListener() {

        public void entitiesUpdated(Set<SearchConditionEvent> events) {
          fail("Unexpected Event");
        }

        public void entitiesDeleted(Set<SearchConditionEvent> events) {
          fail("Unexpected Event");
        }

        public void entitiesAdded(Set<SearchConditionEvent> events) {
          fail("Unexpected Event");
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, listener);

      childFolder.setName("Other");
      DynamicDAO.save(childFolder);

      bookmark.setName("Other");
      DynamicDAO.save(bookmark);

      bin.setName("Other");
      DynamicDAO.save(bin);
    } finally {
View Full Code Here


      normalizedLink = URIUtils.HTTPS + link.substring((URIUtils.FEED_IDENTIFIER + URIUtils.HTTPS).length());
    else
      normalizedLink = link;

    /* Check for existing BookMark */
    final IBookMark existingBookMark = getBookMark(normalizedLink);
    JobRunner.runInUIThread(shell, new Runnable() {
      public void run() {

        /* Open Dialog to add this new BookMark */
        if (existingBookMark == null) {
View Full Code Here

    for (Object object : input) {
      if (object instanceof INews) {
        INews news = (INews) object;
        FeedLinkReference feedRef = news.getFeedReference();

        IBookMark bookmark = feedToBookMarkCache.get(feedRef);
        if (bookmark == null) {
          Collection<IBookMark> bookmarks = bookmarkDao.loadAll(feedRef);
          if (bookmarks.isEmpty())
            continue;

          bookmark = bookmarks.iterator().next();
          feedToBookMarkCache.put(feedRef, bookmark);
        }

        EntityGroup group = groupCache.get(bookmark.getId());
        if (group == null) {
          String name = bookmark.getName();
          group = new EntityGroup(nextId++, GROUP_CATEGORY_ID, name);

          if (!InternalOwl.TESTING) {
            ImageDescriptor feedIcon = OwlUI.getFavicon(bookmark);
            group.setImage(feedIcon != null ? feedIcon : OwlUI.BOOKMARK);
          }

          /* Cache */
          groupCache.put(bookmark.getId(), group);
        }

        new EntityGroupItem(group, news);
      }
    }
View Full Code Here

    }

    /* Initialize the Jobs that manages Updates */
    Set<Entry<IBookMark, Long>> entries = fMapBookMarkToInterval.entrySet();
    for (Entry<IBookMark, Long> entry : entries) {
      IBookMark bookMark = entry.getKey();
      scheduleUpdate(bookMark, entry.getValue());
    }

    /* Open BookMarks which are to open on startup */
    if (!newsmarksToOpenOnStartup.isEmpty()) {
View Full Code Here

    DynamicDAO.removeEntityListener(IBookMark.class, fBookMarkListener);
  }

  private void onBookMarksAdded(Set<BookMarkEvent> events) {
    for (BookMarkEvent event : events) {
      IBookMark addedBookMark = event.getEntity();
      IPreferenceScope entityPreferences = Owl.getPreferenceService().getEntityScope(addedBookMark);

      Long interval = entityPreferences.getLong(DefaultPreferences.BM_UPDATE_INTERVAL);
      boolean autoUpdateState = entityPreferences.getBoolean(DefaultPreferences.BM_UPDATE_INTERVAL_STATE);
View Full Code Here

    }
  }

  private void onBookMarksUpdated(Set<BookMarkEvent> events) {
    for (BookMarkEvent event : events) {
      IBookMark updatedBookMark = event.getEntity();
      sync(updatedBookMark);
    }
  }
View Full Code Here

  /*
   * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
   */
  public ImageDescriptor getImageDescriptor() {
    if (fMark instanceof IBookMark) {
      IBookMark bookmark = (IBookMark) fMark;
      ImageDescriptor favicon = OwlUI.getFavicon(bookmark);
      if (favicon != null)
        return favicon;
      return OwlUI.BOOKMARK;
    } else if (fMark instanceof ISearchMark)
View Full Code Here

    IFolder category1 = root.getFolders().get(0);
    assertEquals("category_1", category1.getName());
    assertEquals(3, category1.getMarks().size());

    /* Category 1 Marks */
    IBookMark category1_mark1 = (IBookMark) category1.getMarks().get(0);
    assertEquals("category_1_feed_1_title", category1_mark1.getName());
    assertEquals("http://www.category_1_feed_1_url.com", category1_mark1.getFeedLinkReference().getLink().toString());
    assertEquals("category_1_feed_1_website", category1_mark1.getProperty(ITypeImporter.HOMEPAGE_KEY));
    assertEquals("category_1_feed_1_description", category1_mark1.getProperty(ITypeImporter.DESCRIPTION_KEY));

    IBookMark category1_mark2 = (IBookMark) category1.getMarks().get(1);
    assertEquals("category_1_feed_2_text", category1_mark2.getName());
    assertEquals("http://www.category_1_feed_2_url.com", category1_mark2.getFeedLinkReference().getLink().toString());
    assertEquals("category_1_feed_2_website", category1_mark2.getProperty(ITypeImporter.HOMEPAGE_KEY));
    assertEquals("category_1_feed_2_description", category1_mark2.getProperty(ITypeImporter.DESCRIPTION_KEY));

    IBookMark category1_mark3 = (IBookMark) category1.getMarks().get(2);
    assertEquals("category_1_feed_3_title", category1_mark3.getName());

    /* Category 2 */
    IFolder category2 = root.getFolders().get(1);
    assertEquals("category_2", category2.getName());
    assertEquals(1, category2.getFolders().size());
    assertEquals(0, category2.getMarks().size());

    /* Sub Category 1 */
    IFolder subcategory_1 = category2.getFolders().get(0);
    assertEquals("sub_category_1", subcategory_1.getName());
    assertEquals(1, subcategory_1.getFolders().size());
    assertEquals(2, subcategory_1.getMarks().size());

    /* Sub Category 1 Marks */
    IBookMark subcategory_1_mark_1 = (IBookMark) subcategory_1.getMarks().get(0);
    assertEquals("sub_category_1_feed_1_title", subcategory_1_mark_1.getName());

    IBookMark subcategory_1_mark_2 = (IBookMark) subcategory_1.getMarks().get(1);
    assertEquals("http://www.sub_category_1_feed_2_url.com", subcategory_1_mark_2.getName());

    /* Sub Sub Category 1 */
    IFolder sub_subcategory_1 = subcategory_1.getFolders().get(0);
    assertEquals("sub_sub_category_1", sub_subcategory_1.getName());
    assertEquals(1, sub_subcategory_1.getMarks().size());

    IBookMark sub_subcategory_1_mark = (IBookMark) sub_subcategory_1.getMarks().get(0);
    assertEquals("sub_sub_category_1_feed_1_title", sub_subcategory_1_mark.getName());
  }
View Full Code Here

    IFolder category1 = root.getFolders().get(0);
    assertEquals("category_1", category1.getName());
    assertEquals(3, category1.getMarks().size());

    /* Category 1 Marks */
    IBookMark category1_mark1 = (IBookMark) category1.getMarks().get(0);
    assertEquals("category_1_feed_1_title", category1_mark1.getName());
    assertNotNull(category1_mark1.getFeedLinkReference().resolve());

    IFeed category1_mark1_feed = category1_mark1.getFeedLinkReference().resolve();
    assertEquals(new URI("http://www.category_1_feed_1_url.com").toString(), category1_mark1_feed.getLink().toString());
    assertEquals(new URI("category_1_feed_1_website"), category1_mark1_feed.getHomepage());
    assertEquals("category_1_feed_1_description", category1_mark1_feed.getDescription());

    IBookMark category1_mark2 = (IBookMark) category1.getMarks().get(1);
    assertEquals("category_1_feed_2_text", category1_mark2.getName());
    assertNotNull(category1_mark2.getFeedLinkReference().resolve());

    IFeed category1_mark2_feed = category1_mark2.getFeedLinkReference().resolve();
    assertEquals(new URI("http://www.category_1_feed_2_url.com").toString(), category1_mark2_feed.getLink().toString());
    assertEquals(new URI("category_1_feed_2_website"), category1_mark2_feed.getHomepage());
    assertEquals("category_1_feed_2_description", category1_mark2_feed.getDescription());

    IBookMark category1_mark3 = (IBookMark) category1.getMarks().get(2);
    assertEquals("category_1_feed_3_title", category1_mark3.getName());
    assertNotNull(category1_mark3.getFeedLinkReference().resolve());

    IFeed category1_mark3_feed = category1_mark3.getFeedLinkReference().resolve();
    assertEquals(new URI("http://www.category_1_feed_3_url.com").toString(), category1_mark3_feed.getLink().toString());
  }
View Full Code Here

    /* Folder, Bookmark and Searchmark */
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    folder.setProperty("key", "value");
    folder.setProperty("value", "key");

    IBookMark bm = fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark");
    bm.setProperty("key", "value");
    bm.setProperty("value", "key");

    IFeed anotherFeed = fFactory.createFeed(null, URI.create("http://www.rssowl.org"));

    INews news1 = fFactory.createNews(null, anotherFeed, new Date());
    news1.setState(INews.State.NEW);

    INews news2 = fFactory.createNews(null, anotherFeed, new Date());
    news2.setState(INews.State.UNREAD);

    INews news4 = fFactory.createNews(null, anotherFeed, new Date());
    news4.setState(INews.State.READ);
    news4.setFlagged(true);

    INews news5 = fFactory.createNews(null, anotherFeed, new Date());
    news5.setState(INews.State.READ);
    news5.setFlagged(true);

    INews news6 = fFactory.createNews(null, anotherFeed, new Date());
    news6.setState(INews.State.READ);
    news6.setFlagged(true);

    INews news7 = fFactory.createNews(null, anotherFeed, new Date());
    news7.setState(INews.State.HIDDEN);

    DynamicDAO.save(anotherFeed);

    bm = fFactory.createBookMark(null, folder, new FeedLinkReference(URI.create("http://www.rssowl.org")), "Other BookMark");
    NewsCounter counter = DynamicDAO.getDAO(INewsCounterDAO.class).load();
    NewsCounterItem item = new NewsCounterItem(1, 2, 3);
    counter.put(bm.getFeedLinkReference().getLinkAsText(), item);
    DynamicDAO.save(counter);
    ((BookMark) bm).setNewsCounter(counter);

    ISearchMark sm = fFactory.createSearchMark(null, folder, "SM");
    sm.setProperty("key", "value");
View Full Code Here

TOP

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

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.