Tabnine Logo
SelectorImpl
Code IndexAdd Tabnine to your IDE (free)

How to use
SelectorImpl
in
org.apache.jackrabbit.oak.query.ast

Best Java code snippets using org.apache.jackrabbit.oak.query.ast.SelectorImpl (Showing top 20 results out of 315)

origin: org.apache.jackrabbit/oak-core

  @Override
  public SourceImpl copyOf() {
    return new SelectorImpl(nodeTypeInfo, selectorName);
  }
}
origin: apache/jackrabbit-oak

@Override
public ExecutionPlan prepare() {
  if (plan != null) {
    return plan;
  }
  pushDown();
  plan = query.getBestSelectorExecutionPlan(createFilter(true));
  return plan;
}

origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * The value for the given selector for the current node.
 * 
 * @param propertyName the JCR (not normalized) property name
 * @return the property value
 */
public PropertyValue currentProperty(String propertyName) {
  String pn = normalizePropertyName(propertyName);
  return currentOakProperty(pn);
}
origin: apache/jackrabbit-oak

/**
 * Get the tree at the current path.
 * 
 * @return the current tree, or null
 */
public Tree currentTree() {
  String path = currentPath();
  if (path == null) {
    return null;
  }
  return getTree(path);
}

origin: apache/jackrabbit-oak

@Override
public void restrictPushDown(SelectorImpl s) {
  if (s.equals(selector)) {
    s.restrictSelector(this);
  }
}

origin: apache/jackrabbit-oak

@Override
public String getIndexCostInfo(NodeState rootState) {
  StringBuilder buff = new StringBuilder();
  buff.append(quoteJson(selectorName)).append(": ");
  QueryIndex index = getIndex();
  if (index != null) {
    if (index instanceof AdvancedQueryIndex) {
      IndexPlan p = plan.getIndexPlan();
      buff.append("{ perEntry: ").append(p.getCostPerEntry());
      buff.append(", perExecution: ").append(p.getCostPerExecution());
      buff.append(", count: ").append(p.getEstimatedEntryCount());
      buff.append(" }");
    } else {
      buff.append(index.getCost(createFilter(true), rootState));
    }
  }
  return buff.toString();
}
origin: apache/jackrabbit-oak

@Override
public String getPlan(NodeState rootState) {
  StringBuilder buff = new StringBuilder();
  buff.append(toString());
  buff.append(" /* ");
  QueryIndex index = getIndex();
  if (index != null) {
    if (index instanceof AdvancedQueryIndex) {
      AdvancedQueryIndex adv = (AdvancedQueryIndex) index;
      IndexPlan p = plan.getIndexPlan();
      buff.append(adv.getPlanDescription(p, rootState));
    } else {
      buff.append(index.getPlan(createFilter(true), rootState));
    }
  } else {
    buff.append("no-index");
  }
  if (!selectorConstraints.isEmpty()) {
    buff.append(" where ").append(new AndImpl(selectorConstraints).toString());
  }
  buff.append(" */");
  return buff.toString();
}
origin: org.apache.jackrabbit/oak-core

private PropertyValue currentOakProperty(String oakPropertyName, Integer propertyType) {
  boolean asterisk = oakPropertyName.indexOf('*') >= 0;
  if (asterisk) {
    Tree t = currentTree();
    if (t != null) {
      LOG.trace("currentOakProperty() - '*' case. looking for '{}' in '{}'",
    readOakProperties(list, t, oakPropertyName, propertyType);
    if (list.size() == 0) {
      return null;
      && !oakPropertyName.startsWith(QueryConstants.REP_EXCERPT + "(")
      && oakPropertyName.indexOf('/') >= 0;
  Tree t = currentTree();
  if (relative) {
    for (String p : PathUtils.elements(PathUtils.getParentPath(oakPropertyName))) {
  return currentOakProperty(t, oakPropertyName, propertyType);
origin: apache/jackrabbit-oak

@Override
public boolean evaluate() {
  // disable evaluation if a fulltext index is used,
  // and because we don't know how to process native
  // conditions
  if (!(selector.getIndex() instanceof FulltextQueryIndex)) {
    log.warn("No full-text index was found that can process the condition " + toString());
    return false;
  }
  // verify the path is readable
  PropertyValue p = pathExpression.currentValue();
  String path = p.getValue(Type.STRING);
  if (selector.getTree(path) == null) {
    return false;
  }
  if (propertyName != null) {
    if (selector.currentProperty(propertyName) == null) {
      // property not found
      return false;
    }
  }
  
  // we assume the index only returns the requested entries
  return true;
}
origin: apache/jackrabbit-oak

@Override
public boolean evaluate() {
  String a = ancestorSelector.currentPath();
  String d = descendantSelector.currentPath();
  return PathUtils.isAncestor(a, d);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public PropertyValue currentProperty() {
  PropertyValue p;
  if (propertyType == PropertyType.UNDEFINED) {
    p = selector.currentProperty(propertyName);
  } else {
    p = selector.currentProperty(propertyName, propertyType);
  }
  return p;        
}
origin: apache/jackrabbit-oak

boolean isRelative = propertyName.indexOf('/') >= 0;
if (!isRelative) {
  return selector.currentProperty(propertyName) == null;
Tree t = selector.currentTree();
if (t == null) {
  return true;
origin: apache/jackrabbit-oak

  Tree tree = getTree(currentRow.getPath());
  if (tree == null || !tree.exists()) {
    continue;
if (evaluateCurrentRow()) {
  return true;
origin: apache/jackrabbit-oak

/**
 * Get the property value. The property name may be relative. The special
 * property names "jcr:path", "jcr:score" and "rep:excerpt" are supported.
 * 
 * @param oakPropertyName (must already be normalized)
 * @return the property value or null if not found
 */
public PropertyValue currentOakProperty(String oakPropertyName) {
  return currentOakProperty(oakPropertyName, null);
}
origin: apache/jackrabbit-oak

@Override
public String getFunction(SelectorImpl s) {
  if (!s.equals(selector)) {
    return null;
  }
  return "@" + QueryConstants.RESTRICTION_NAME;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void execute(NodeState rootState) {
  QueryIndex index = plan.getIndex();
  if (index == null) {
    cursor = Cursors.newPathCursor(new ArrayList<String>(), query.getSettings());
    return;
  }
  IndexPlan p = plan.getIndexPlan();
  if (p != null) {
    p.setFilter(createFilter(false));
    AdvancedQueryIndex adv = (AdvancedQueryIndex) index;
    cursor = adv.query(p, rootState);
  } else {
    cursor = index.query(createFilter(false), rootState);
  }
}
origin: org.apache.jackrabbit/oak-core

private boolean evaluateCurrentRow() {
  if (currentRow.isVirtualRow()) {
    //null path implies that all checks are already done -- we just need to pass it through
    return true;
  }
  if (!matchesAllTypes && !evaluateTypeMatch()) {
    return false;
  }
  for (ConstraintImpl constraint : selectorConstraints) {
    if (!constraint.evaluate()) {
      if (constraint.evaluateStop()) {
        // stop processing from now on
        cursor = null;
      }
      return false;
    }
  }
  if (joinCondition != null && !joinCondition.evaluate()) {
    return false;
  }
  return true;
}
origin: apache/jackrabbit-oak

ResultRowImpl currentRow() {
  int selectorCount = selectors.size();
  Tree[] trees = new Tree[selectorCount];
  for (int i = 0; i < selectorCount; i++) {
    SelectorImpl s = selectors.get(i);
    trees[i] = s.currentTree();
  }
  int columnCount = columns.length;
  PropertyValue[] values = new PropertyValue[columnCount];
  for (int i = 0; i < columnCount; i++) {
    ColumnImpl c = columns[i];
    values[i] = c.currentProperty();
  }
  PropertyValue[] orderValues;
  if (orderings == null) {
    orderValues = null;
  } else {
    int size = orderings.length;
    orderValues = new PropertyValue[size];
    for (int i = 0; i < size; i++) {
      orderValues[i] = orderings[i].getOperand().currentProperty();
    }
  }
  return new ResultRowImpl(this, trees, values, distinctColumns, orderValues);
}
origin: org.apache.jackrabbit/oak-core

IndexPlan plan = selectors.get(0).getExecutionPlan().getIndexPlan();
if (plan != null) {
  List<OrderEntry> list = plan.getSortOrder();
origin: apache/jackrabbit-oak

@Override
public void restrictPushDown(SelectorImpl s) {
  if (s.equals(selector)) {
    selector.restrictSelector(this);
  }
}
org.apache.jackrabbit.oak.query.astSelectorImpl

Javadoc

A selector within a query.

Most used methods

  • <init>
  • createFilter
    Create the filter condition for planning or execution.
  • currentOakProperty
  • currentPath
    Get the current absolute Oak path (normalized).
  • currentProperty
    The value for the given selector for the current node, filtered by property type.
  • currentTree
    Get the tree at the current path.
  • equals
  • evaluateCurrentRow
  • evaluateTypeMatch
  • getExecutionPlan
  • getIndex
  • getLocalPath
  • getIndex,
  • getLocalPath,
  • getMixinTypes,
  • getNodeType,
  • getPrimaryTypes,
  • getQuery,
  • getScanCount,
  • getSelectorName,
  • getSupertypes,
  • getTree

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JFileChooser (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now