Package org.rssowl.core.internal.persist

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


      oc.activate(newsBin, Integer.MAX_VALUE);
      for (NewsReference newsRef : newsBin.getNewsRefs()) {
        Query query = oc.query();
        query.constrain(News.class);
        query.descend("fId").constrain(newsRef.getId()); //$NON-NLS-1$
        News news = (News) query.execute().iterator().next();
        oc.activate(news, Integer.MAX_VALUE);
        String parentIdFieldName = "fParentId"; //$NON-NLS-1$
        MigrationHelper.setField(news, parentIdFieldName, newsBin.getId().longValue());
        oc.ext().store(news, Integer.MAX_VALUE);
      }
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().store(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

       * news. This should be fine because if the News has no id, it means
       * that it's not known to anyone but the caller and we will acquire the
       * read lock again before issuing any event.
       */
      if (entity instanceof News) {
        News n = (News) entity;
        n.releaseReadLockSpecial();
        try {
          entity.setId(id);
        } finally {
          n.acquireReadLockSpecial();
        }
      } else {
        entity.setId(id);
      }
    }
View Full Code Here

    IFolderChild mark = fFactory.createBookMark(null, (IFolder) child, new FeedLinkReference(feed.getLink()), "Mark");
    DynamicDAO.save(mark);

    IFolderChild bin = fFactory.createNewsBin(null, (IFolder) root, "Bin");
    DynamicDAO.save(bin);
    News copiedNews = new News((News) news1, bin.getId().longValue());
    DynamicDAO.save(copiedNews);
    DynamicDAO.save(bin);

    /* Wait for Indexer */
    waitForIndexer();
View Full Code Here

    ILabel label1 = new Label(null, "Label1");
    ILabel label2 = new Label(null, "Label2");
    ILabel label3 = new Label(null, "Label3");

    IFeed feed = new Feed(new URI("http://www.link.com"));
    INews news1 = new News(null, feed, new Date());
    news1.addLabel(label1);
    news1.addLabel(label3);

    INews news2 = new News(null, feed, new Date());
    news2.addLabel(label1);

    INews news3 = new News(null, feed, new Date());
    news3.setPublishDate(new Date(System.currentTimeMillis() + 1000));
    news3.addLabel(label1);
    news3.addLabel(label2);

    INews news4 = new News(null, feed, new Date());

    feed.addNews(news1);
    feed.addNews(news2);
    feed.addNews(news3);
    feed.addNews(news4);
View Full Code Here

   * (java.util.Collection)
   */
  @Override
  protected void postSaveAll(Collection<INews> objects) {
    for (INews news : objects) {
      News n = (News) news;
      n.releaseReadLockSpecial();
      n.clearTransientDescription();
    }
  }
View Full Code Here

      fDb.ext().set(news, 1);
    }
  }

  private RuntimeException createIllegalException(String message, INews newsItem) {
    News dbNews = (News) DBHelper.peekPersistedNews(fDb, newsItem);
    if (dbNews == null)
      return new IllegalArgumentException("The news has been deleted from the persistence layer: " + newsItem); //$NON-NLS-1$

    return new IllegalStateException(message + ". This news in the db looks like: " + dbNews.toLongString()); //$NON-NLS-1$
  }
View Full Code Here

       * This should be fine because if the News has no id, it means that it's
       * not known to anyone but the caller and we will acquire the read lock
       * again before issuing any event.
       */
      if (entity instanceof News) {
        News n = (News) entity;
        n.releaseReadLockSpecial();
        try {
          entity.setId(id);
        } finally {
          n.acquireReadLockSpecial();
        }
      } else {
        entity.setId(id);
      }
    }
View Full Code Here

  @Test
  public void testIsDateChange() throws Exception {
    Date now = new Date();

    IFeed feed = new Feed(new URI("http://www.link.com"));
    INews news1 = new News(null, feed, new Date());
    news1.setPublishDate(now);

    INews news2 = new News(null, feed, new Date());
    news2.setPublishDate(now);

    INews news3 = new News(null, feed, new Date());
    news3.setPublishDate(new Date(System.currentTimeMillis() + 1000));

    feed.addNews(news1);
    feed.addNews(news2);
    feed.addNews(news3);
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.