Package org.apache.jackrabbit.spi.commons.query

Examples of org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode


         * @return <code>true</code> if this node needs merging; <code>false</code>
         *         otherwise.
         */
        boolean needsMerge() {
            for (Iterator it = operands.iterator(); it.hasNext();) {
                LocationStepQueryNode step = (LocationStepQueryNode) it.next();
                if (step.getIncludeDescendants() && step.getNameTest() == null) {
                    return true;
                }
            }
            return false;
        }
View Full Code Here


            // child axis in relation
            // elements.length - 1 = property name
            // elements.length - 2 = last child axis name test
            boolean selectParent = true;
            for (int i = steps.length - 2; i >= 0; i--) {
                LocationStepQueryNode step = steps[i];
                Name name = steps[i].getNameTest();
                if (i == steps.length - 2) {
                    if (step instanceof DerefQueryNode) {
                        query = createPredicateDeref(query, (DerefQueryNode) step, data);
                        if (steps.length == 2) {
View Full Code Here

            // child axis in relation
            // elements.length - 1 = property name
            // elements.length - 2 = last child axis name test
            boolean selectParent = true;
            for (int i = steps.length - 2; i >= 0; i--) {
                LocationStepQueryNode step = steps[i];
                Name name = steps[i].getNameTest();
                if (i == steps.length - 2) {
                    if (step instanceof DerefQueryNode) {
                        query = createPredicateDeref(query, (DerefQueryNode) step, data);
                        if (steps.length == 2) {
View Full Code Here

                    }
                }
                break;
            case JJTTEXTTEST:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    LocationStepQueryNode loc = (LocationStepQueryNode) queryNode;
                    loc.setNameTest(JCR_XMLTEXT);
                }
                break;
            case JJTTYPENAME:
                if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                    LocationStepQueryNode loc = (LocationStepQueryNode) queryNode;
                    String ntName = ((SimpleNode) node.jjtGetChild(0)).getValue();
                    try {
                        Name nt = resolver.getQName(ntName);
                        NodeTypeQueryNode nodeType = factory.createNodeTypeQueryNode(loc, nt);
                        loc.addPredicate(nodeType);
                    } catch (NameException e) {
                        exceptions.add(new InvalidQueryException("Not a valid name: " + ntName));
                    } catch (NamespaceException e) {
                        exceptions.add(new InvalidQueryException("Not a valid name: " + ntName));
                    }
View Full Code Here

     * @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);
View Full Code Here

            } else if (JCR_DEREF.equals(funName)) {
                // check number of arguments
                if (node.jjtGetNumChildren() == 3) {
                    boolean descendant = false;
                    if (queryNode.getType() == QueryNode.TYPE_LOCATION) {
                        LocationStepQueryNode loc = (LocationStepQueryNode) queryNode;
                        // remember if descendant axis
                        descendant = loc.getIncludeDescendants();
                        queryNode = loc.getParent();
                        ((NAryQueryNode) queryNode).removeOperand(loc);
                    }
                    if (queryNode.getType() == QueryNode.TYPE_PATH) {
                        PathQueryNode pathNode = (PathQueryNode) queryNode;
                        DerefQueryNode derefNode = factory.createDerefQueryNode(pathNode, null, false);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.