Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.INewsBin


        name = bookMark.getName();
      else
        name = feedRef;

      if (news.getParentId() != 0) {
        INewsBin bin = DynamicDAO.load(INewsBin.class, news.getParentId());
        if (bin != null) {
          name = NLS.bind(Messages.NewsTableLabelProvider_BIN_NAME, bin.getName(), name);
        }
      }

      return StringUtils.replaceAll(name, "&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here


          /* Location: Bin */
          if (news.getParentId() > 0) {
            String location = fMapBinIdToLocation.get(news.getParentId());
            if (location == null) {
              NewsBinReference ref = new NewsBinReference(news.getParentId());
              INewsBin bin = ref.resolve();
              location = bin.getName();
              fMapBinIdToLocation.put(news.getParentId(), location);
            }

            text = location;
          }
View Full Code Here

    news.setLink(new URI("http://www.news.com"));

    DynamicDAO.save(feed);

    IFolder folder = fFactory.createFolder(null, null, "Root");
    INewsBin bin = fFactory.createNewsBin(null, folder, "Bin");

    DynamicDAO.save(folder);

    INews copiedNews = fFactory.createNews(news, bin);
    DynamicDAO.save(copiedNews);
    DynamicDAO.save(bin);

    UndoStack.getInstance().addOperation(new CopyOperation(Collections.singletonList(copiedNews)));

    assertTrue(bin.containsNews(copiedNews));

    UndoStack.getInstance().undo();

    assertEquals(0, bin.getNewsCount(INews.State.getVisible()));

    UndoStack.getInstance().redo();

    assertTrue(bin.containsNews(copiedNews));
  }
View Full Code Here

    DynamicDAO.save(feed);

    IFolder folder = fFactory.createFolder(null, null, "Root");
    IBookMark bookmark = fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Bookmark");
    INewsBin bin = fFactory.createNewsBin(null, folder, "Bin");

    DynamicDAO.save(folder);

    INews copiedNews = fFactory.createNews(news, bin);
    DynamicDAO.save(copiedNews);
    DynamicDAO.save(bin);

    UndoStack.getInstance().addOperation(new MoveOperation(Collections.singletonList(news), Collections.singletonList(copiedNews), false));

    /* Remove (it's a move!) */
    DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.HIDDEN, false, false);

    assertTrue(bin.containsNews(copiedNews));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) == 0);

    UndoStack.getInstance().undo();

    assertTrue(bin.getNewsCount(INews.State.getVisible()) == 0);

    assertTrue(bookmark.containsNews(news));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) > 0);

    UndoStack.getInstance().redo();

    assertTrue(bin.containsNews(copiedNews));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) == 0);
  }
View Full Code Here

   * @return a list of {@link INewsBin} loaded from the provided IDs.
   */
  public static List<INewsBin> toBins(Long[] primitives) {
    List<INewsBin> bins = new ArrayList<INewsBin>(primitives.length);
    for (Long id : primitives) {
      INewsBin bin = DynamicDAO.load(INewsBin.class, id);
      if (bin != null)
        bins.add(bin);
    }

    return bins;
View Full Code Here

    /* News Bins */
    if (primitives.length == 3) {
      for (int i = 0; primitives[NEWSBIN] != null && i < primitives[NEWSBIN].length; i++) {
        try {
          if (primitives[NEWSBIN][i] != null && primitives[NEWSBIN][i] != 0) {
            INewsBin newsbin = new NewsBinReference(primitives[NEWSBIN][i]).resolve();
            if (newsbin != null)
              childs.add(newsbin);
          }
        } catch (PersistenceException e) {
          /* Ignore - Could be deleted already */
 
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testIsLocationChange() throws Exception {
    IFolder root = fFactory.createFolder(null, null, "Root");
    INewsBin bin1 = fFactory.createNewsBin(null, root, "A");
    INewsBin bin2 = fFactory.createNewsBin(null, root, "B");

    DynamicDAO.save(root);

    IFeed feed = new Feed(new URI("http://www.link.com"));
    INews news1 = new News(null, feed, new Date());
View Full Code Here

      /* Receive NewsBins */
      if (value.length == 3) {
        for (int i = 0; value[2] != null && i < value[2].length; i++) {
          if (value[2][i] != null) {
            INewsBin newsbin = new NewsBinReference(value[2][i]).resolve();
            if (newsbin != null)
              addNewsBinLocationClause(bQuery, newsbin);
          }
        }
      }
View Full Code Here

      ISearchMark mark = (ISearchMark) entity;
      SearchMarkEvent eventTemplate = (SearchMarkEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new SearchMarkEvent(mark, oldParent, root);
    } else if (entity instanceof INewsBin) {
      INewsBin newsBin = (INewsBin) entity;
      NewsBinEvent eventTemplate = (NewsBinEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new NewsBinEvent(newsBin, oldParent, root);
    } else if (entity instanceof IFolder) {
      IFolder folder = (IFolder) entity;
View Full Code Here

    if (!statesUpdateInfos.isEmpty()) {
      Set<FeedLinkReference> removedFeedRefs = new HashSet<FeedLinkReference>();
      INewsBinDAO newsBinDAO = DynamicDAO.getDAO(INewsBinDAO.class);
      for (Map.Entry<Long, List<StatesUpdateInfo>> mapEntry : statesUpdateInfos.entrySet()) {
        INewsBin newsBin = newsBinDAO.load(mapEntry.getKey());
        if (newsBin.updateNewsStates(mapEntry.getValue())) {
          removeNews(db, removedFeedRefs, newsBin.removeNews(EnumSet.of(INews.State.DELETED)));
          putEventTemplate(new NewsBinEvent(newsBin, null, true));
          db.ext().set(newsBin, Integer.MAX_VALUE);
        }
      }
      removeFeedsAfterNewsBinUpdate(db, removedFeedRefs);
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.INewsBin

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.