Examples of NewsCounter


Examples of org.rssowl.core.persist.NewsCounter

  }

  private synchronized NewsCounter loadCounter() {

    /* Load from DB */
    NewsCounter counter = fNewsCounterDao.load();

    /* Perform initial counting */
    if (counter == null)
      counter = countAll();

View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

    return counter;
  }

  private NewsCounter countAll() {
    final NewsCounter newsCounter = new NewsCounter();
    final long start = System.currentTimeMillis();
    final Collection<IFeed> feeds = DynamicDAO.loadAll(IFeed.class);

    final ProgressMonitorDialog dialog = new NewsServiceProgressMonitorDialog(new Shell(Display.getDefault(), SWT.NONE));
    dialog.setOpenOnRun(false);

    /* Runnable will open the Dialog after SHOW_PROGRESS_THRESHOLD ms */
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
      private boolean fDialogOpened;

      public void run(IProgressMonitor monitor) {
        int worked = 0;
        for (IFeed feed : feeds) {
          newsCounter.put(feed.getLink(), count(feed));

          /* Open the Dialog if exceeded SHOW_PROGRESS_THRESHOLD ms */
          if (System.currentTimeMillis() - start > SHOW_PROGRESS_THRESHOLD && !fDialogOpened) {
            dialog.open();
            monitor.beginTask("RSSOwl was not shutdown properly. Restoring data, please wait...", feeds.size() - worked);
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

    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

Examples of org.rssowl.core.persist.NewsCounter

    assertNotNull(eventType);
    assertNotNull(otherEventType);
    assertEquals(eventType, otherEventType);

    /* Assert NewsCounter / NewsCounterItem */
    NewsCounter newsCounter = db.query(NewsCounter.class).get(0);
    db.activate(newsCounter, Integer.MAX_VALUE);
    NewsCounter otherNewsCounter = defragmentedDb.query(NewsCounter.class).get(0);
    defragmentedDb.activate(otherNewsCounter, Integer.MAX_VALUE);
    assertNotNull(newsCounter);
    assertNotNull(otherNewsCounter);

    NewsCounterItem item = otherNewsCounter.get("http://www.rssowl.org");
    assertEquals(1, item.getNewCounter());
    assertEquals(2, item.getUnreadCounter());
    assertEquals(3, item.getStickyCounter());
  }
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

  }

  @Override
  protected void onDatabaseOpened(DatabaseEvent event) {
    super.onDatabaseOpened(event);
    NewsCounter newsCounter = doLoad();
    if (newsCounter == null) {
      newsCounter = doCountAll();
      save(newsCounter);
    }
    fNewsCounter = newsCounter;
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

  protected void preCommit() {
    //Do nothing
  }

  private NewsCounter doCountAll() {
    NewsCounter newsCounter = new NewsCounter();
    Collection<IFeed> feeds = DBHelper.loadAllFeeds(fDb);

    for (IFeed feed : feeds)
      newsCounter.put(feed.getLink().toString(), doCount(feed));

    return newsCounter;
  }
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

  }

  private synchronized NewsCounter loadCounter() {

    /* Load from DB */
    NewsCounter counter = fNewsCounterDao.load();

    /* Perform initial counting */
    if (counter == null)
      counter = countAll();

View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

    return counter;
  }

  private NewsCounter countAll() {
    final NewsCounter newsCounter = new NewsCounter();
    final long start = System.currentTimeMillis();
    final Collection<IFeed> feeds = DynamicDAO.loadAll(IFeed.class);

    final ProgressMonitorDialog dialog = new NewsServiceProgressMonitorDialog(new Shell(Display.getDefault(), SWT.NONE));
    dialog.setOpenOnRun(false);

    /* Runnable will open the Dialog after SHOW_PROGRESS_THRESHOLD ms */
    IRunnableWithProgress runnable = new IRunnableWithProgress() {
      private boolean fDialogOpened;

      public void run(IProgressMonitor monitor) {
        int worked = 0;
        for (IFeed feed : feeds) {
          newsCounter.put(feed.getLink(), count(feed));

          /* Open the Dialog if exceeded SHOW_PROGRESS_THRESHOLD ms */
          if (System.currentTimeMillis() - start > SHOW_PROGRESS_THRESHOLD && !fDialogOpened) {
            dialog.open();
            monitor.beginTask("RSSOwl was not shutdown properly. Restoring data...", feeds.size() - worked);
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

    input.add(searchmark5);

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

    NewsCounter count = new NewsCounter();
    NewsCounterItem item = new NewsCounterItem(1, 0, 0);
    count.put(feed1.getLink().toString(), item);
    ((BookMark) bookmark1).setNewsCounter(count);

    count = new NewsCounter();
    item = new NewsCounterItem(0, 1, 0);
    count.put(feed2.getLink().toString(), item);
    ((BookMark) bookmark2).setNewsCounter(count);

    count = new NewsCounter();
    item = new NewsCounterItem(0, 0, 1);
    count.put(feed3.getLink().toString(), item);
    ((BookMark) bookmark3).setNewsCounter(count);

    INews news = fFactory.createNews(null, fFactory.createFeed(null, new URI("feed4")), new Date());
    news.setState(INews.State.NEW);
    news.setId(System.currentTimeMillis());
View Full Code Here

Examples of org.rssowl.core.persist.NewsCounter

      return;

    /* Feeds */
    available = DEFRAG_SUB_WORK_FEEDS;
    int feedCounter = 0;
    NewsCounter newsCounter = new NewsCounter();
    ObjectSet<Feed> allFeeds = sourceDb.query(Feed.class);
    if (!allFeeds.isEmpty()) {
      int allFeedsSize = allFeeds.size();
      int chunk = available / allFeedsSize;

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.