public Object visit(ASTOrExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; OrQueryNode orQuery = factory.createOrQueryNode(parent); // pass to operands node.childrenAccept(this, orQuery); if (orQuery.getNumOperands() > 0) { parent.addOperand(orQuery); } return parent; }
public Object visit(ASTNotExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; NotQueryNode notQuery = factory.createNotQueryNode(parent); // pass to operand node.childrenAccept(this, notQuery); if (notQuery.getNumOperands() > 0) { parent.addOperand(notQuery); } return parent; }
public Object visit(ASTAndExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; AndQueryNode andQuery = factory.createAndQueryNode(parent); // pass to operands node.childrenAccept(this, andQuery); if (andQuery.getNumOperands() > 0) { parent.addOperand(andQuery); } return parent; }
public Object visit(ASTOrExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; OrQueryNode orQuery = factory.createOrQueryNode(parent); // pass to operands node.childrenAccept(this, orQuery); if (orQuery.getNumOperands() > 0) { parent.addOperand(orQuery); } return parent; }
public Object visit(ASTAndExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; AndQueryNode andQuery = factory.createAndQueryNode(parent); // pass to operands node.childrenAccept(this, andQuery); if (andQuery.getNumOperands() > 0) { parent.addOperand(andQuery); } return parent; }
public Object visit(ASTNotExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; NotQueryNode notQuery = factory.createNotQueryNode(parent); // pass to operand node.childrenAccept(this, notQuery); if (notQuery.getNumOperands() > 0) { parent.addOperand(notQuery); } return parent; }
queryNode.addOperand(rqn);
queryNode.addOperand(rqn);
public Object visit(ASTContainsExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; try { Path relPath = null; if (node.getPropertyName() != null) { PathBuilder builder = new PathBuilder(); builder.addLast(node.getPropertyName()); relPath = builder.getPath(); } TextsearchQueryNode tsNode = factory.createTextsearchQueryNode(parent, node.getQuery()); tsNode.setRelativePath(relPath); tsNode.setReferencesProperty(true); parent.addOperand(tsNode); } catch (MalformedPathException e) { // path is always valid } return parent; }
public Object visit(ASTContainsExpression node, Object data) { NAryQueryNode parent = (NAryQueryNode) data; try { Path relPath = null; if (node.getPropertyName() != null) { PathBuilder builder = new PathBuilder(); builder.addLast(node.getPropertyName()); relPath = builder.getPath(); } TextsearchQueryNode tsNode = factory.createTextsearchQueryNode(parent, node.getQuery()); tsNode.setRelativePath(relPath); tsNode.setReferencesProperty(true); parent.addOperand(tsNode); } catch (MalformedPathException e) { // path is always valid } return parent; }
/** * Creates a <code>LocationStepQueryNode</code> at the current position * in parent. * * @param node the current node in the xpath syntax tree. * @param parent the parent <code>PathQueryNode</code>. * @return the created <code>LocationStepQueryNode</code>. */ private LocationStepQueryNode createLocationStep(SimpleNode node, NAryQueryNode parent) { LocationStepQueryNode queryNode = null; boolean descendant = false; Node p = node.jjtGetParent(); for (int i = 0; i < p.jjtGetNumChildren(); i++) { SimpleNode c = (SimpleNode) p.jjtGetChild(i); if (c == node) { queryNode = factory.createLocationStepQueryNode(parent); queryNode.setNameTest(null); queryNode.setIncludeDescendants(descendant); parent.addOperand(queryNode); break; } descendant = (c.getId() == JJTSLASHSLASH || c.getId() == JJTROOTDESCENDANTS); } node.childrenAccept(this, queryNode); return queryNode; }
/** * Creates a <code>LocationStepQueryNode</code> at the current position * in parent. * * @param node the current node in the xpath syntax tree. * @param parent the parent <code>PathQueryNode</code>. * @return the created <code>LocationStepQueryNode</code>. */ private LocationStepQueryNode createLocationStep(SimpleNode node, NAryQueryNode parent) { LocationStepQueryNode queryNode = null; boolean descendant = false; Node p = node.jjtGetParent(); for (int i = 0; i < p.jjtGetNumChildren(); i++) { SimpleNode c = (SimpleNode) p.jjtGetChild(i); if (c == node) { queryNode = factory.createLocationStepQueryNode(parent); queryNode.setNameTest(null); queryNode.setIncludeDescendants(descendant); parent.addOperand(queryNode); break; } descendant = (c.getId() == JJTSLASHSLASH || c.getId() == JJTROOTDESCENDANTS); } node.childrenAccept(this, queryNode); return queryNode; }
if (queryNode instanceof NAryQueryNode) { QueryNode not = factory.createNotQueryNode(queryNode); ((NAryQueryNode) queryNode).addOperand(not); ((NAryQueryNode) queryNode).addOperand(contains); } else { exceptions.add(new InvalidQueryException("Wrong argument type for jcr:contains")); RelationQueryNode like = factory.createRelationQueryNode( queryNode, RelationQueryNode.OPERATION_LIKE); ((NAryQueryNode) queryNode).addOperand(like); RelationQueryNode rel = factory.createRelationQueryNode( parent, RelationQueryNode.OPERATION_SIMILAR); parent.addOperand(rel); RelationQueryNode rel = factory.createRelationQueryNode( parent, RelationQueryNode.OPERATION_SPELLCHECK); parent.addOperand(rel);
if (queryNode instanceof NAryQueryNode) { QueryNode not = factory.createNotQueryNode(queryNode); ((NAryQueryNode) queryNode).addOperand(not); ((NAryQueryNode) queryNode).addOperand(contains); } else { exceptions.add(new InvalidQueryException("Wrong argument type for jcr:contains")); RelationQueryNode like = factory.createRelationQueryNode( queryNode, RelationQueryNode.OPERATION_LIKE); ((NAryQueryNode) queryNode).addOperand(like); RelationQueryNode rel = factory.createRelationQueryNode( parent, RelationQueryNode.OPERATION_SIMILAR); parent.addOperand(rel); RelationQueryNode rel = factory.createRelationQueryNode( parent, RelationQueryNode.OPERATION_SPELLCHECK); parent.addOperand(rel);
parent.addOperand(predicateNode);
parent.addOperand(predicateNode);
NAryQueryNode parent = (NAryQueryNode) notNode.getParent(); parent.removeOperand(notNode); parent.addOperand(isNull); } else { applyRelativePath(notNull); node.childrenAccept(this, notNull); ((NAryQueryNode) queryNode).addOperand(notNull); NAryQueryNode parent = (NAryQueryNode) queryNode; QueryNode orQueryNode = factory.createOrQueryNode(parent); parent.addOperand(orQueryNode); parent = (NAryQueryNode) queryNode; QueryNode andQueryNode = factory.createAndQueryNode(parent); parent.addOperand(andQueryNode);
NAryQueryNode parent = (NAryQueryNode) notNode.getParent(); parent.removeOperand(notNode); parent.addOperand(isNull); } else { applyRelativePath(notNull); node.childrenAccept(this, notNull); ((NAryQueryNode) queryNode).addOperand(notNull); NAryQueryNode parent = (NAryQueryNode) queryNode; QueryNode orQueryNode = factory.createOrQueryNode(parent); parent.addOperand(orQueryNode); parent = (NAryQueryNode) queryNode; QueryNode andQueryNode = factory.createAndQueryNode(parent); parent.addOperand(andQueryNode);