Package org.rssowl.core.persist.event

Examples of org.rssowl.core.persist.event.ModelEvent


    }
    return null;
  }

  private ModelEvent createModelEvent(IEntity entity) {
    ModelEvent modelEvent = null;
    Map<IEntity, ModelEvent> templatesMap = EventsMap.getInstance().getEventTemplatesMap();
    ModelEvent template = templatesMap.get(entity); //TODO In some cases, the template is complete. We can save some object allocation by reusing it.

    boolean root = isRoot(template);
    boolean merged = isMerged(template);
    if (entity instanceof INews) {
      modelEvent = createNewsEvent((INews) entity, template, root, merged);
View Full Code Here


    return modelEvent;
  }

  private ModelEvent createNewsEvent(INews news, ModelEvent template, boolean root, boolean merged) {
    ModelEvent modelEvent;
    NewsEvent newsTemplate = (NewsEvent) template;
    INews oldNews = newsTemplate == null ? null : newsTemplate.getOldNews();

    modelEvent = new NewsEvent(oldNews, news, root, merged);
    return modelEvent;
View Full Code Here

  public static final void saveFeed(ObjectContainer db, IFeed feed) {
    if (feed.getId() == null && feedExists(db, feed.getLink()))
      throw new UniqueConstraintException("link", feed); //$NON-NLS-1$

    ModelEvent feedEventTemplate = new FeedEvent(feed, true);
    DBHelper.putEventTemplate(feedEventTemplate);
    saveAndCascadeAllNews(db, feed.getNews(), false);
    saveEntities(db, feed.getCategories());
    saveEntity(db, feed.getAuthor());
    saveEntity(db, feed.getImage());
View Full Code Here

  }

  public static final void saveUpdatedNews(ObjectContainer db, INews news) {
    INews oldNews = peekPersistedNews(db, news);
    if (oldNews != null) {
      ModelEvent newsEventTemplate = new NewsEvent(oldNews, news, false, true);
      DBHelper.putEventTemplate(newsEventTemplate);
    }

    db.ext().set(news, 2);
  }
View Full Code Here

  }

  public static final void saveAndCascadeNews(ObjectContainer db, INews news, boolean root) {
    INews oldNews = peekPersistedNews(db, news);
    if (oldNews != null || root) {
      ModelEvent event = new NewsEvent(oldNews, news, root);
      putEventTemplate(event);
    }

    saveEntities(db, news.getCategories());
    saveEntity(db, news.getAuthor());
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.event.ModelEvent

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.