}
}
}
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();