Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ISearch


    copyFeedFilesToTempLocation(corpus1Folder, feedFolder);

    /* Create Filter */
    {
      IModelFactory factory = Owl.getModelFactory();
      ISearch search = factory.createSearch(null);
      search.setMatchAllConditions(false);
      ISearchField field = factory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
      search.addSearchCondition(factory.createSearchCondition(field, SearchSpecifier.CONTAINS_ALL, "foo bar president"));

      field = factory.createSearchField(INews.AUTHOR, INews.class.getName());
      search.addSearchCondition(factory.createSearchCondition(field, SearchSpecifier.IS, "foobar"));

      field = factory.createSearchField(INews.TITLE, INews.class.getName());
      search.addSearchCondition(factory.createSearchCondition(field, SearchSpecifier.IS, "anything"));

      ISearchFilter filter = factory.createSearchFilter(null, search, "Filter 1");
      filter.setEnabled(true);
      filter.setOrder(0);

View Full Code Here


      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(folder));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches Folder (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(folder));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.setMatchAllConditions(true);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM 1 (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 1 Filter Matches BM 1 (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 2 Filter Matches All and BM 1 (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      ISearchFilter filter = fFactory.createSearchFilter(null, null, "Foo");
      filter.setMatchAllNews(true);
      DynamicDAO.save(filter);
      filterSet.add(filter);

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 2 Filter Matches All and BM 1 (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      ISearchFilter filter = fFactory.createSearchFilter(null, null, "Foo");
      filter.setMatchAllNews(true);
      DynamicDAO.save(filter);
      filterSet.add(filter);

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 2 Filter Matches BM 1 and All (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      ISearchFilter filter2 = fFactory.createSearchFilter(null, null, "Foo");
      filter2.setMatchAllNews(true);
      DynamicDAO.save(filter2);
      filterSet.add(filter2);

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
      assertEquals(2, filterSet.size());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
      assertEquals(1, filterSet.size());
      assertTrue(filterSet.contains(filter2));
    }

    /* 2 Filter Matches BM 1 and All (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      ISearchFilter filter2 = fFactory.createSearchFilter(null, null, "Foo");
      filter2.setMatchAllNews(true);
      DynamicDAO.save(filter2);
      filterSet.add(filter2);

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
      assertEquals(2, filterSet.size());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
      assertEquals(1, filterSet.size());
      assertTrue(filterSet.contains(filter2));
    }

    /* 1 Filter Matches BM 1 and Folder (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { bm1, folder }));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM 1 and Folder (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { bm1, folder }));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM 1 and BM 2 (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { bm1, bm2 }));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM 1 and BM 2 (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { bm1, bm2 }));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);
      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches Empty Folder Child (Scope) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 1 Filter Matches Empty Folder Child (Location) */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 1 Filter Matches BM1 OR another condition */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearchCondition condition2 = fFactory.createSearchCondition(fFactory.createSearchField(INews.TITLE, INews.class.getName()), SearchSpecifier.CONTAINS, "Foo");

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.addSearchCondition(condition2);
      search.setMatchAllConditions(false);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM1 AND another condition */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearchCondition condition2 = fFactory.createSearchCondition(fFactory.createSearchField(INews.TITLE, INews.class.getName()), SearchSpecifier.CONTAINS, "Foo");

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.addSearchCondition(condition2);
      search.setMatchAllConditions(true);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 1 Filter Matches BM1 AND another Location */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.SCOPE, scope);
      ISearchCondition condition2 = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.addSearchCondition(condition2);
      search.setMatchAllConditions(true);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(filterSet.isEmpty());
    }

    /* 1 Filter Matches BM1 AND another Location */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);
      ISearchCondition condition2 = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.addSearchCondition(condition2);
      search.setMatchAllConditions(true);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

      DynamicDAO.delete(bm1);

      assertTrue(CoreUtils.toEntities(scope).isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm1).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());

      CoreUtils.removeFiltersByScope(filterSet, ((IBookMark) bm2).getFeedLinkReference().getLinkAsText());
      assertTrue(!filterSet.isEmpty());
    }

    /* 1 Filter Matches BM1 OR another Location */
    {
      Set<ISearchFilter> filterSet = new HashSet<ISearchFilter>();

      Long[][] scope = ModelUtils.toPrimitive(Collections.singletonList(bm1));
      ISearchCondition condition = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);
      ISearchCondition condition2 = fFactory.createSearchCondition(fFactory.createSearchField(INews.LOCATION, INews.class.getName()), SearchSpecifier.IS, scope);

      ISearch search = fFactory.createSearch(null);
      search.addSearchCondition(condition);
      search.addSearchCondition(condition2);
      search.setMatchAllConditions(false);

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Foo");
      DynamicDAO.save(filter);
      filterSet.add(filter);

View Full Code Here

    DynamicDAO.save(root);

    ISearchField locationField = fFactory.createSearchField(INews.LOCATION, INews.class.getName());
    ISearchCondition condition = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(bin1)));
    ISearch search = fFactory.createSearch(null);
    search.addSearchCondition(condition);
    DynamicDAO.save(search);

    /* Filter 1: With Search */
    ISearchFilter filter1 = fFactory.createSearchFilter(null, search, "Filter 1");
    DynamicDAO.save(filter1);
View Full Code Here

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

    /* SM with Scope (Root) */
    ISearchCondition condition1 = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(root)));
    ISearch search1 = fFactory.createSearch(null);
    search1.addSearchCondition(condition1);
    DynamicDAO.save(search1);
    assertTrue(!CoreUtils.isOrphaned(search1));

    /* SM with Scope (Sub Folder) */
    ISearchCondition condition2 = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(subfolder)));
    ISearch search2 = fFactory.createSearch(null);
    search2.addSearchCondition(condition2);
    DynamicDAO.save(search2);
    assertTrue(!CoreUtils.isOrphaned(search2));

    /* SM with Scope (Bookmark) */
    ISearchCondition condition3 = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(bm1)));
    ISearch search3 = fFactory.createSearch(null);
    search3.addSearchCondition(condition3);
    DynamicDAO.save(search3);
    assertTrue(!CoreUtils.isOrphaned(search3));

    /* SM with Scope (Bin) */
    ISearchCondition condition4 = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(bin1)));
    ISearch search4 = fFactory.createSearch(null);
    search4.addSearchCondition(condition4);
    DynamicDAO.save(search4);
    assertTrue(!CoreUtils.isOrphaned(search4));

    /* SM with Scope (Folder, Bookmark, Bin) */
    ISearchCondition condition5 = fFactory.createSearchCondition(locationField, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(subfolder, bm1, bin1)));
    ISearch search5 = fFactory.createSearch(null);
    search5.addSearchCondition(condition5);
    DynamicDAO.save(search5);
    assertTrue(!CoreUtils.isOrphaned(search5));

    /* SM with Location - Match Any - (Folder, Bookmark, Bin) */
    ISearchCondition condition6 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(subfolder, bm1, bin1)));
    ISearch search6 = fFactory.createSearch(null);
    search6.addSearchCondition(condition6);
    search6.setMatchAllConditions(false);
    DynamicDAO.save(search6);
    assertTrue(!CoreUtils.isOrphaned(search6));

    /* SM with Location - Match All - (Folder, Bookmark, Bin) */
    ISearchCondition condition7 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(subfolder, bm1, bin1)));
    ISearch search7 = fFactory.createSearch(null);
    search7.addSearchCondition(condition7);
    search7.setMatchAllConditions(true);
    DynamicDAO.save(search7);
    assertTrue(!CoreUtils.isOrphaned(search7));

    /* SM with Location (Match All) */
    ISearchCondition condition8 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(subfolder, bm1, bin1)));
    ISearch search8 = fFactory.createSearch(null);
    search8.addSearchCondition(condition8);
    search8.addSearchCondition(fFactory.createSearchCondition(allField, SearchSpecifier.CONTAINS, "foo"));
    search8.setMatchAllConditions(true);
    DynamicDAO.save(search8);
    assertTrue(!CoreUtils.isOrphaned(search8));

    /* SM with Location (Match Any) */
    ISearchCondition condition9 = fFactory.createSearchCondition(locationField, SearchSpecifier.IS, ModelUtils.toPrimitive(Arrays.asList(subfolder, bm1, bin1)));
    ISearch search9 = fFactory.createSearch(null);
    search9.addSearchCondition(condition9);
    search9.addSearchCondition(fFactory.createSearchCondition(allField, SearchSpecifier.CONTAINS, "foo"));
    search9.setMatchAllConditions(false);
    DynamicDAO.save(search9);
    assertTrue(!CoreUtils.isOrphaned(search9));

    DynamicDAO.delete(bm1);
    assertTrue(!CoreUtils.isOrphaned(search1));
View Full Code Here

   * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
   */
  public void run(IAction action) {
    Shell shell = OwlUI.getActiveShell();
    if (shell != null && !fSelection.isEmpty()) {
      ISearch presetSearch = Owl.getModelFactory().createSearch(null);
      fillSearchConditions(presetSearch);
      presetSearch.setMatchAllConditions(true);

      /* Preset with Action if Set */
      List<IFilterAction> presetActions = null;
      boolean matchAll = false;
      switch (fPresetAction) {
View Full Code Here

TOP

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

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.