Package org.rssowl.core.persist.reference

Examples of org.rssowl.core.persist.reference.NewsReference


    String authorName = news.getAuthor().getName();
    URI attachmentLink = news.getAttachments().get(0).getLink();
    String categoryName = news.getCategories().get(0).getName();
    URI sourceLink = news.getSource().getLink();
    DynamicDAO.save(news);
    NewsReference newsRef = new NewsReference(news.getId());
    feed = null;
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
    authorName = authorName + " changed";
    attachmentLink = createURI(attachmentLink.toString() + "/new");
    categoryName = categoryName + " changed";
    sourceLink = createURI(sourceLink.toString() + "/new");
    updateNews(authorName, attachmentLink, categoryName, sourceLink, news);
    DynamicDAO.save(news.getFeedReference().resolve());
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
  }
View Full Code Here


    String authorName = news.getAuthor().getName();
    URI attachmentLink = news.getAttachments().get(0).getLink();
    String categoryName = news.getCategories().get(0).getName();
    URI sourceLink = news.getSource().getLink();
    DynamicDAO.save(news);
    NewsReference newsRef = new NewsReference(news.getId());
    feed = null;
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
    authorName = authorName + " changed";
    attachmentLink = createURI(attachmentLink.toString() + "/new");
    categoryName = categoryName + " changed";
    sourceLink = createURI(sourceLink.toString() + "/new");
    updateNews(authorName, attachmentLink, categoryName, sourceLink, news);
    DynamicDAO.save(news);
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
  }
View Full Code Here

    String authorName = news.getAuthor().getName();
    URI attachmentLink = news.getAttachments().get(0).getLink();
    String categoryName = news.getCategories().get(0).getName();
    URI sourceLink = news.getSource().getLink();
    DynamicDAO.saveAll(Collections.singletonList(news));
    NewsReference newsRef = new NewsReference(news.getId());
    feed = null;
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
    authorName = authorName + " changed";
    attachmentLink = createURI(attachmentLink.toString() + "/new");
    categoryName = categoryName + " changed";
    sourceLink = createURI(sourceLink.toString() + "/new");
    updateNews(authorName, attachmentLink, categoryName, sourceLink, news);
    DynamicDAO.saveAll(Collections.singletonList(news));
    news = null;
    System.gc();
    news = newsRef.resolve();
    assertNewsEquals(categoryName, attachmentLink, authorName, sourceLink, news);
  }
View Full Code Here

    final IFeed feed;
    feed = DynamicDAO.save(createFeed());
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    INews newsItem = null;
    NewsReference newsRef = null;
    newsItem = DynamicDAO.save(initialNews);
    newsRef = new NewsReference(newsItem.getId());
    List<INews> newsList = new ArrayList<INews>();
    newsList.add(newsItem);
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.UPDATED, true, false);
    INews news = newsRef.resolve();
    assertEquals(State.UPDATED, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.DELETED, true, false);
    news = newsRef.resolve();
    assertEquals(State.DELETED, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.HIDDEN, false, false);
    news = newsRef.resolve();
    assertEquals(State.HIDDEN, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.READ, false, false);
    news = newsRef.resolve();
    assertEquals(State.READ, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.UNREAD, true, false);
    news = newsRef.resolve();
    assertEquals(State.UNREAD, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.NEW, true, false);
    news = newsRef.resolve();
    assertEquals(State.NEW, news.getState());
    // Make sure it doesn't change when we set it to the same
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.NEW, true, false);
    news = newsRef.resolve();
    assertEquals(State.NEW, news.getState());

    DynamicDAO.delete(newsRef.resolve());
    DynamicDAO.delete(feed);
  }
View Full Code Here

    final IFeed feed;
    feed = DynamicDAO.save(createFeed());
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    INews newsItem = null;
    NewsReference newsRef = null;
    newsItem = DynamicDAO.save(initialNews);
    newsRef = new NewsReference(newsItem.getId());
    List<INews> newsList = new ArrayList<INews>();
    newsList.add(newsItem);
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.DELETED, true, false);
    INews news = newsRef.resolve();
    assertEquals(State.DELETED, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.HIDDEN, true, false);
  }
View Full Code Here

    final IFeed feed;
    feed = DynamicDAO.save(createFeed());
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    INews newsItem = null;
    NewsReference newsRef = null;
    newsItem = DynamicDAO.save(initialNews);
    newsRef = new NewsReference(newsItem.getId());
    List<INews> newsList = new ArrayList<INews>();
    newsList.add(newsItem);
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.HIDDEN, true, false);
    INews news = newsRef.resolve();
    assertEquals(State.HIDDEN, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.READ, true, false);
  }
View Full Code Here

    final NewsReference[] newsRef = new NewsReference[1];
    newsAdapter = new NewsAdapter() {
      @Override
      public void entitiesAdded(Set<NewsEvent> events) {
        assertEquals(1, events.size());
        newsRef[0] = new NewsReference(events.iterator().next().getEntity().getId());
      }
    };
    DynamicDAO.addEntityListener(INews.class, newsAdapter);

    final News initialNews1 = (News) createNews(feed1);
    initialNews1.setGuid(null);
    initialNews1.setState(State.NEW);
    final News initialNews2 = (News) createNews(feed2);
    initialNews2.setGuid(null);
    initialNews2.setState(State.NEW);

    INews newsItem1 = null;
    NewsReference newsRef1 = null;

    INews newsItem2 = null;
    NewsReference newsRef2 = null;

    NewsReference newsRef3 = null;
    try {
      DynamicDAO.save(feed1);
      newsRef1 = newsRef[0];
      newsItem1 = newsRef1.resolve();

      feed2 = DynamicDAO.save(feed2);
      newsRef2 = newsRef[0];
      newsItem2 = newsRef2.resolve();

      final News initialNews3 = (News) createNews(feed2);
      initialNews3.setTitle("Some other title");
      initialNews3.setGuid(null);
      initialNews3.setLink(null);
      initialNews3.setState(State.NEW);
      DynamicDAO.save(feed2);
      newsRef3 = newsRef[0];
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    } finally {
      DynamicDAO.removeEntityListener(INews.class, newsAdapter);
    }
    try {
      List<INews> newsList1 = new ArrayList<INews>();
      newsList1.add(newsItem1);

      List<INews> newsList2 = new ArrayList<INews>();
      newsList2.add(newsItem2);

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UPDATED, true, false);
      INews news1 = newsRef1.resolve();
      INews news2 = newsRef2.resolve();
      INews news3 = newsRef3.resolve();
      assertEquals(State.UPDATED, news1.getState());
      assertEquals(State.UPDATED, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());

      // Make sure it doesn't change when we set it to the same
      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.HIDDEN, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.HIDDEN, news1.getState());
      assertEquals(State.HIDDEN, news2.getState());
      assertEquals(State.NEW, news3.getState());

      DynamicDAO.delete(newsRef1.resolve());
View Full Code Here

    newsAdapter = new NewsAdapter() {
      @Override
      public void entitiesAdded(Set<NewsEvent> events) {
        assertEquals(1, events.size());
        newsRef[0] = new NewsReference(events.iterator().next().getEntity().getId());
      }
    };
    DynamicDAO.addEntityListener(INews.class, newsAdapter);
    INews newsItem1 = null;
    NewsReference newsRef1 = null;

    INews newsItem2 = null;
    NewsReference newsRef2 = null;

    NewsReference newsRef3 = null;
    try {
      DynamicDAO.save(feed1);
      newsRef1 = newsRef[0];
      newsItem1 = newsRef1.resolve();

      feed2 = DynamicDAO.save(feed2);
      newsRef2 = newsRef[0];
      newsItem2 = newsRef2.resolve();

      final News initialNews3 = (News) createNews(feed2);
      initialNews3.setTitle("Some other title");
      initialNews3.setGuid(null);
      initialNews3.setLink(null);
      initialNews3.setState(State.NEW);
      DynamicDAO.save(feed2);
      newsRef3 = newsRef[0];
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    } finally {
      DynamicDAO.removeEntityListener(INews.class, newsAdapter);
    }
    try {
      List<INews> newsList1 = new ArrayList<INews>();
      newsList1.add(newsItem1);

      List<INews> newsList2 = new ArrayList<INews>();
      newsList2.add(newsItem2);

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UPDATED, true, false);
      INews news1 = newsRef1.resolve();
      INews news2 = newsRef2.resolve();
      INews news3 = newsRef3.resolve();
      assertEquals(State.UPDATED, news1.getState());
      assertEquals(State.UPDATED, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.READ, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.READ, news1.getState());
      assertEquals(State.READ, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.UNREAD, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.UNREAD, news1.getState());
      assertEquals(State.UNREAD, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList2, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());

      // Make sure it doesn't change when we set it to the same
      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.NEW, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.NEW, news1.getState());
      assertEquals(State.NEW, news2.getState());
      assertEquals(State.NEW, news3.getState());

      Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList1, State.DELETED, true, false);
      news1 = newsRef1.resolve();
      news2 = newsRef2.resolve();
      news3 = newsRef3.resolve();
      assertEquals(State.DELETED, news1.getState());
      assertEquals(State.DELETED, news2.getState());
      assertEquals(State.NEW, news3.getState());

      DynamicDAO.delete(newsRef1.resolve());
View Full Code Here

    final IFeed feed = DynamicDAO.save(createFeed());
    final News initialNews = (News) createNews(feed);
    initialNews.setState(State.NEW);
    initialNews.setGuid(null);
    INews newsItem = null;
    NewsReference newsRef = null;
    newsItem = DynamicDAO.save(initialNews);
    newsRef = new NewsReference(newsItem.getId());
    List<INews> newsList = new ArrayList<INews>();
    newsList.add(newsItem);
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.UPDATED, true, false);
    INews news = newsRef.resolve();
    assertEquals(State.UPDATED, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.READ, true, false);
    news = newsRef.resolve();
    assertEquals(State.READ, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.UNREAD, true, false);
    news = newsRef.resolve();
    assertEquals(State.UNREAD, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.READ, true, false);
    news = newsRef.resolve();
    assertEquals(State.READ, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.UNREAD, true, false);
    news = newsRef.resolve();
    assertEquals(State.UNREAD, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.NEW, true, false);
    news = newsRef.resolve();
    assertEquals(State.NEW, news.getState());
    // Make sure it doesn't change when we set it to the same
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.NEW, true, false);
    news = newsRef.resolve();
    assertEquals(State.NEW, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.DELETED, true, false);
    news = newsRef.resolve();
    assertEquals(State.DELETED, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.READ, false, false);
    news = newsRef.resolve();
    assertEquals(State.READ, news.getState());
    Owl.getPersistenceService().getDAOService().getNewsDAO().setState(newsList, State.HIDDEN, false, false);
    news = newsRef.resolve();
    assertEquals(State.HIDDEN, news.getState());

    DynamicDAO.delete(newsRef.resolve());
    DynamicDAO.delete(feed);
  }
View Full Code Here

  public NewsNotificationItem(INews news) {
    super(makeText(news), makeImage(news));

    fNewsLink = news.getLink();
    fFeedReference = news.getFeedReference();
    fNewsReference = new NewsReference(news.getId());
    fRecentNewsDate = DateUtils.getRecentDate(news);
    fIsNewsSticky = news.isFlagged();
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.reference.NewsReference

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.