Package org.rssowl.core.persist.dao

Examples of org.rssowl.core.persist.dao.INewsBinDAO


    DynamicDAO.removeEntityListener(INews.class, fNewsListener);
  }

  /* Update Entities that are affected by the given NewsEvents */
  private void updateParents(final Set<NewsEvent> events) {
    INewsBinDAO newsBinDao = DynamicDAO.getDAO(INewsBinDAO.class);

    /* Group by Feed and Bins */
    Set<FeedLinkReference> affectedFeeds = new HashSet<FeedLinkReference>();
    Set<IFolder> affectedBinFolders = new HashSet<IFolder>();
    Set<Long> handledBins = new HashSet<Long>();
    for (NewsEvent event : events) {
      INews news = event.getEntity();
      long parentId = news.getParentId();
      if (!fBookmarkGrouping.isActive() && parentId != 0) {
        if (!handledBins.contains(parentId)) {
          INewsBin bin = newsBinDao.load(parentId);
          if (bin != null) //Could have been deleted meanwhile
            affectedBinFolders.add(bin.getParent());
          handledBins.add(parentId);
        }
      } else
View Full Code Here


        list.add(new StatesUpdateInfo(null, news.getState(), news.toReference()));
      }
    }
    if (!statesUpdateInfos.isEmpty()) {
      Set<FeedLinkReference> removedFeedRefs = new HashSet<FeedLinkReference>();
      INewsBinDAO newsBinDAO = DynamicDAO.getDAO(INewsBinDAO.class);
      for (Map.Entry<Long, List<StatesUpdateInfo>> mapEntry : statesUpdateInfos.entrySet()) {
        INewsBin newsBin = newsBinDAO.load(mapEntry.getKey());
        if (newsBin.updateNewsStates(mapEntry.getValue())) {
          removeNews(db, removedFeedRefs, newsBin.removeNews(EnumSet.of(INews.State.DELETED)));
          putEventTemplate(new NewsBinEvent(newsBin, null, true));
          db.ext().store(newsBin, Integer.MAX_VALUE);
        }
View Full Code Here

    if (lastVisitDate == null) {
      lastVisitDate = new Date();
    }
    Thread.sleep(100);

    INewsBinDAO dao = DynamicDAO.getDAO(INewsBinDAO.class);
    dao.visited(bin);
    bin = null;
    System.gc();

    bin = binRef.resolve();
    assertEquals(popularity + 1, bin.getPopularity());
    assertTrue(bin.getLastVisitDate().compareTo(lastVisitDate) > 0);
    assertTrue(bin.getLastVisitDate().compareTo(new Date()) < 0);
    assertEquals(3, bin.getNews().size());

    bin = null;
    System.gc();

    bin = binRef.resolve();
    dao.visited(bin);
    dao.visited(bin);
    dao.visited(bin);

    bin = null;
    System.gc();

    bin = binRef.resolve();
View Full Code Here

      }
    }

    if (!statesUpdateInfos.isEmpty()) {
      Set<FeedLinkReference> removedFeedRefs = new HashSet<FeedLinkReference>();
      INewsBinDAO newsBinDAO = DynamicDAO.getDAO(INewsBinDAO.class);
      for (Map.Entry<Long, List<StatesUpdateInfo>> mapEntry : statesUpdateInfos.entrySet()) {
        INewsBin newsBin = newsBinDAO.load(mapEntry.getKey());
        if (newsBin.updateNewsStates(mapEntry.getValue())) {
          removeNews(db, removedFeedRefs, newsBin.removeNews(EnumSet.of(INews.State.DELETED)));
          putEventTemplate(new NewsBinEvent(newsBin, null, true));
          db.ext().set(newsBin, Integer.MAX_VALUE);
        }
View Full Code Here

    if (lastVisitDate == null) {
      lastVisitDate = new Date();
    }
    Thread.sleep(100);

    INewsBinDAO dao = DynamicDAO.getDAO(INewsBinDAO.class);
    dao.visited(bin);
    bin = null;
    System.gc();

    bin = binRef.resolve();
    assertEquals(popularity + 1, bin.getPopularity());
    assertTrue(bin.getLastVisitDate().compareTo(lastVisitDate) > 0);
    assertTrue(bin.getLastVisitDate().compareTo(new Date()) < 0);
    assertEquals(3, bin.getNews().size());

    bin = null;
    System.gc();

    bin = binRef.resolve();
    dao.visited(bin);
    dao.visited(bin);
    dao.visited(bin);

    bin = null;
    System.gc();

    bin = binRef.resolve();
View Full Code Here

    DynamicDAO.removeEntityListener(INews.class, fNewsListener);
  }

  /* Update Entities that are affected by the given NewsEvents */
  private void updateParents(final Set<NewsEvent> events) {
    INewsBinDAO newsBinDao = DynamicDAO.getDAO(INewsBinDAO.class);

    /* Group by Feed and Bins */
    Set<FeedLinkReference> affectedFeeds = new HashSet<FeedLinkReference>();
    Set<IFolder> affectedBinFolders = new HashSet<IFolder>();
    Set<Long> handledBins = new HashSet<Long>();
    for (NewsEvent event : events) {
      INews news = event.getEntity();
      long parentId = news.getParentId();
      if (!fBookmarkGrouping.isActive() && parentId != 0) {
        if (!handledBins.contains(parentId)) {
          INewsBin bin = newsBinDao.load(parentId);
          if (bin != null) //Could have been deleted meanwhile
            affectedBinFolders.add(bin.getParent());
          handledBins.add(parentId);
        }
      } else
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.dao.INewsBinDAO

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.