Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ISearch


    DynamicDAO.save(bin1);
    DynamicDAO.save(bin2);

    /* Filter "Title is Title": Mark Read, Sticky, Label, Copy */
    {
      ISearch search = createTitleSearch("Title");

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Title is Title");
      filter.setEnabled(true);
      filter.setOrder(0);

      filter.addAction(fFactory.createFilterAction(MARK_READ_ID));
      filter.addAction(fFactory.createFilterAction(MARK_STICKY_ID));

      IFilterAction labelAction = fFactory.createFilterAction(LABEL_NEWS_ID);
      labelAction.setData(label.getId());
      filter.addAction(labelAction);

      IFilterAction copyAction = fFactory.createFilterAction(COPY_NEWS_ID);
      copyAction.setData(new Long[] { bin1.getId(), bin2.getId() });
      filter.addAction(copyAction);

      DynamicDAO.save(filter);
    }

    /* Filter "Title is Other": Move */
    {
      ISearch search = createTitleSearch("Other");

      ISearchFilter filter = fFactory.createSearchFilter(null, search, "Title is Other");
      filter.setEnabled(true);
      filter.setOrder(1);

View Full Code Here


    news2.setState(INews.State.NEW);

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

    ISearch search = createScopeSearch(bm1);

    ISearchFilter filter = fFactory.createSearchFilter(null, search, "All News in BM1");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);
View Full Code Here

    news2.setState(INews.State.NEW);

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

    ISearch search = createScopeSearch(bm2);

    ISearchFilter filter = fFactory.createSearchFilter(null, search, "All News in BM2");
    filter.setMatchAllNews(true);
    filter.setEnabled(true);
View Full Code Here

    List<INews> binNews = bin.getNews();
    assertEquals(0, binNews.size());
  }

  private ISearch createStickySearch(boolean sticky) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.IS_FLAGGED, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.IS, sticky);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

    return search;
  }

  private ISearch createScopeSearch(IFolderChild scope) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.LOCATION, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.SCOPE, ModelUtils.toPrimitive(Arrays.asList(new IFolderChild[] { scope })));
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

    return search;
  }

  private ISearch createTitleSearch(String title) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.TITLE, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.IS, title);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

    return search;
  }

  private ISearch createDescriptionSearch(String description) {
    ISearch search = fFactory.createSearch(null);
    ISearchField field = fFactory.createSearchField(INews.DESCRIPTION, INews.class.getName());

    ISearchCondition condition = fFactory.createSearchCondition(field, SearchSpecifier.CONTAINS, description);
    search.addSearchCondition(condition);

    return search;
  }
View Full Code Here

  private static List<ISearch> getLocationConditionSearchesFromFilters(List<ISearchFilter> filters) {
    List<ISearch> locationConditionSearches = new ArrayList<ISearch>();

    for (ISearchFilter filter : filters) {
      ISearch search = filter.getSearch();
      if (search != null && containsLocationCondition(search))
        locationConditionSearches.add(search);
    }

    return locationConditionSearches;
View Full Code Here

    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

    int order = Integer.parseInt(filterElement.getAttributeValue(Attributes.ORDER.get()));
    boolean isEnabled = Boolean.parseBoolean(filterElement.getAttributeValue(Attributes.ENABLED.get()));
    boolean matchAllNews = Boolean.parseBoolean(filterElement.getAttributeValue(Attributes.MATCH_ALL_NEWS.get()));

    /* Search if provided */
    ISearch search = null;
    Element searchElement = filterElement.getChild(Tag.SEARCH.get(), RSSOWL_NS);
    if (searchElement != null) {
      search = factory.createSearch(null);
      search.setMatchAllConditions(Boolean.parseBoolean(searchElement.getAttributeValue(Attributes.MATCH_ALL_CONDITIONS.get())));

      /* Search Conditions */
      List<?> conditions = searchElement.getChildren(Tag.SEARCH_CONDITION.get(), RSSOWL_NS);
      for (int i = 0; i < conditions.size(); i++) {
        try {
          Element condition = (Element) conditions.get(i);

          ISearchCondition searchCondition = processSearchCondition(condition, dateFormat);
          if (searchCondition != null)
            search.addSearchCondition(searchCondition);
        } catch (NumberFormatException e) {
          Activator.getDefault().logError(e.getMessage(), e);
        } catch (ParseException e) {
          Activator.getDefault().logError(e.getMessage(), e);
        }
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.