/** * 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 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); }
step.setNameTest(qName); step.setIncludeDescendants(descendant); if (index > 0) {
step.setNameTest(qName); step.setIncludeDescendants(descendant); if (index > 0) {
if (pathConstraints.size() == 0) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(null); step.setIncludeDescendants(true); pathNode.addPathStep(step); for (int i = 0; i < steps.length; i++) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(steps[i].getNameTest()); step.setIncludeDescendants(steps[i].getIncludeDescendants()); step.setIndex(steps[i].getIndex());
if (pathConstraints.size() == 0) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(null); step.setIncludeDescendants(true); pathNode.addPathStep(step); for (int i = 0; i < steps.length; i++) { LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode); step.setNameTest(steps[i].getNameTest()); step.setIncludeDescendants(steps[i].getIncludeDescendants()); step.setIndex(steps[i].getIndex());
/** * 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; }
name = LocationStepQueryNode.EMPTY_NAME; ((LocationStepQueryNode) queryNode).setNameTest(name); } else if (queryNode.getType() == QueryNode.TYPE_DEREF) { ((DerefQueryNode) queryNode).setRefProperty(name); ((LocationStepQueryNode) queryNode).setNameTest(null); } else if (queryNode.getType() == QueryNode.TYPE_RELATION) { ((RelationQueryNode) queryNode).addPathElement(
name = LocationStepQueryNode.EMPTY_NAME; ((LocationStepQueryNode) queryNode).setNameTest(name); } else if (queryNode.getType() == QueryNode.TYPE_DEREF) { ((DerefQueryNode) queryNode).setRefProperty(name); ((LocationStepQueryNode) queryNode).setNameTest(null); } else if (queryNode.getType() == QueryNode.TYPE_RELATION) { ((RelationQueryNode) queryNode).addPathElement(
if (queryNode.getType() == QueryNode.TYPE_LOCATION) { LocationStepQueryNode loc = (LocationStepQueryNode) queryNode; loc.setNameTest(JCR_XMLTEXT); case JJTDOTDOT: if (queryNode instanceof LocationStepQueryNode) { ((LocationStepQueryNode) queryNode).setNameTest(PATH_FACTORY.getParentElement().getName()); } else { ((RelationQueryNode) queryNode).addPathElement(PATH_FACTORY.getParentElement());
if (queryNode.getType() == QueryNode.TYPE_LOCATION) { LocationStepQueryNode loc = (LocationStepQueryNode) queryNode; loc.setNameTest(JCR_XMLTEXT); case JJTDOTDOT: if (queryNode instanceof LocationStepQueryNode) { ((LocationStepQueryNode) queryNode).setNameTest(PATH_FACTORY.getParentElement().getName()); } else { ((RelationQueryNode) queryNode).addPathElement(PATH_FACTORY.getParentElement());