Examples of ModelEvent


Examples of org.rssowl.core.model.events.ModelEvent

    }
    return null;
  }

  private ModelEvent createModelEvent(IEntity entity) {
    ModelEvent modelEvent = null;
    Map<Integer, ModelEvent> templatesMap = EventsMap.getInstance().getEventTemplatesMap();
    ModelEvent template = templatesMap.get(System.identityHashCode(entity));
    //TODO In some cases, the template is complete. We can save some object allocation
    //by reusing it.
   
    boolean root = isRoot(template);
    if (entity instanceof INews) {
View Full Code Here

Examples of org.rssowl.core.model.events.ModelEvent

    }
    return modelEvent;
  }

  private ModelEvent createNewsEvent(INews news, ModelEvent template, boolean root) {
    ModelEvent modelEvent;
    NewsEvent newsTemplate = (NewsEvent) template;
    INews oldNews = newsTemplate == null ? null : newsTemplate.getOldNews();
   
    modelEvent = new NewsEvent(oldNews, news, root);
    return modelEvent;
View Full Code Here

Examples of org.rssowl.core.model.events.ModelEvent

 
  /*
   * @see org.rssowl.core.model.dao.IModelDAO#saveBookMark(org.rssowl.core.model.types.IBookMark)
   */
  public IBookMark saveBookMark(IBookMark bookMark) throws PersistenceException  {
    ModelEvent event = new BookMarkEvent(bookMark, null, true);
    saveCommitAndFireEvents(event, false);
    return bookMark;
  }
View Full Code Here

Examples of org.rssowl.core.model.events.ModelEvent

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#saveCategory(org.rssowl.core.model.types.ICategory)
   */
  public ICategory saveCategory(ICategory category) throws PersistenceException {
    ModelEvent event = new CategoryEvent(category, true);
    saveCommitAndFireEvents(event, false);
    return category;
  }
View Full Code Here

Examples of org.rssowl.core.model.events.ModelEvent

  public INews saveNews(INews news) throws PersistenceException {
    INews oldNews = fDb.ext().peekPersisted(news, Integer.MAX_VALUE, true);
    if (news.isIdentical(oldNews))
      return news;
   
    ModelEvent event = new NewsEvent(oldNews, news, true);
    saveCommitAndFireEvents(event, false);
    return news;
  }
View Full Code Here

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

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

    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

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

  }

  public static final void saveNews(ObjectContainer db, INews news) {
    INews oldNews = db.ext().peekPersisted(news, 2, true);
    if (oldNews != null) {
      ModelEvent newsEventTemplate = new NewsEvent(oldNews, news, false);
      DBHelper.putEventTemplate(newsEventTemplate);
    }
    db.ext().set(news, 2);
  }
View Full Code Here

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

  }

  public static final void saveAndCascadeNews(ObjectContainer db, INews news, boolean root) {
    INews oldNews = db.ext().peekPersisted(news, 2, true);
    if (oldNews != null || root) {
      ModelEvent event = new NewsEvent(oldNews, news, root);
      putEventTemplate(event);
    }
    saveEntities(db, news.getCategories());
    saveEntity(db, news.getAuthor());
    saveEntities(db, news.getAttachments());
View Full Code Here

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

    DBHelper.cleanUpAndFireEvents();
  }

  private void save(Set<INews> newsList) {
    for (INews news : newsList) {
      ModelEvent newsEventTemplate = createSaveEventTemplate(news);
      DBHelper.putEventTemplate(newsEventTemplate);
      fDb.ext().set(news, 1);
    }
  }
View Full Code Here

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

  private void processUpdatedEvent(EventArgs args) {
    IEntity entity = getEntity(args);
    if (entity == null)
      return;

    ModelEvent event = createModelEvent(entity);
    if (event != null)
      EventsMap.getInstance().putUpdateEvent(event);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.