Package org.rssowl.core.persist.reference

Examples of org.rssowl.core.persist.reference.SearchConditionReference


      FolderReference folderRef = new FolderReference(DynamicDAO.save(fFactory.createFolder(null, null, "Folder")).getId());
      ISearchMark searchMark = DynamicDAO.save(fFactory.createSearchMark(null, folderRef.resolve(), "SearchMark"));
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
      ISearchCondition searchCondition = fFactory.createSearchCondition(null, searchMark, field, SearchSpecifier.CONTAINS, "Foo");
      final boolean searchConditionEvents[] = new boolean[3];
      final SearchConditionReference searchConditionReference[] = new SearchConditionReference[1];
      searchConditionListener = new SearchConditionListener() {
        public void entitiesAdded(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            searchConditionEvents[0] = true;
          }
        }

        public void entitiesDeleted(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 entitiesUpdated(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;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
      searchConditionReference[0] = new SearchConditionReference(DynamicDAO.save(searchCondition).getId());
      DynamicDAO.removeEntityListener(ISearchCondition.class, searchConditionListener);
      DynamicDAO.save(searchMark);
      searchMark = null;
      System.gc();
View Full Code Here


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

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

      fFactory.createSearchCondition(null, searchMark2, field1, SearchSpecifier.IS, "Bar");
      searchMark2 = DynamicDAO.save(searchMark2);
      final SearchConditionReference conditionRef2 = new SearchConditionReference(searchMark2.getSearchConditions().get(0).getId());

      fFactory.createSearchCondition(null, searchMark3, field1, SearchSpecifier.IS_NOT, "Foo Bar");
      searchMark3 = DynamicDAO.save(searchMark3);
      final SearchConditionReference conditionRef3 = new SearchConditionReference(searchMark3.getSearchConditions().get(0).getId());

      final boolean searchConditionEventsIssued[] = new boolean[3];

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

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

            else if (conditionRef2.references(searchCondition))
              searchConditionEventsIssued[1] = true;

            else if (conditionRef3.references(searchCondition))
              searchConditionEventsIssued[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
View Full Code Here

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

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

      fFactory.createSearchCondition(null, searchMark2, field1, SearchSpecifier.IS, "Bar");
      searchMark2 = DynamicDAO.save(searchMark2);
      final SearchConditionReference conditionRef2 = new SearchConditionReference(searchMark2.getSearchConditions().get(0).getId());

      fFactory.createSearchCondition(null, searchMark3, field1, SearchSpecifier.IS_NOT, "Foo Bar");
      searchMark3 = DynamicDAO.save(searchMark3);
      final SearchConditionReference conditionRef3 = new SearchConditionReference(searchMark3.getSearchConditions().get(0).getId());

      final boolean searchConditionEventsIssued[] = new boolean[3];

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

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

            else if (conditionRef2.references(searchCondition))
              searchConditionEventsIssued[1] = true;

            else if (conditionRef3.references(searchCondition))
              searchConditionEventsIssued[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
View Full Code Here

  public synchronized String toString() {
    return super.toString() + "Search-Field = " + fField + ", Search-Specifier = " + fSpecifier.name() + ", Search-Value = " + fValue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  }

  public SearchConditionReference toReference() {
    return new SearchConditionReference(getIdAsPrimitive());
  }
View Full Code Here

      FolderReference folderRef = new FolderReference(DynamicDAO.save(fFactory.createFolder(null, null, "Folder")).getId());
      ISearchMark searchMark = DynamicDAO.save(fFactory.createSearchMark(null, folderRef.resolve(), "SearchMark"));
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
      ISearchCondition searchCondition = fFactory.createSearchCondition(null, searchMark, field, SearchSpecifier.CONTAINS, "Foo");
      final boolean searchConditionEvents[] = new boolean[3];
      final SearchConditionReference searchConditionReference[] = new SearchConditionReference[1];
      searchConditionListener = new SearchConditionListener() {
        public void entitiesAdded(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            searchConditionEvents[0] = true;
          }
        }

        public void entitiesDeleted(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 entitiesUpdated(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;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
      searchConditionReference[0] = new SearchConditionReference(DynamicDAO.save(searchCondition).getId());
      DynamicDAO.removeEntityListener(ISearchCondition.class, searchConditionListener);
      DynamicDAO.save(searchMark);
      searchMark = null;
      System.gc();
View Full Code Here

    ISearchMark searchMark0 = DynamicDAO.save(fFactory.createSearchMark(null, folder, "SearchMark 0"));
    ISearchField field0 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition0 = fFactory.createSearchCondition(null, searchMark0, field0, SearchSpecifier.CONTAINS, "Foo");
    DynamicDAO.save(searchCondition0);
    SearchConditionReference searchCondRef0 = new SearchConditionReference(searchCondition0.getId());

    ISearchField field1 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition1 = fFactory.createSearchCondition(null, searchMark0, field1, SearchSpecifier.BEGINS_WITH, "Bar");
    DynamicDAO.save(searchCondition1);

    DynamicDAO.save(searchMark0);
    Long searchMark0Id = searchMark0.getId();

    ISearchMark searchMark1 = DynamicDAO.save(fFactory.createSearchMark(null, folder, "SearchMark 1"));
    ISearchField field2 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition2 = fFactory.createSearchCondition(null, searchMark1, field2, SearchSpecifier.CONTAINS, "Foo");
    DynamicDAO.save(searchCondition2);

    DynamicDAO.save(searchMark1);

    searchMark0 = null;
    searchCondition0 = null;
    System.gc();

    /* Verify */
    searchCondition0 = searchCondRef0.resolve();
    ISearchMarkDAO dao = DynamicDAO.getDAO(ISearchMarkDAO.class);
    searchMark0 = dao.load(searchCondition0);
    assertEquals(searchMark0Id, searchMark0.getId());

    assertEquals(searchMark1, dao.load(searchCondition2));
View Full Code Here

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

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

      fFactory.createSearchCondition(null, searchMark2, field1, SearchSpecifier.IS, "Bar");
      searchMark2 = DynamicDAO.save(searchMark2);
      final SearchConditionReference conditionRef2 = new SearchConditionReference(searchMark2.getSearchConditions().get(0).getId());

      fFactory.createSearchCondition(null, searchMark3, field1, SearchSpecifier.IS_NOT, "Foo Bar");
      searchMark3 = DynamicDAO.save(searchMark3);
      final SearchConditionReference conditionRef3 = new SearchConditionReference(searchMark3.getSearchConditions().get(0).getId());

      final boolean searchConditionEventsIssued[] = new boolean[3];

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

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

            else if (conditionRef2.references(searchCondition))
              searchConditionEventsIssued[1] = true;

            else if (conditionRef3.references(searchCondition))
              searchConditionEventsIssued[2] = true;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
View Full Code Here

  /*
   * @see org.rssowl.core.persist.IEntity#toReference()
   */
  public SearchConditionReference toReference() {
    return new SearchConditionReference(getIdAsPrimitive());
  }
View Full Code Here

      FolderReference folderRef = new FolderReference(DynamicDAO.save(fFactory.createFolder(null, null, "Folder")).getId());
      ISearchMark searchMark = DynamicDAO.save(fFactory.createSearchMark(null, folderRef.resolve(), "SearchMark"));
      ISearchField field = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
      ISearchCondition searchCondition = fFactory.createSearchCondition(null, searchMark, field, SearchSpecifier.CONTAINS, "Foo");
      final boolean searchConditionEvents[] = new boolean[3];
      final SearchConditionReference searchConditionReference[] = new SearchConditionReference[1];
      searchConditionListener = new SearchConditionListener() {
        public void entitiesAdded(Set<SearchConditionEvent> events) {
          for (SearchConditionEvent event : events) {
            assertTrue("Expected this Event to be Root Event", event.isRoot());
            searchConditionEvents[0] = true;
          }
        }

        public void entitiesDeleted(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 entitiesUpdated(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;
          }
        }
      };
      DynamicDAO.addEntityListener(ISearchCondition.class, searchConditionListener);
      searchConditionReference[0] = new SearchConditionReference(DynamicDAO.save(searchCondition).getId());
      DynamicDAO.removeEntityListener(ISearchCondition.class, searchConditionListener);
      DynamicDAO.save(searchMark);
      searchMark = null;
      System.gc();
View Full Code Here

    ISearchMark searchMark0 = DynamicDAO.save(fFactory.createSearchMark(null, folder, "SearchMark 0"));
    ISearchField field0 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition0 = fFactory.createSearchCondition(null, searchMark0, field0, SearchSpecifier.CONTAINS, "Foo");
    DynamicDAO.save(searchCondition0);
    SearchConditionReference searchCondRef0 = new SearchConditionReference(searchCondition0.getId());

    ISearchField field1 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition1 = fFactory.createSearchCondition(null, searchMark0, field1, SearchSpecifier.BEGINS_WITH, "Bar");
    DynamicDAO.save(searchCondition1);

    DynamicDAO.save(searchMark0);
    Long searchMark0Id = searchMark0.getId();

    ISearchMark searchMark1 = DynamicDAO.save(fFactory.createSearchMark(null, folder, "SearchMark 1"));
    ISearchField field2 = fFactory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
    ISearchCondition searchCondition2 = fFactory.createSearchCondition(null, searchMark1, field2, SearchSpecifier.CONTAINS, "Foo");
    DynamicDAO.save(searchCondition2);

    DynamicDAO.save(searchMark1);

    searchMark0 = null;
    searchCondition0 = null;
    System.gc();

    /* Verify */
    searchCondition0 = searchCondRef0.resolve();
    ISearchMarkDAO dao = DynamicDAO.getDAO(ISearchMarkDAO.class);
    searchMark0 = dao.load(searchCondition0);
    assertEquals(searchMark0Id, searchMark0.getId());

    assertEquals(searchMark1, dao.load(searchCondition2));
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.reference.SearchConditionReference

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.