Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.INewsBin


    IFolder folderA = fFactory.createFolder(null, rootA, "Folder A");

    fFactory.createBookMark(null, rootA, new FeedLinkReference(new URI("bmA")), "BM Root A");
    fFactory.createBookMark(null, folderA, new FeedLinkReference(new URI("bmB")), "BM Folder A");

    INewsBin binRootA = fFactory.createNewsBin(null, rootA, "BIN Root A");
    INewsBin binFolderA = fFactory.createNewsBin(null, folderA, "BIN Folder A");

    createSimpleSearchMark(rootA, "SM Root A");
    createSimpleSearchMark(folderA, "SM Folder A");

    rootA = DynamicDAO.save(rootA);

    IFolder rootB = fFactory.createFolder(null, null, "Root B");
    IFolder folderB = fFactory.createFolder(null, rootB, "Folder B");

    fFactory.createBookMark(null, rootB, new FeedLinkReference(new URI("bmC")), "BM Root B");
    fFactory.createBookMark(null, folderB, new FeedLinkReference(new URI("bmD")), "BM Folder B");

    INewsBin binRootB = fFactory.createNewsBin(null, rootB, "BIN Root B");
    INewsBin binFolderB = fFactory.createNewsBin(null, folderB, "BIN Folder B");

    createSimpleSearchMark(rootB, "SM Root B");
    createSimpleSearchMark(folderB, "SM Folder B");

    rootB = DynamicDAO.save(rootB);

    /* Start Testing */
    IFolder rootACopy = fFactory.createFolder(null, null, "Root A");
    IFolder folderACopy = fFactory.createFolder(null, rootACopy, "Folder A");

    INewsBin binRootACopy = fFactory.createNewsBin(null, rootA, "BIN Root A");
    INewsBin binFolderACopy = fFactory.createNewsBin(null, folderACopy, "BIN Folder A");

    createSimpleSearchMark(rootACopy, "SM Root A");
    createSimpleSearchMark(folderACopy, "SM Folder A");

    IFolder rootBCopy = fFactory.createFolder(null, null, "Root B");
    IFolder folderBCopy = fFactory.createFolder(null, rootBCopy, "Folder B");

    INewsBin binRootBCopy = fFactory.createNewsBin(null, rootB, "BIN Root B");
    INewsBin binFolderBCopy = fFactory.createNewsBin(null, folderBCopy, "BIN Folder B");

    createSimpleSearchMark(rootBCopy, "SM Root B");
    createSimpleSearchMark(folderBCopy, "SM Folder B");

    IFolder rootC = fFactory.createFolder(null, null, "Root C");
    IFolder folderC = fFactory.createFolder(null, rootC, "Folder C");

    INewsBin binRootC = fFactory.createNewsBin(null, rootC, "BIN Root C");
    INewsBin binFolderC = fFactory.createNewsBin(null, folderC, "BIN Folder C");

    IFolder rootD = fFactory.createFolder(null, null, "Root D");
    rootD.setProperty(ITypeImporter.TEMPORARY_FOLDER, true);
    IFolder folderD = fFactory.createFolder(null, rootD, "Folder A");

    INewsBin binRootD = fFactory.createNewsBin(null, rootD, "BIN Root A");
    INewsBin binFolderD = fFactory.createNewsBin(null, folderD, "BIN Folder A");

    assertTrue(binRootA.getId() != -1);
    assertTrue(binFolderA.getId() != -1);
    assertTrue(binRootB.getId() != -1);
    assertTrue(binFolderB.getId() != -1);
View Full Code Here


  @Test
  public void testAddLabelToNewsCopy() throws Exception {
    IFeed parent = fFactory.createFeed(null, new URI("http://www.feed.com"));
    INews news = fFactory.createNews(null, parent, new Date());
    IFolder folder = fFactory.createFolder(null, null, "folder");
    INewsBin newsBin = fFactory.createNewsBin(1L, folder, "newsbin");
    INews newsCopy = fFactory.createNews(news, newsBin);
    newsCopy.addLabel(fFactory.createLabel(null, "label"));
    assertEquals(1, newsCopy.getLabels().size());
    Set<ILabel> labels = news.getLabels();
    labels.add(fFactory.createLabel(null, "Another label"));
View Full Code Here

          iterator.remove();
      }

      /* Bin (exclude if another Bin with same name Exists at same Location) */
      else if (child instanceof INewsBin) {
        INewsBin bin = (INewsBin) child;
        if (CoreUtils.existsNewsBin(bin))
          iterator.remove();
      }

      /* Search (exclude if another Search with same name Exists at same Location and same Conditions) */
 
View Full Code Here

          folder.removeChild(bm);
      }

      /* Bin (exclude if another Bin with same name Exists at same Location) */
      else if (child instanceof INewsBin) {
        INewsBin bin = (INewsBin) child;
        if (CoreUtils.existsNewsBin(bin))
          folder.removeChild(bin);
      }

      /* Search (exclude if another Search with same name Exists at same Location and same Conditions) */
 
View Full Code Here

   */
  @Test
  public void testBinRemoveNews() throws Exception {
    IFolder root = fFactory.createFolder(null, null, "Root");

    INewsBin bin = fFactory.createNewsBin(null, root, "Bin");

    DynamicDAO.save(bin);

    IFeed feed = fFactory.createFeed(null, new URI("feed"));
    INews news1 = fFactory.createNews(null, feed, new Date());
    INews news2 = fFactory.createNews(null, feed, new Date());
    INews news3 = fFactory.createNews(null, feed, new Date());

    DynamicDAO.save(feed);

    news1 = fFactory.createNews(news1, bin);
    DynamicDAO.save(news1);
    news2 = fFactory.createNews(news2, bin);
    DynamicDAO.save(news2);
    news3 = fFactory.createNews(news3, bin);
    DynamicDAO.save(news3);

    DynamicDAO.save(bin);

    bin.removeNews(news1);
    ((NewsBin) bin).removeNewsRefs(Arrays.asList(new NewsReference[] { news2.toReference() }));

    List<INews> news = bin.getNews();
    assertEquals(1, news.size());
    assertEquals(news3, news.get(0));
  }
View Full Code Here

        return select;
      }

      /* Bin (exclude if another Bin with same name Exists at same Location) */
      else if (element instanceof INewsBin) {
        INewsBin bin = (INewsBin) element;
        Boolean select = cache.get(bin);
        if (select == null) {
          select = !CoreUtils.existsNewsBin(bin);
          cache.put(bin, select);
        }
View Full Code Here

    DynamicDAO.save(feed1);
    DynamicDAO.save(feed2);
    DynamicDAO.save(feed3);

    INewsBin rootBin = fFactory.createNewsBin(null, rootFolder, "Root Bin");
    INewsBin subRootBin = fFactory.createNewsBin(null, subFolder, "Sub Root Bin");

    DynamicDAO.save(rootFolder);
    List<INews> copiedNews = new ArrayList<INews>();
    INews news1Copy = fFactory.createNews(news1, rootBin);
    copiedNews.add(news1Copy);
View Full Code Here

      }
    }

    /* Update NewsBin */
    else if (entity instanceof INewsBin) {
      INewsBin newsbin = (INewsBin) entity;

      /* Check for changed Name */
      if (!newsbin.getName().equals(fNameInput.getText())) {
        newsbin.setName(fNameInput.getText());
        entitiesToSave.add(newsbin);
      }
    }

    return true;
View Full Code Here

    news2.setState(INews.State.NEW);

    INews news3 = createNews(feed, "News3");
    news3.setState(INews.State.NEW);

    INewsBin bin = fFactory.createNewsBin(null, bm.getParent(), "Bin");
    DynamicDAO.save(bin);

    ISearchFilter filter = fFactory.createSearchFilter(null, null, "All News");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);

    IFilterAction action = fFactory.createFilterAction(COPY_NEWS_ID);
    action.setData(new Long[] { bin.getId() });
    filter.addAction(action);

    DynamicDAO.save(filter);

    fAppService.handleFeedReload(bm, feed, null, false, new NullProgressMonitor());

    List<INews> news = bm.getFeedLinkReference().resolve().getNews();
    assertEquals(3, news.size());
    assertEquals(3, bm.getNewsCount(EnumSet.of(INews.State.NEW)));
    for (INews newsitem : news) {
      assertEquals(INews.State.NEW, newsitem.getState());
      assertEquals(0, newsitem.getParentId());
    }

    List<INews> binNews = bin.getNews();
    assertEquals(3, bin.getNewsCount(EnumSet.of(INews.State.NEW)));
    for (INews newsitem : binNews) {
      assertEquals(INews.State.NEW, newsitem.getState());
      assertEquals(bin.getId(), (Long) newsitem.getParentId());
    }

  }
View Full Code Here

    news2.setState(INews.State.NEW);

    INews news3 = createNews(feed, "News3");
    news3.setState(INews.State.NEW);

    INewsBin bin = fFactory.createNewsBin(null, bm.getParent(), "Bin");
    DynamicDAO.save(bin);

    ISearchFilter filter = fFactory.createSearchFilter(null, null, "All News");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);

    IFilterAction action = fFactory.createFilterAction(MOVE_NEWS_ID);
    action.setData(new Long[] { bin.getId() });
    filter.addAction(action);

    DynamicDAO.save(filter);

    fAppService.handleFeedReload(bm, feed, null, false, new NullProgressMonitor());

    List<INews> news = bm.getFeedLinkReference().resolve().getNews();
    assertEquals(3, news.size());
    assertEquals(3, bm.getNewsCount(EnumSet.of(INews.State.DELETED)));
    for (INews newsitem : news) {
      assertEquals(INews.State.DELETED, newsitem.getState());
    }

    List<INews> binNews = bin.getNews();
    assertEquals(3, bin.getNewsCount(EnumSet.of(INews.State.NEW)));
    for (INews newsitem : binNews) {
      assertEquals(INews.State.NEW, newsitem.getState());
      assertEquals(bin.getId(), (Long) newsitem.getParentId());
    }
  }
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.