Package org.apache.chemistry.opencmis.server.support.query

Examples of org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker


    }

    @Test
    public void simpleFromTest4() {
        String statement = "SELECT X.aaa FROM MyType AS X WHERE 10 = ANY X.aaa ";
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        Map<String,String> types = queryObj.getTypes();
        assertTrue(1 == types.size());
View Full Code Here


    @Test
    public void simpleWhereTest() {
        String statement = "SELECT * FROM MyType WHERE MyProp1=123";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<CmisSelector> whereRefs = queryObj.getWhereReferences();
        Map<Integer, CmisSelector> colRefs = queryObj.getColumnReferences();
        assertTrue(1 == whereRefs.size());

        CmisSelector value = whereRefs.iterator().next();
        assertTrue(value instanceof ColumnReference);
        assertEquals("MyProp1", ((ColumnReference)value).getPropertyQueryName());
        // only "*" should be in select references
        assertTrue(1 == queryObj.getSelectReferences().size());

        CommonTree tree = (CommonTree) walker.getTreeNodeStream().getTreeSource();

        // System.out.println("simpleWhereTest printing Tree ...");
        // System.out.println("id in map: " + System.identityHashCode(whereRefs.keySet().iterator().next()));
//        assertTrue(traverseTreeAndFindNodeInColumnMap(tree, colRefs));
        traverseTreeAndFindNodeInColumnMap2(tree, colRefs);
View Full Code Here

    @Test
    public void simpleSortTest1() {
        String statement = "SELECT * FROM MyType ORDER BY abc.def ASC";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

View Full Code Here

    }

    @Test
    public void simpleSortTest2() {
        String statement = "SELECT * FROM MyType ORDER BY def DESC";
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

View Full Code Here

    @Test
    public void doubleFromTest() {
        String statement = "SELECT * FROM MyType JOIN YourType WHERE a='1'";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        QueryObject from = queryObj;
        Map<String,String> types = from.getTypes();
        assertTrue(2 == types.size());
View Full Code Here

     */
    public String translateToXPath(String statement) {
        QueryUtil queryUtil = new QueryUtil();
        queryObject = new QueryObject(typeManager);
        ParseTreeWalker<XPathBuilder> parseTreeWalker = new ParseTreeWalker<XPathBuilder>(evaluator);
        CmisQueryWalker walker = queryUtil.traverseStatementAndCatchExc(statement, queryObject, parseTreeWalker);
        walker.setDoFullTextParse(false);
        XPathBuilder parseResult = parseTreeWalker.getResult();
        TypeDefinition fromType = getFromName(queryObject);

        String pathExpression = buildPathExpression(fromType, getFolderPredicate(parseResult));
        String elementTest = buildElementTest(fromType);
View Full Code Here

//        }
        parserTree = (CommonTree) parsedStatement.getTree();

        CommonTreeNodeStream nodes = new CommonTreeNodeStream(parserTree);
        nodes.setTokenStream(tokens);
        CmisQueryWalker walker = new CmisQueryWalker(nodes);
        return walker;
    }
View Full Code Here

        return objList;
    }

    public void processQueryAndCatchExc(String statement) {
        QueryUtil queryUtil = new QueryUtil();
        CmisQueryWalker walker = queryUtil.traverseStatementAndCatchExc(statement, queryObj, null);
        whereTree = walker.getWherePredicateTree();
    }
View Full Code Here

        return objList;
    }

    public void processQueryAndCatchExc(String statement) {
        QueryUtil queryUtil = new QueryUtil();
        CmisQueryWalker walker = queryUtil.traverseStatementAndCatchExc(statement, queryObj, null);
        whereTree = walker.getWherePredicateTree();
    }
View Full Code Here

    }

    public void simpleSelectTest1() {
        String statement = "SELECT SCORE() FROM cmis:document";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
        assertTrue(selects.get(0) instanceof FunctionReference);
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker

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.