Package org.rssowl.core.model.events

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


    FeedListener feedListener = null;
    try {
      feedListener = new FeedAdapter() {
        @Override
        public void feedAdded(Set<FeedEvent> events) {
          FeedEvent event = events.iterator().next();
          try {
            feedAddedCalled[0] = true;
            initialAuthor[0] = (Person) initialFeed.getAuthor();
            initialImage[0] = (Image) initialFeed.getImage();
            Feed dbFeed = (Feed) event.getEntity();
            initialAuthor[0].setId(dbFeed.getAuthor().getId());
            initialAuthor[0].isIdentical(dbFeed.getAuthor());
            initialImage[0].equals(dbFeed.getImage());
            initialFeed.setId(dbFeed.getId());
            assertTrue(NOT_IDENTICAL_MESSAGE, initialFeed.isIdentical(dbFeed));
            dbFeed.setCopyright("GPL");
            dbFeed.setFormat("someDifferentformat");
            dbFeed.getImage().setHeight(150);
            dbFeed.getImage().setDescription("Some new description");
            dbFeed.getImage().setTitle("yet another title");
            updatedFeed[0] = dbFeed;
            fModelDAO.saveFeed(dbFeed);
          } catch (PersistenceException e) {
            fail(e.getMessage());
          }
        }

        @Override
        public void feedUpdated(Set<FeedEvent> events) {
          FeedEvent event = events.iterator().next();
          feedUpdatedCalled[0] = true;
          Feed dbFeed = (Feed) event.getEntity();
          assertTrue(updatedFeed[0].isIdentical(dbFeed));
        }
      };
      NewsModel.getDefault().addFeedListener(feedListener);
      fModelDAO.saveFeed(initialFeed);
View Full Code Here


    try {
      feedListener = new FeedAdapter() {
        @Override
        public void feedAdded(Set<FeedEvent> events) {
          try {
            FeedEvent event = events.iterator().next();
            Feed dbFeed = (Feed) event.getEntity();
            dbFeed.setDescription("feed description2");
            dbFeed.setTitle("feed title2");
            dbFeed.getImage().setDescription("Some new description");
            dbFeed.getImage().setTitle("yet another title");
            dbFeed.getImage().setLink(createURI("http://www.newimageuri.com"));
            updatedFeed[0] = dbFeed;
            fModelDAO.saveFeed(dbFeed);
          } catch (PersistenceException e) {
            TestUtils.fail(e);
          }
        }
          @Override
        public void feedUpdated(Set<FeedEvent> events) {
          try {
            FeedEvent event = events.iterator().next();
            //TODO Add method to load entities without using the cache and
            //then use it here. Atm, this test won't actually show the bug
            //we want it to show because it's getting the feed from the cache
            //bypassing the db inconsistency
            Feed dbFeed = (Feed) event.getEntity();
            assertEquals(feedLink.toString(), dbFeed.getLink().toString());
          } catch (RuntimeException re) {
            fail(re.getMessage());
          }
        }
View Full Code Here

    int id = System.identityHashCode(modelEvent.getEntity());
    EventsMap.getInstance().putEventTemplate(id, modelEvent);
  }
 
  static final void saveFeed(ObjectContainer db, IFeed feed) {
    ModelEvent feedEventTemplate = new FeedEvent(feed, true);
    DBHelper.putEventTemplate(feedEventTemplate);
    List<INews> changedNews = new ArrayList<INews>(feed.getNews().size());
   
    for (INews news : feed.getNews()) {
      INews oldNews = db.ext().peekPersisted(news, 2, true);
View Full Code Here

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#deleteFeed(org.rssowl.core.model.reference.FeedReference)
   */
  public final void deleteFeed(FeedReference reference) throws PersistenceException {
    IFeed feed = loadFeed(reference.getId());
    FeedEvent event = new FeedEvent(feed, true);
    deleteEntityAndFireEvents(event);
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.dao.IModelDAO#deleteFeed(org.rssowl.core.model.reference.FeedLinkReference)
   */
  public final void deleteFeed(FeedLinkReference reference) throws PersistenceException {
    IFeed feed = NewsModel.getDefault().getPersistenceLayer().getApplicationLayer().loadFeed(reference.getLink());
    FeedEvent event = new FeedEvent(feed, true);
    deleteEntityAndFireEvents(event);
  }
View Full Code Here

      ICategory category = (ICategory) entity;
      modelEvent = new CategoryEvent(category, root);
    }
    else if (entity instanceof IFeed) {
      IFeed feed = (IFeed) entity;
      modelEvent = new FeedEvent(feed, root);
    }
    else if (entity instanceof IPerson) {
      IPerson person = (IPerson) entity;
      modelEvent = new PersonEvent(person, root);
    }
View Full Code Here

TOP

Related Classes of org.rssowl.core.model.events.FeedEvent

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.