public Object visit(PathQueryNode node, Object data) throws RepositoryException { StringBuffer sb = (StringBuffer) data; if (node.isAbsolute()) { sb.append("/"); } LocationStepQueryNode[] steps = node.getPathSteps(); String slash = ""; for (int i = 0; i < steps.length; i++) { sb.append(slash); steps[i].accept(this, sb); slash = "/"; } return sb; }
/** * {@inheritDoc} */ public PathQueryNode createPathQueryNode(QueryNode parent) { return new PathQueryNode(parent, validJcrSystemNodeTypeNames); }
public Object visit(PathQueryNode node, Object data) throws RepositoryException { return node.acceptOperands(this, data); }
/** * Returns <code>true</code> if <code>path</code> contains exactly one * step with a descendant-or-self axis and an explicit name test; returns * <code>false</code> otherwise. * * @param path the path node. * @return <code>true</code> if <code>path</code> contains exactly one * step with a descendant-or-self axis. */ private static boolean containsDescendantOrSelf(PathQueryNode path) { LocationStepQueryNode[] steps = path.getPathSteps(); int count = 0; for (int i = 0; i < steps.length; i++) { if (steps[i].getNameTest() != null && steps[i].getIncludeDescendants()) { count++; } } return count == 1; }
pathNode.setAbsolute(true); if (pathConstraints.size() == 0) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(null); step.setIncludeDescendants(true); pathNode.addPathStep(step); } else { try { step.setIncludeDescendants(steps[i].getIncludeDescendants()); step.setIndex(steps[i].getIndex()); pathNode.addPathStep(step); LocationStepQueryNode[] steps = pathNode.getPathSteps(); steps[steps.length - 1].addPredicate(constraintNode.getOperands()[0]); } else if (constraintNode.getNumOperands() > 1) { LocationStepQueryNode[] steps = pathNode.getPathSteps(); steps[steps.length - 1].addPredicate(constraintNode); LocationStepQueryNode[] steps = pathNode.getPathSteps(); NodeTypeQueryNode nodeType = factory.createNodeTypeQueryNode(steps[steps.length - 1], nodeTypeName);
LocationStepQueryNode[] steps = node.getLocationNode().getPathSteps(); QueryNode[] predicates = steps[steps.length - 1].getPredicates(); sb.append(" WHERE "); node.getLocationNode().accept(this, sb);
case JJTROOTDESCENDANTS: if (queryNode instanceof PathQueryNode) { ((PathQueryNode) queryNode).setAbsolute(true); } else { exceptions.add(new InvalidQueryException( LocationStepQueryNode[] steps = relPath.getPathSteps(); if (queryNode.getType() == QueryNode.TYPE_PATH) { QueryNode[] operands = ((PathQueryNode) queryNode).getOperands(); queryNode = operands[operands.length - 1];
public Object visit(QueryRootNode node, Object data) throws RepositoryException { BooleanQuery root = new BooleanQuery(); Query wrapped = root; if (node.getLocationNode() != null) { wrapped = (Query) node.getLocationNode().accept(this, root); } return wrapped; }
if (relPath == null) { propPath.append("."); } else if (relPath.getNumOperands() > 0 && XPathQueryBuilder.FN_POSITION_FULL.equals(relPath.getPathSteps()[0].getNameTest())) { propPath.append(resolver.getJCRName(XPathQueryBuilder.FN_POSITION_FULL)); } else { LocationStepQueryNode[] steps = relPath.getPathSteps(); String slash = ""; for (int i = 0; i < steps.length; i++) {
/** * {@inheritDoc} */ public boolean equals(Object obj) { if (obj instanceof RelationQueryNode) { RelationQueryNode other = (RelationQueryNode) obj; return type == other.type && (valueDate == null ? other.valueDate == null : valueDate.equals(other.valueDate)) && valueDouble == other.valueDouble && valueLong == other.valueLong && valuePosition == other.valuePosition && (valueString == null ? other.valueString == null : valueString.equals(other.valueString)) && (relPath == null ? other.relPath == null : relPath.equals(other.relPath)); } return false; } }
/** * Adds a path element to the existing relative path. To add a path element * which matches all node names use {@link #STAR_NAME_TEST}. * * @param element the path element to append. */ public void addPathElement(Path.Element element) { LocationStepQueryNode step = factory.createLocationStepQueryNode(relPath); if (element.getName().equals(STAR_NAME_TEST)) { step.setNameTest(null); } else { step.setNameTest(element.getName()); } relPath.addPathStep(step); }
/** * Adds a path step to this <code>PathQueryNode</code>. * * @param step the step to add. */ public void addPathStep(LocationStepQueryNode step) { addOperand(step); }
public Object visit(PathQueryNode node, Object data) throws RepositoryException { StringBuffer buffer = (StringBuffer) data; buffer.append(PADDING, 0, indent); buffer.append("+ PathQueryNode"); buffer.append("\n"); traverse(node.getOperands(), buffer); return buffer; }
/** * Returns <code>true</code> if <code>path</code> contains exactly one * step with a descendant-or-self axis and an explicit name test; returns * <code>false</code> otherwise. * * @param path the path node. * @return <code>true</code> if <code>path</code> contains exactly one * step with a descendant-or-self axis. */ private static boolean containsDescendantOrSelf(PathQueryNode path) { LocationStepQueryNode[] steps = path.getPathSteps(); int count = 0; for (int i = 0; i < steps.length; i++) { if (steps[i].getNameTest() != null && steps[i].getIncludeDescendants()) { count++; } } return count == 1; }
pathNode.setAbsolute(true); if (pathConstraints.size() == 0) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(null); step.setIncludeDescendants(true); pathNode.addPathStep(step); } else { try { step.setIncludeDescendants(steps[i].getIncludeDescendants()); step.setIndex(steps[i].getIndex()); pathNode.addPathStep(step); LocationStepQueryNode[] steps = pathNode.getPathSteps(); steps[steps.length - 1].addPredicate(constraintNode.getOperands()[0]); } else if (constraintNode.getNumOperands() > 1) { LocationStepQueryNode[] steps = pathNode.getPathSteps(); steps[steps.length - 1].addPredicate(constraintNode); LocationStepQueryNode[] steps = pathNode.getPathSteps(); NodeTypeQueryNode nodeType = factory.createNodeTypeQueryNode(steps[steps.length - 1], nodeTypeName);
LocationStepQueryNode[] steps = node.getLocationNode().getPathSteps(); QueryNode[] predicates = steps[steps.length - 1].getPredicates(); sb.append(" WHERE "); node.getLocationNode().accept(this, sb);
case JJTROOTDESCENDANTS: if (queryNode instanceof PathQueryNode) { ((PathQueryNode) queryNode).setAbsolute(true); } else { exceptions.add(new InvalidQueryException( LocationStepQueryNode[] steps = relPath.getPathSteps(); if (queryNode.getType() == QueryNode.TYPE_PATH) { QueryNode[] operands = ((PathQueryNode) queryNode).getOperands(); queryNode = operands[operands.length - 1];
public Object visit(QueryRootNode node, Object data) throws RepositoryException { PathQueryNode pathNode = node.getLocationNode(); if (pathNode != null) { pathNode.accept(this, data); } OrderQueryNode orderNode = node.getOrderNode(); if (orderNode != null) { orderNode.accept(this, data); } return data; }
if (relPath == null) { propPath.append("."); } else if (relPath.getNumOperands() > 0 && XPathQueryBuilder.FN_POSITION_FULL.equals(relPath.getPathSteps()[0].getNameTest())) { propPath.append(resolver.getJCRName(XPathQueryBuilder.FN_POSITION_FULL)); } else { LocationStepQueryNode[] steps = relPath.getPathSteps(); String slash = ""; for (int i = 0; i < steps.length; i++) {
/** * {@inheritDoc} */ public boolean equals(Object obj) { if (obj instanceof RelationQueryNode) { RelationQueryNode other = (RelationQueryNode) obj; return type == other.type && (valueDate == null ? other.valueDate == null : valueDate.equals(other.valueDate)) && valueDouble == other.valueDouble && valueLong == other.valueLong && valuePosition == other.valuePosition && (valueString == null ? other.valueString == null : valueString.equals(other.valueString)) && (relPath == null ? other.relPath == null : relPath.equals(other.relPath)); } return false; } }