Package org.rssowl.core.internal.persist

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


  }

  public void testNewsDAOSetStateFromDeletedWithAffectEquivalentNews() {
    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>();
View Full Code Here


  }

  public void testNewsDAOSetStateFromHiddenWithAffectEquivalentNews() {
    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>();
View Full Code Here

        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;
View Full Code Here

      feed2 = DynamicDAO.save(tempFeed);
    } catch (PersistenceException e) {
      fail(e.getMessage());
      return;
    }
    final News initialNews1 = (News) createNews(feed1);
    initialNews1.setState(State.NEW);
    final News initialNews2 = (News) createNews(feed2);
    initialNews2.setState(State.NEW);

    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);
    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;
View Full Code Here

   * Tests {@link INewsDAO#setState(Collection, State, boolean, boolean)}.
   */
  @Test
  public void testNewsManagerSetStateWithGuidNull() {
    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>();
View Full Code Here

    try {
      for (INews news : newsCollection)
        saveAndCascadeNews(db, news, root);
    } finally {
      for (INews news : newsCollection) {
        News n = (News) news;
        n.releaseReadLockSpecial();
        n.clearTransientDescription();
      }
    }
  }
View Full Code Here

    db.ext().set(news, 2);
    saveDescription(db, news);
  }

  private static void saveDescription(ObjectContainer db, INews news) {
    News n = (News) news;

    /*
     * Avoid loading from the db if the description of the news being saved has
     * not been changed.
     */
    if (!n.isTransientDescriptionSet())
      return;

    Description dbDescription = null;
    String dbDescriptionValue = null;

    dbDescription = getDescriptionDAO().load(news.getId());
    if (dbDescription != null)
      dbDescriptionValue = dbDescription.getValue();

    String newsDescriptionValue = n.getTransientDescription();

    /*
     * If the description in the news has been set to null and it's already null
     * in the database, there is nothing to do.
     */
 
View Full Code Here

  private void unlockNewsObjects(MergeResult mergeResult) {
    if (mergeResult != null) {
      for (Object object : mergeResult.getUpdatedObjects()) {
        if (object instanceof News) {
          News news = (News) object;
          news.releaseReadLockSpecial();
          news.clearTransientDescription();
        }
      }
    }
  }
View Full Code Here

        IFeed feed = new Feed(feedLink);

        if (withRetention) {
          for (int j = 0; j < 10; j++) {
            INews news = new News(feed);
            news.setTitle("Random Title " + j);
            news.setDescription(getLongDecription());
            news.setLink(new URI("http://www." + System.currentTimeMillis() + ".com/" + rand.nextInt(10000) + j));
            news.setComments("Comments");
            news.setState(INews.State.READ);
            feed.addNews(news);
          }
        }

        feed = DynamicDAO.save(feed);
View Full Code Here

    FolderNewsMark mark = new FolderNewsMark(childFolder);
    mark.resolve(NewsFilter.Type.SHOW_ALL, null);

    List<NewsEvent> events = new ArrayList<NewsEvent>();
    News oldNews = new News((News) news1, -1);
    oldNews.setId(news1.getId());
    NewsEvent event1 = new NewsEvent(oldNews, news1, true);
    news1.setState(INews.State.HIDDEN);
    News oldNews2 = new News((News) copiedNews1, -1);
    oldNews2.setId(copiedNews1.getId());
    NewsEvent event2 = new NewsEvent(oldNews2, copiedNews1, true);
    copiedNews1.setState(INews.State.HIDDEN);
    News oldNews3 = new News((News) otherNews1, -1);
    oldNews3.setId(otherNews1.getId());
    NewsEvent event3 = new NewsEvent(oldNews3, otherNews1, true);
    otherNews1.setState(INews.State.HIDDEN);
    events.add(event1);
    events.add(event2);
    events.add(event3);
View Full Code Here

TOP

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

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.