Examples of IFolderChild


Examples of org.rssowl.core.persist.IFolderChild

      return composite;
    }

    private void onCreateNewsBin() {
      IFolderChild selectedFolderChild = null;
      IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();
      if (!selection.isEmpty()) {
        Object element = selection.getFirstElement();
        if (element instanceof IFolderChild)
          selectedFolderChild = (IFolderChild) element;
      }

      IFolder folder = (IFolder) ((selectedFolderChild instanceof IFolder) ? selectedFolderChild : null);
      IMark position = null;
      if (folder == null && selectedFolderChild != null && selectedFolderChild instanceof IMark) {
        folder = selectedFolderChild.getParent();
        position = (IMark) selectedFolderChild;
      }

      NewNewsBinAction action = new NewNewsBinAction(getShell(), folder, position);
      action.run(null);
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

   * @return a {@link Pair} of location as {@link IFolder} and position as
   * {@link IFolderChild} or <code>null</code> if no position can be determined.
   */
  public static Pair<IFolder, IFolderChild> getLocationAndPosition(IStructuredSelection selection) {
    IFolder folder = null;
    IFolderChild position = null;

    /* Check Selection */
    if (!selection.isEmpty()) {
      Object firstElement = selection.getFirstElement();
      if (firstElement instanceof IFolder)
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

    assertNotNull(firstSet);
    assertNotNull(secondSet);

    assertEquals(1, firstSet.getChildren().size());
    IFolderChild child = firstSet.getChildren().iterator().next();
    assertTrue(child instanceof IFolder);
    assertEquals("Folder A", child.getName());

    IFolder folderA = (IFolder) child;

    assertEquals(1, folderA.getMarks().size());
    assertEquals(1, folderA.getFolders().size());

    List<IFolderChild> children = folderA.getChildren();
    IBookMark rssowlMark = null;
    IFolder bins = null;
    for (IFolderChild foo : children) {
      if (foo instanceof IBookMark && "RSSOwl - A Java RSS / RDF / Atom Newsreader - May the owl be with you".equals(foo.getName()))
        rssowlMark = (IBookMark) foo;
      else if (foo instanceof IFolder && "Bins".equals(foo.getName()))
        bins = (IFolder) foo;
      else
        fail();
    }

    assertNotNull(rssowlMark);
    assertNotNull(bins);

    assertEquals(1, bins.getChildren().size());
    IFolderChild next = bins.getChildren().iterator().next();
    assertEquals("Bin A", next.getName());
    assertTrue(next instanceof INewsBin);

    INewsBin binA = (INewsBin) next;

    children = secondSet.getChildren();
    assertEquals(4, children.size());
    IFolder folderB = null;
    IBookMark macOsHints = null;
    INewsBin binC = null;
    ISearchMark searchA = null;
    for (IFolderChild foo : children) {
      if (foo instanceof IFolder && "Folder B".equals(foo.getName()))
        folderB = (IFolder) foo;
      else if (foo instanceof IBookMark && "MacOSXHints.com".equals(foo.getName()))
        macOsHints = (IBookMark) foo;
      else if (foo instanceof INewsBin && "Bin C".equals(foo.getName()))
        binC = (INewsBin) foo;
      else if (foo instanceof ISearchMark && "Search A".equals(foo.getName()))
        searchA = (ISearchMark) foo;
    }

    assertEquals(2, searchA.getSearchConditions().size());
    List<ISearchCondition> conditions = searchA.getSearchConditions();
    for (ISearchCondition condition : conditions) {
      if (condition.getField().getId() == INews.LOCATION) {
        List<IFolderChild> entities = CoreUtils.toEntities((Long[][]) condition.getValue());
        assertEquals(1, entities.size());
        assertTrue(entities.contains(folderA));
      }
    }

    assertNotNull(folderB);
    assertNotNull(macOsHints);
    assertNotNull(binC);
    assertNotNull(searchA);

    children = folderB.getChildren();
    IBookMark golemMark = null;
    IFolder bins2 = null;
    for (IFolderChild foo : children) {
      if (foo instanceof IBookMark && "Golem.de".equals(foo.getName()))
        golemMark = (IBookMark) foo;
      else if (foo instanceof IFolder && "Bins".equals(foo.getName()))
        bins2 = (IFolder) foo;
      else
        fail();
    }

    assertNotNull(golemMark);
    assertNotNull(bins2);

    assertEquals(1, bins2.getChildren().size());
    next = bins2.getChildren().iterator().next();
    assertEquals("Bin B", next.getName());
    assertTrue(next instanceof INewsBin);

    INewsBin binB = (INewsBin) next;

    assertEquals(6, count(Label.class.getName(), elements));
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

    parent.addMark(child, position, after);
  }

  private void fillFolderChildEvents(List<ReparentInfo<IFolderChild, IFolder>> reparentInfos, List<FolderEvent> folderEvents, List<MarkEvent> markEvents) {
    for (ReparentInfo<IFolderChild, IFolder> reparentInfo : reparentInfos) {
      IFolderChild child = reparentInfo.getObject();
      IFolder newParent = reparentInfo.getNewParent();
      IFolder oldParent = child.getParent();
      IFolderChild newPosition = reparentInfo.getNewPosition();
      if (child instanceof IFolder) {
        IFolder folder = (IFolder) child;
        synchronized (folder) {
          removeChildFromFolder(folder);
          addFolder(newParent, folder, newPosition, reparentInfo.isAfter());
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

  /**
   * @throws Exception
   */
  @Test
  public void testGenerateNameForSearch() throws Exception {
    IFolderChild root = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    ISearchField field1 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchField field2 = fFactory.createSearchField(INews.LOCATION, INews.class.getName());
    ISearchField field3 = fFactory.createSearchField(INews.IS_FLAGGED, INews.class.getName());
    ISearchField field4 = fFactory.createSearchField(INews.PUBLISH_DATE, INews.class.getName());
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

  /**
   * @throws Exception
   */
  @Test
  public void testSplitScope() throws Exception {
    IFolderChild root = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

    conditions.add(fFactory.createSearchCondition(fFactory.createSearchField(INews.TITLE, INews.class.getName()), SearchSpecifier.CONTAINS, "foo"));
    conditions.add(fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(root))));
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

  /**
   * @throws Exception
   */
  @Test
  public void testIsLocationConflict() throws Exception {
    IFolderChild root = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

    conditions.add(fFactory.createSearchCondition(fFactory.createSearchField(INews.TITLE, INews.class.getName()), SearchSpecifier.CONTAINS, "foo"));
    conditions.add(fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(root))));
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

  /**
   * @throws Exception
   */
  @Test
  public void testLocationSearch_BINs() throws Exception {
    IFolderChild root = fFactory.createFolder(null, null, "Root");
    DynamicDAO.save(root);

    IFolderChild child = fFactory.createFolder(null, (IFolder) root, "Child");
    DynamicDAO.save(child);

    IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));
    INews news1 = createNews(feed, "Title", "http://www.news.com/news1.html", State.NEW);
    DynamicDAO.save(feed);

    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

Examples of org.rssowl.core.persist.IFolderChild

  @Test
  public void testMaxClauseCountForQuery() throws Exception {
    int maxClauseCount = BooleanQuery.getMaxClauseCount();
    BooleanQuery.setMaxClauseCount(3);

    IFolderChild root = fFactory.createFolder(null, null, "Root");
    IFeed feed1 = DynamicDAO.save(fFactory.createFeed(null, new URI("http://www.feed.com/feed1.xml")));
    IFeed feed2 = DynamicDAO.save(fFactory.createFeed(null, new URI("http://www.feed.com/feed2.xml")));
    IFeed feed3 = DynamicDAO.save(fFactory.createFeed(null, new URI("http://www.feed.com/feed3.xml")));
    IFeed feed4 = DynamicDAO.save(fFactory.createFeed(null, new URI("http://www.feed.com/feed4.xml")));
View Full Code Here

Examples of org.rssowl.core.persist.IFolderChild

    IFolder root = fFactory.createFolder(null, null, "Root");

    IFeed feed = fFactory.createFeed(null, new URI("http://www.foo.com"));
    DynamicDAO.save(feed);

    IFolderChild bookmark = fFactory.createBookMark(null, root, new FeedLinkReference(feed.getLink()), "Bookmark");
    DynamicDAO.save(root);

    ISearchField locationField = fFactory.createSearchField(INews.LOCATION, INews.class.getName());
    ISearchCondition condition = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(bookmark)));
    ISearchMark sm = fFactory.createSearchMark(null, root, "Search");
    sm.addSearchCondition(condition);

    DynamicDAO.save(root);

    Long bmId = bookmark.getId();

    root = null;
    feed = null;
    locationField = null;
    condition = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.