/**
   * validate er stream with query filters. (skip er's which over filter amount)
   *
   * @return
   */
  private boolean checkQueryFilters() {
    boolean hasNext = iter.hasNext();

    if (!hasNext) // nothing found in current iterator
    {
      // check if parent stream has more elements
      if (inputStream.hasNext()) {
        // recreate current iterator with new data from parent stream
        updateIterator();
        // recursive check
        return checkQueryFilters();

      } else {
        // end of parent iterator
        next = null;
        return hasNext; // return false;
      }
    }

    boolean goThroughIterator = false;
    do {
      goThroughIterator = false;
      next = iter.next();

      Connected er = next;
      for (Filter f : filterMap.keySet()) {
        if (f.propertyValue.equals(er.getProperty(f.propertyName))) {
          // er match this filter
          int matchCount = filterMap.get(f);
          matchCount++;
          filterMap.put(f, matchCount);

          if (matchCount > f.filterAmount) {
            // skip current doc
            next = null;

            if (iter.hasNext()) goThroughIterator = true;
            else
              hasNext = checkQueryFilters(); // do recursive check - may need updateIterator() call

            break;
          }
        }
      }
    } while (goThroughIterator);
    return hasNext;
  }
  private boolean isMatch(Connected er, String key, Set<String> values) {
    String erValue = er.getProperty(key);
    if (null != erValue) for (String value : values) if (value.equals(erValue)) return true;

    return false;
  }
Ejemplo n.º 3
0
 private String getNodeType(Connected e) {
   return e.getProperty("N4J_CONSOLE_NODE_TYPE");
 }