Package org.rssowl.core.internal.persist.dao

Examples of org.rssowl.core.internal.persist.dao.EntitiesToBeIndexedDAOImpl


    INews news = fFactory.createNews(null, feed, new Date());
    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here


    DynamicDAO.save(feed);

    news.setState(INews.State.HIDDEN);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    DynamicDAO.save(feed);

    news.setState(INews.State.DELETED);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    DynamicDAO.save(feed);

    news.setState(INews.State.READ);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    DynamicDAO.save(news);

    news.setState(INews.State.DELETED);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(1, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

    DynamicDAO.save(news);

    news.setState(INews.State.NEW);
    DynamicDAO.save(news);

    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    EntityIdsByEventType outstandingNewsIds = dao.load();
    assertEquals(2, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(1, outstandingNewsIds.getRemovedEntityRefs().size());

    /* Wait for Indexer */
    waitForIndexer();

    /* Force a Flush */
    runBogusSearch();

    outstandingNewsIds = dao.load();
    assertEquals(0, outstandingNewsIds.getPersistedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getUpdatedEntityRefs().size());
    assertEquals(0, outstandingNewsIds.getRemovedEntityRefs().size());
  }
View Full Code Here

  }

  public static EntitiesToBeIndexedDAOImpl getEntitiesToBeIndexedDAO() {
    DAOService service = InternalOwl.getDefault().getPersistenceService().getDAOService();
    if (service instanceof DAOServiceImpl) {
      EntitiesToBeIndexedDAOImpl entitiesToBeIndexedDAO = ((DAOServiceImpl) service).getEntitiesToBeIndexedDAO();
      return entitiesToBeIndexedDAO;
    }
    return null;
  }
View Full Code Here

  private static void updateNewsToBeIndexed(ObjectContainer db) {
    NewsEventRunnable newsEventRunnables = getNewsEventRunnables(EventsMap.getInstance().getEventRunnables());
    if (newsEventRunnables == null)
      return;

    EntitiesToBeIndexedDAOImpl dao = getEntitiesToBeIndexedDAO();
    EntityIdsByEventType newsToBeIndexed = dao.load();
    Set<NewsEvent> updateEvents = new HashSet<NewsEvent>(newsEventRunnables.getUpdateEvents().size());
    Set<NewsEvent> deleteEvents = new HashSet<NewsEvent>(newsEventRunnables.getRemoveEvents());
    Set<NewsEvent> persistEvents = filterPersistedNewsForIndexing(newsEventRunnables.getPersistEvents());
    for (NewsEvent event : newsEventRunnables.getUpdateEvents())
      indexTypeForNewsUpdate(event, persistEvents, updateEvents, deleteEvents);
View Full Code Here

      }
    }
  }

  private List<IndexingTask> getIndexOutstandingEntitiesTasks() {
    final EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    List<IndexingTask> indexingTasks = new ArrayList<IndexingTask>(3);
    if (dao != null) {
      RemovedNewsRefsListener removedNewsRefsListener = new IndexingTask.RemovedNewsRefsListener() {
        public void event(Collection<NewsReference> newsRefs) {
          LongArrayList list = new LongArrayList(newsRefs.size());
          for (NewsReference newsRef : newsRefs)
            list.add(newsRef.getId());
          EntityIdsByEventType entityIdsByEventType = dao.load();
          entityIdsByEventType.removeAll(list, list, list);
          dao.save(entityIdsByEventType);
        }
      };
      EntityIdsByEventType outstandingNewsIds = dao.load();
      List<NewsReference> persistedEntityRefs = outstandingNewsIds.getPersistedEntityRefs();
      if (!persistedEntityRefs.isEmpty())
        indexingTasks.add(new IndexingTask(Indexer.this, EventType.PERSIST, persistedEntityRefs, removedNewsRefsListener));

      List<NewsReference> updatedEntityRefs = outstandingNewsIds.getUpdatedEntityRefs();
View Full Code Here

      job.schedule();
    }
  }

  private static void doSaveCommittedNews(EntityIdsByEventType uncommittedNews) {
    EntitiesToBeIndexedDAOImpl dao = DBHelper.getEntitiesToBeIndexedDAO();
    if (dao != null) {
      EntityIdsByEventType newsToBeIndexed = dao.load();

      /*
       * null here means that there was a fast shutdown and the database is
       * already closed. We'll just re-index on start-up.
       */
      if (newsToBeIndexed != null) {
        newsToBeIndexed.removeAll(uncommittedNews.getPersistedEntityIds(), uncommittedNews.getUpdatedEntityIds(), uncommittedNews.getRemovedEntityIds());
        dao.save(newsToBeIndexed);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.persist.dao.EntitiesToBeIndexedDAOImpl

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.