Package org.rssowl.core.internal.persist

Examples of org.rssowl.core.internal.persist.SortedLongArrayList


    Activator activator = Activator.getDefault();
    activator.getLog().log(activator.createWarningStatus(message, null));
  }

  private void saveFeed(MergeResult mergeResult) {
    SortedLongArrayList descriptionUpdatedIds = new SortedLongArrayList(10);
    for (Object o : mergeResult.getRemovedObjects()) {
      /* We know that in these cases, the parent entity will be updated */
      if (o instanceof INews)
        EventManager.getInstance().addItemBeingDeleted(((INews) o).getFeedReference());
      else if (o instanceof IAttachment)
        EventManager.getInstance().addItemBeingDeleted(((IAttachment) o).getNews());
      else if (o instanceof Description)
        descriptionUpdatedIds.add(((Description) o).getNews().getId());

      fDb.delete(o);
    }

    List<Object> otherObjects = new ArrayList<Object>();
    for (Object o : mergeResult.getUpdatedObjects()) {
      if (o instanceof INews)
        DBHelper.saveNews(fDb, (INews) o);
      else {
        if (o instanceof Description)
          descriptionUpdatedIds.add(((Description) o).getNews().getId());

        otherObjects.add(o);
      }
    }

    for (Object o : otherObjects) {
      if (o instanceof IFeed) {
        fDb.ext().store(o, 2);
      } else
        fDb.ext().store(o, 1);
    }

    NewsEventRunnable eventRunnables = DBHelper.getNewsEventRunnables(EventsMap.getInstance().getEventRunnables());
    if (eventRunnables != null) {
      for (NewsEvent event : eventRunnables.getAllEvents())
        descriptionUpdatedIds.removeByElement(event.getEntity().getId().longValue());
    }

    INewsDAO newsDao = DynamicDAO.getDAO(INewsDAO.class);
    for (int i = 0, c = descriptionUpdatedIds.size(); i < c; ++i) {
      long newsId = descriptionUpdatedIds.get(i);
      INews news = newsDao.load(newsId);
      INews oldNews = DBHelper.peekPersistedNews(fDb, news);
      EventsMap.getInstance().putUpdateEvent(new NewsEvent(oldNews, news, false));
    }
  }
View Full Code Here


    fRemovedEntities = new LongArrayList(o.fRemovedEntities);
  }

  public EntityIdsByEventType(boolean sorted) {
    if (sorted) {
      fPersistedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
      fUpdatedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
      fRemovedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
    } else {
      fPersistedEntities = new LongArrayList(DEFAULT_CAPACITY);
      fUpdatedEntities = new LongArrayList(DEFAULT_CAPACITY);
      fRemovedEntities = new LongArrayList(DEFAULT_CAPACITY);
    }
View Full Code Here

    fRemovedEntities = new LongArrayList(o.fRemovedEntities);
  }

  public EntityIdsByEventType(boolean sorted) {
    if (sorted) {
      fPersistedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
      fUpdatedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
      fRemovedEntities = new SortedLongArrayList(DEFAULT_CAPACITY);
    } else {
      fPersistedEntities = new LongArrayList(DEFAULT_CAPACITY);
      fUpdatedEntities = new LongArrayList(DEFAULT_CAPACITY);
      fRemovedEntities = new LongArrayList(DEFAULT_CAPACITY);
    }
View Full Code Here

    Activator activator = Activator.getDefault();
    activator.getLog().log(activator.createWarningStatus(message, null));
  }

  private void saveFeed(MergeResult mergeResult) {
    SortedLongArrayList descriptionUpdatedIds = new SortedLongArrayList(10);

    /* Removed Objects */
    for (Object o : mergeResult.getRemovedObjects()) {
      if (o instanceof INews)
        EventManager.getInstance().addItemBeingDeleted(((INews) o).getFeedReference());
      else if (o instanceof IAttachment)
        EventManager.getInstance().addItemBeingDeleted(((IAttachment) o).getNews());
      else if (o instanceof Description)
        descriptionUpdatedIds.add(((Description) o).getNews().getId());

      fDb.delete(o);
    }

    /* Updated Objects */
    List<Object> otherObjects = new ArrayList<Object>();
    for (Object o : mergeResult.getUpdatedObjects()) {
      if (o instanceof INews)
        DBHelper.saveUpdatedNews(fDb, (INews) o);
      else {
        if (o instanceof Description)
          descriptionUpdatedIds.add(((Description) o).getNews().getId());

        otherObjects.add(o);
      }
    }

    for (Object o : otherObjects) {
      if (o instanceof IFeed)
        fDb.ext().set(o, 2);
      else
        fDb.ext().set(o, 1);
    }

    NewsEventRunnable eventRunnables = DBHelper.getNewsEventRunnables(EventsMap.getInstance().getEventRunnables());
    if (eventRunnables != null) {
      for (NewsEvent event : eventRunnables.getAllEvents())
        descriptionUpdatedIds.removeByElement(event.getEntity().getId().longValue());
    }

    INewsDAO newsDao = DynamicDAO.getDAO(INewsDAO.class);
    for (int i = 0, c = descriptionUpdatedIds.size(); i < c; ++i) {
      long newsId = descriptionUpdatedIds.get(i);
      INews news = newsDao.load(newsId);
      INews oldNews = DBHelper.peekPersistedNews(fDb, news);
      EventsMap.getInstance().putUpdateEvent(new NewsEvent(oldNews, news, false));
    }
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.internal.persist.SortedLongArrayList

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.