Package org.rssowl.core.model.search

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


      };
      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];

      searchConditionListener = new SearchConditionAdapter() {
        @Override
        public void searchConditionAdded(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());

            ISearchCondition searchCondition = event.getEntity();

            if (searchCondition.getValue().equals(condition1.getValue()))
              searchConditionEventsIssued[0] = true;

            else if (searchCondition.getValue().equals(condition2.getValue()))
              searchConditionEventsIssued[1] = true;

            else if (searchCondition.getValue().equals(condition3.getValue()))
              searchConditionEventsIssued[2] = true;

          }
        }
      };
View Full Code Here


      searchConditionListener = new SearchConditionAdapter() {
        @Override
        public void searchConditionDeleted(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            ISearchCondition searchCondition = event.getEntity();

            if (conditionRef1.references(searchCondition))
              searchConditionEventsIssued[0] = true;

            else if (conditionRef2.references(searchCondition))
View Full Code Here

    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) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            searchConditionEvents[0] = true;
          }
        }

        public void searchConditionDeleted(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (searchConditionReference[0].references(event.getEntity()))
              searchConditionEvents[1] = true;
          }
        }

        public void searchConditionUpdated(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            if (searchConditionReference[0].references(event.getEntity()))
              searchConditionEvents[2] = true;
          }
        }
      };
      fModel.addSearchConditionListener(searchConditionListener);
      searchConditionReference[0] = new SearchConditionReference(fDao.saveSearchCondition(searchCondition).getId());

      /* Update */
      searchCondition = searchConditionReference[0].resolve();
      searchCondition.setValue("Bar");
      searchCondition.setSpecifier(SearchSpecifier.CONTAINS_NOT);
      fDao.saveSearchCondition(searchCondition);

      /* Delete */
      fDao.deleteSearchCondition(searchConditionReference[0]);

View Full Code Here

      // 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);
      conditions.add(cond3);
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());
      assertEquals(news1.getLink(), results.get(0).getResult().resolve().getLink());
View Full Code Here

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

      /* 1. SearchCondition: Title contains "News" */
      ISearchField field1 = fTypesFactory.createSearchField(INews.TITLE, INews.class);
      ISearchCondition cond1 = fTypesFactory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "News", false);
      conditions.add(cond1);

      /* 2. SearchCondition: News is not marked read */
      ISearchField field2 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond2 = fTypesFactory.createSearchCondition(field2, SearchSpecifier.IS_NOT, State.READ.name(), false);
      conditions.add(cond2);

      List<ISearchHit<NewsReference>> results = fModelSearch.searchNews(conditions);
      assertEquals(3, results.size());

View Full Code Here

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

      /* 1. SearchCondition: News coming from Feed that contains "feed2.xml" */
      ISearchField field1 = fTypesFactory.createSearchField(IFeed.LINK, IFeed.class);
      ISearchCondition cond1 = fTypesFactory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "feed2.xml", true);
      conditions.add(cond1);

      /* 2. SearchCondition: News Description does not contain "Foo" */
      ISearchField field2 = fTypesFactory.createSearchField(INews.DESCRIPTION, INews.class);
      ISearchCondition cond2 = fTypesFactory.createSearchCondition(field2, SearchSpecifier.CONTAINS_NOT, "Foo", true);
      conditions.add(cond2);

      /* 3. SearchCondition: News State is NEW */
      ISearchField field3 = fTypesFactory.createSearchField(INews.STATE, INews.class);
      ISearchCondition cond3 = fTypesFactory.createSearchCondition(field3, SearchSpecifier.IS, State.NEW.name(), true);
      conditions.add(cond3);

      List<ISearchHit<NewsReference>> results = fModelSearch.searchNews(conditions);
      assertEquals(2, results.size());

View Full Code Here

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

      /* 1. SearchCondition: News has Attachment with Type "audio/mp3" */
      ISearchField field1 = fTypesFactory.createSearchField(IAttachment.TYPE, IAttachment.class);
      ISearchCondition cond1 = fTypesFactory.createSearchCondition(field1, SearchSpecifier.IS, "audio/mp3", false);
      conditions.add(cond1);

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

View Full Code Here

    else if (entity instanceof ILabel) {
      ILabel label = (ILabel) entity;
      modelEvent = new LabelEvent(label, root);
    }
    else if (entity instanceof ISearchCondition) {
      ISearchCondition searchCond = (ISearchCondition) entity;
      modelEvent = new SearchConditionEvent(searchCond, root);
    }
    return modelEvent;
  }
View Full Code Here

    PersonEvent event = new PersonEvent(person, true);
    deleteEntityAndFireEvents(event);
  }

  public void deleteSearchCondition(SearchConditionReference reference) throws PersistenceException {
    ISearchCondition searchCond = loadSearchCondition(reference.getId());
    SearchConditionEvent event = new SearchConditionEvent(searchCond, true);
    deleteEntityAndFireEvents(event);
  }
View Full Code Here

TOP

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

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.