Package org.rssowl.core.model.search

Examples of org.rssowl.core.model.search.ISearchField


  private ISearchMark createSearchMark(IFolder folder) {
    ISearchMark mark = fTypesFactory.createSearchMark(null, folder, "SomeName");
    mark.setCreationDate(new Date());
    mark.setLastVisitDate(createDate());
    mark.setPopularity(50);
    ISearchField field1 = fTypesFactory.createSearchField(INews.STATE, INews.class);
    fTypesFactory.createSearchCondition(null, mark, field1, SearchSpecifier.IS, State.NEW.toString(), false);

    ISearchField field2 = fTypesFactory.createSearchField(INews.STATE, INews.class);
    fTypesFactory.createSearchCondition(null, mark, field2, SearchSpecifier.IS, State.UPDATED.toString(), false);

    ISearchField field3 = fTypesFactory.createSearchField(INews.STATE, INews.class);
    fTypesFactory.createSearchCondition(null, mark, field3, SearchSpecifier.IS, State.UNREAD.toString(), false);

    return mark;
  }
View Full Code Here


   */
  @Test
  public void testRemoveSearchConditionWithoutSearchMark() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    ISearchMark searchMark = fFactory.createSearchMark(null, folder, "Mark");
    ISearchField searchField = fFactory.createSearchField(0, INews.class);
    fFactory.createSearchCondition(null, searchMark, searchField, SearchSpecifier.BEGINS_WITH, "Some value", false);
    IFolder savedFolder = fDao.saveFolder(folder);
    ISearchMark savedMark = (ISearchMark) savedFolder.getMarks().get(0);
    fDao.deleteSearchCondition(new SearchConditionReference(savedMark.getSearchConditions().get(0).getId()));
    assertNotNull(fDao.loadSearchMark(savedMark.getId()));
View Full Code Here

    assertFalse(type1.equals(type2));
    assertTrue(type3.equals(type4));
    assertFalse(type5.equals(type6));

    /* ISearchField */
    ISearchField fieldLabelName1 = fFactory.createSearchField(ILabel.NAME, ILabel.class);
    ISearchField fieldLabelName2 = fFactory.createSearchField(ILabel.NAME, ILabel.class);
    ISearchField fieldLabelAllFields = fFactory.createSearchField(IExtendableType.ALL_FIELDS, ILabel.class);
    ISearchField fieldNewsTitle = fFactory.createSearchField(INews.TITLE, INews.class);

    assertTrue(fieldLabelName1.equals(fieldLabelName2));
    assertFalse(fieldLabelName1.equals(fieldLabelAllFields));
    assertFalse(fieldLabelName1.equals(fieldNewsTitle));

View Full Code Here

    assertFalse(type1.hashCode() == type2.hashCode());
    assertTrue(type3.hashCode() == type4.hashCode());
    assertFalse(type5.hashCode() == type6.hashCode());

    /* ISearchField */
    ISearchField fieldLabelName1 = fFactory.createSearchField(ILabel.NAME, ILabel.class);
    ISearchField fieldLabelName2 = fFactory.createSearchField(ILabel.NAME, ILabel.class);
    ISearchField fieldLabelAllFields = fFactory.createSearchField(IExtendableType.ALL_FIELDS, ILabel.class);
    ISearchField fieldNewsTitle = fFactory.createSearchField(INews.TITLE, INews.class);

    assertTrue(fieldLabelName1.hashCode() == fieldLabelName2.hashCode());
    assertFalse(fieldLabelName1.hashCode() == fieldLabelAllFields.hashCode());
    assertFalse(fieldLabelName1.hashCode() == fieldNewsTitle.hashCode());

    /* ISearchValueType */
    SearchValueType valueTypeString1 = new SearchValueType(ISearchValueType.STRING);
    SearchValueType valueTypeString2 = new SearchValueType(ISearchValueType.STRING);
    SearchValueType valueTypeDate = new SearchValueType(ISearchValueType.DATE);
View Full Code Here

        }
      };
      fModel.addSearchMarkListener(searchMarkListener);

      /* Check SearchCondition Added */
      ISearchField field1 = fFactory.createSearchField(IExtendableType.ALL_FIELDS, INews.class);
      final ISearchCondition condition1 = fFactory.createSearchCondition(null, searchMark1, field1, SearchSpecifier.CONTAINS, "Foo", true);
      final ISearchCondition condition2 = fFactory.createSearchCondition(null, searchMark1, field1, SearchSpecifier.IS, "Bar", true);
      final ISearchCondition condition3 = fFactory.createSearchCondition(null, searchMark2, field1, SearchSpecifier.IS_NOT, "Foo Bar", false);

      final boolean searchConditionEventsIssued[] = new boolean[3];
View Full Code Here

        }
      };
      fModel.addSearchMarkListener(searchMarkListener);

      /* Check SearchCondition Deleted */
      ISearchField field1 = fFactory.createSearchField(IExtendableType.ALL_FIELDS, INews.class);

      fFactory.createSearchCondition(null, searchMark1, field1, SearchSpecifier.CONTAINS, "Foo", true);
      searchMark1 = fDao.saveSearchMark(searchMark1);
      final SearchConditionReference conditionRef1 = new SearchConditionReference(searchMark1.getSearchConditions().get(0).getId());

View Full Code Here

    SearchConditionListener searchConditionListener = null;
    try {
      /* Add */
      FolderReference folderRef = new FolderReference(fDao.saveFolder(fFactory.createFolder(null, null, "Folder")).getId());
      SearchMarkReference searchMarkRef = new SearchMarkReference(fDao.saveSearchMark(fFactory.createSearchMark(null, folderRef.resolve(), "SearchMark")).getId());
      ISearchField field = fFactory.createSearchField(IExtendableType.ALL_FIELDS, INews.class);
      ISearchCondition searchCondition = fFactory.createSearchCondition(null, searchMarkRef.resolve(), field, SearchSpecifier.CONTAINS, "Foo", true);
      final boolean searchConditionEvents[] = new boolean[3];
      final SearchConditionReference searchConditionReference[] = new SearchConditionReference[1];
      searchConditionListener = new SearchConditionListener() {
        public void searchConditionAdded(Set<SearchConditionEvent> events) {
View Full Code Here

    /* Merge SearchMarks */
    {
      IFolder folder = fDao.saveFolder(fFactory.createFolder(null, null, "Root"));

      ISearchMark searchmark = NewsModel.getDefault().getTypesFactory().createSearchMark(10L, folder, "SearchMark");
      ISearchField field = fFactory.createSearchField(INews.STATE, INews.class);
      fFactory.createSearchCondition(11L, searchmark, field, SearchSpecifier.IS, State.HIDDEN.toString(), false);

      /* Create Searchmarks to merge with existing */
      ISearchMark searchmark1 = NewsModel.getDefault().getTypesFactory().createSearchMark(10L, folder, "SearchMark *updated*");
      field = fFactory.createSearchField(INews.STATE, INews.class);
View Full Code Here

      fDao.saveFeed(feed);

      // TODO Replace this by a event-based solution if that becomes available
      Thread.sleep(500);

      ISearchField field1 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond1 = fTypesFactory.createSearchCondition(field1, SearchSpecifier.IS, State.NEW.toString(), false);

      ISearchField field2 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond2 = fTypesFactory.createSearchCondition(field2, SearchSpecifier.IS, State.UPDATED.toString(), false);

      ISearchField field3 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond3 = fTypesFactory.createSearchCondition(field3, SearchSpecifier.IS, State.UNREAD.toString(), false);
      List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

      conditions.add(cond1);
      conditions.add(cond2);
View Full Code Here

      // TODO Replace this by a event-based solution if that becomes available
      Thread.sleep(500);

      /* SearchCondition: News in state READ */
      ISearchField field1 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond2 = fTypesFactory.createSearchCondition(field1, SearchSpecifier.CONTAINS, State.READ.toString(), false);
      conditions.add(cond2);

      List<ISearchHit<NewsReference>> results = fModelSearch.searchNews(conditions);
      assertEquals(1, results.size());
View Full Code Here

TOP

Related Classes of org.rssowl.core.model.search.ISearchField

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.