Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolderChild


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

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

    DynamicDAO.save(root);

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

    DynamicDAO.save(root);

    Long binId = bin.getId();

    root = null;
    locationField = null;
    condition = null;
    sm = null;
View Full Code Here


    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");
    IFolderChild bin = fFactory.createNewsBin(null, root, "Bin");

    DynamicDAO.save(root);

    ISearchField locationField = fFactory.createSearchField(INews.LOCATION, INews.class.getName());
    ISearchCondition condition1 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(bookmark)));
    ISearchCondition condition2 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(bin)));

    ISearchMark sm = fFactory.createSearchMark(null, root, "Search");
    sm.addSearchCondition(condition1);
    sm.addSearchCondition(condition2);

    DynamicDAO.save(root);

    Long bmId = bookmark.getId();
    Long binId = bin.getId();

    root = null;
    locationField = null;
    condition1 = null;
    condition2 = null;
View Full Code Here

    DynamicDAO.save(feed1);

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

    IFolderChild bookmark1 = fFactory.createBookMark(null, root, new FeedLinkReference(feed1.getLink()), "Bookmark1");
    IFolderChild bookmark2 = fFactory.createBookMark(null, root, new FeedLinkReference(feed2.getLink()), "Bookmark2");

    DynamicDAO.save(root);

    ISearchField locationField = fFactory.createSearchField(INews.LOCATION, INews.class.getName());

    List<IFolderChild> childs = new ArrayList<IFolderChild>(2);
    childs.add(bookmark1);
    childs.add(bookmark2);

    ISearchCondition condition = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(childs));

    ISearchMark sm = fFactory.createSearchMark(null, root, "Search");
    sm.addSearchCondition(condition);

    DynamicDAO.save(root);

    Long bmId1 = bookmark1.getId();
    Long bmId2 = bookmark2.getId();

    root = null;
    locationField = null;
    condition = null;
    sm = null;
View Full Code Here

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

    IFolderChild subRoot = fFactory.createFolder(null, root, "Sub Root");

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

    DynamicDAO.save(root);

    ISearchField locationField = fFactory.createSearchField(INews.LOCATION, INews.class.getName());
    ISearchCondition condition1 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(subRoot)));
    ISearchCondition condition2 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Collections.singletonList(bin)));

    ISearchMark sm = fFactory.createSearchMark(null, root, "Search");
    sm.addSearchCondition(condition1);
    sm.addSearchCondition(condition2);

    DynamicDAO.save(root);

    Long folderId = subRoot.getId();
    Long binId = bin.getId();

    root = null;
    locationField = null;
    condition1 = null;
    condition2 = null;
View Full Code Here

  /* Remove existing Bookmarks and Empty Folders */
  private List<IFolderChild> excludeExisting(List<IFolderChild> folderChilds) {
    IBookMarkDAO dao = DynamicDAO.getDAO(IBookMarkDAO.class);

    for (Iterator<IFolderChild> iterator = folderChilds.iterator(); iterator.hasNext();) {
      IFolderChild child = iterator.next();

      /* Bookmark (exclude if another Bookmark with same Link exists) */
      if (child instanceof IBookMark) {
        IBookMark bm = (IBookMark) child;
        if (dao.exists(bm.getFeedLinkReference()))
          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) */
      else if (child instanceof ISearchMark) {
        ISearchMark search = (ISearchMark) child;
        if (CoreUtils.existsSearchMark(search))
          iterator.remove();
      }

      /* Folder */
      else if (child instanceof IFolder) {
        excludeExisting((IFolder) child);
      }
    }

    /* Exclude Empty Folders */
    for (Iterator<IFolderChild> iterator = folderChilds.iterator(); iterator.hasNext();) {
      IFolderChild child = iterator.next();
      if (child instanceof IFolder && ((IFolder) child).getChildren().isEmpty())
        iterator.remove();
    }

    return folderChilds;
View Full Code Here

    for (IEntity entity : entities) {
      if (!(entity instanceof IFolderChild))
        return null;

      IFolderChild folderChild = (IFolderChild) entity;
      IFolder folder = folderChild.getParent();
      if (parent == null)
        parent = folder;
      else if (parent != folder)
        return null;
    }
View Full Code Here

    for (IEntity entity : entities) {
      if (!(entity instanceof IFolderChild))
        return null;

      IFolderChild folderChild = (IFolderChild) entity;
      IFolder folder = folderChild.getParent();
      if (parent == null)
        parent = folder;
      else if (parent != folder)
        return null;
    }
View Full Code Here

    IFolder sameParent = getSameParent(fEntities);
    if (sameParent != null && sameParent != fFolderChooser.getFolder()) {
      List<ReparentInfo<IFolderChild, IFolder>> reparenting = new ArrayList<ReparentInfo<IFolderChild, IFolder>>();
      for (IEntity entity : fEntities) {
        if (entity instanceof IFolderChild) {
          IFolderChild folderChild = (IFolderChild) entity;
          reparenting.add(ReparentInfo.create(folderChild, fFolderChooser.getFolder(), null, null));
        }
      }

      /* Perform Reparenting */
 
View Full Code Here

    if (editorInput instanceof FeedViewInput) {
      FeedViewInput feedViewInput = (FeedViewInput) editorInput;
      IMark mark = feedViewInput.getMark();

      /* Change Set if required */
      IFolderChild child = mark;
      while (child.getParent() != null)
        child = child.getParent();

      if (!fSelectedBookMarkSet.equals(child))
        changeSet((IFolder) child);

      /* Set Selection */
 
View Full Code Here

    fConditionLabel = new Link(this, SWT.NONE);
    fConditionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fConditionLabel.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        IFolderChild selectedChild = null;
        if (e.text != null && e.text.length() > 0)
          selectedChild = fSelection.get(Integer.valueOf(e.text));

        onChangeCondition(selectedChild);
      }
View Full Code Here

TOP

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

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.