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

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


        // do nothing
        return data;
    }

    public Object visit(ASTOrderByClause node, Object data) {
        QueryRootNode root = (QueryRootNode) data;

        OrderQueryNode order = factory.createOrderQueryNode(root);
        root.setOrderNode(order);
        node.childrenAccept(this, order);
        return root;
    }
View Full Code Here


            return "";
        }
    });

    public void testNeedsSystemTree() throws Exception {
        QueryRootNode queryRootNode = XPathQueryBuilder.createQuery("/jcr:root/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("/jcr:root/test/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertFalse(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("jcr:system/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("test//*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertFalse(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("//test/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());
    }
View Full Code Here

        queryRootNode = XPathQueryBuilder.createQuery("//test/*", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());
    }

    public void testNeedsSystemTreeForAllNodesByNodeType() throws Exception {
        QueryRootNode queryRootNode = XPathQueryBuilder.createQuery("//element(*, nt:resource)", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertFalse(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("//element(*, nt:resource)[@jcr:test = 'foo']", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertFalse(queryRootNode.needsSystemTree());

        queryRootNode = XPathQueryBuilder.createQuery("//element(*, nt:nodeType)", JCR_RESOLVER, QUERY_NODE_FACTORY);
        assertTrue(queryRootNode.needsSystemTree());
    }
View Full Code Here

        return root;
    }

    public Object visit(ASTSelectList node, Object data) {
        final QueryRootNode root = (QueryRootNode) data;

        node.childrenAccept(new DefaultParserVisitor() {
            public Object visit(ASTIdentifier node, Object data) {
                root.addSelectProperty(node.getName());
                return data;
            }

            public Object visit(ASTExcerptFunction node, Object data) {
                root.addSelectProperty(NameFactoryImpl.getInstance().create(Name.NS_REP_URI, "excerpt(.)"));
                return data;
            }
        }, root);

        return data;
View Full Code Here

        return data;
    }

    public Object visit(ASTFromClause node, Object data) {
        QueryRootNode root = (QueryRootNode) data;

        return node.childrenAccept(new DefaultParserVisitor() {
            public Object visit(ASTIdentifier node, Object data) {
                if (!node.getName().equals(NameConstants.NT_BASE)) {
                    // node is either primary or mixin node type
View Full Code Here

        // do nothing
        return data;
    }

    public Object visit(ASTOrderByClause node, Object data) {
        QueryRootNode root = (QueryRootNode) data;

        OrderQueryNode order = factory.createOrderQueryNode(root);
        root.setOrderNode(order);
        node.childrenAccept(this, order);
        return root;
    }
View Full Code Here

    private static final QueryNodeFactory FACTORY = new DefaultQueryNodeFactory(Collections.EMPTY_LIST);

    public void testSelectWithOrderBy() throws InvalidQueryException {
        String stmt = "//element(*, foo)/(@a|@b) order by @bar";
        QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
        assertEquals(stmt, QueryFormat.toString(root, RESOLVER));
    }
View Full Code Here

TOP

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

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.