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

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


     */
    public ObjectList query(TypeManager tm, ObjectStore objectStore, String user, String repositoryId,
            String statement, Boolean searchAllVersions, Boolean includeAllowableActions,
            IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems, BigInteger skipCount) {

        queryObj = new QueryObject(tm);
        processQueryAndCatchExc(statement); // calls query processor

        // iterate over all the objects and check for each if the query matches
        for (String objectId : ((ObjectStoreImpl) objectStore).getIds()) {
            StoredObject so = objectStore.getObjectById(objectId);
View Full Code Here


        for (TypeDefinition typeDef : typeDefs)
            tm.addTypeDefinition(typeDef);

        // initialize query object with type manager
        queryProcessor = new TestQueryProcessor();
        QueryObject qo = new QueryObject(tm, queryProcessor);
        super.setUp(qo);
    }
View Full Code Here

    private static Log LOG = LogFactory.getLog(QueryParseTest.class);

    @Before
    public void setUp() throws Exception {
        // initialize query object, we do not need a type manager for just testing parsing
        super.setUp(new QueryObject(null, null));
    }
View Full Code Here

    @Test
    public void simpleSelectTest1() throws Exception {
        String statement = "SELECT SCORE() FROM cmis:document";
       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        assertTrue(selects.get(0) instanceof FunctionReference);
        FunctionReference funcRef = ((FunctionReference)selects.get(0));
        assertTrue(FunctionReference.CmisQlFunction.SCORE == funcRef.getFunction());
    }
View Full Code Here

   
    @Test
    public void simpleSelectTest2() throws Exception {
        String statement = "SELECT abc FROM cmis:document";        
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().size());

        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertTrue(selects.get(0) instanceof ColumnReference);
        assertEquals("abc", colRef.getPropertyQueryName());
       
View Full Code Here

   
    @Test
    public void simpleSelectTest3() throws Exception {
        String statement = "SELECT t1.abc FROM cmis:document";       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);
        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t1", colRef.getTypeQueryName());
        assertEquals("abc", colRef.getPropertyQueryName());
View Full Code Here

   
    @Test
    public void simpleSelectTest4() throws Exception {
        String statement = "SELECT * FROM cmis:document";       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().size());
        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertTrue(selects.get(0) instanceof ColumnReference);
        assertEquals(null, colRef.getTypeQueryName());
        assertEquals("*", colRef.getPropertyQueryName());

View Full Code Here

   
    @Test
    public void simpleSelectTest5() throws Exception {
        String statement = "SELECT t1.* FROM cmis:document";       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);
        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t1", colRef.getTypeQueryName());
        assertEquals("*", colRef.getPropertyQueryName());
       
View Full Code Here

   
    @Test
    public void simpleSelectTest6() throws Exception {
        String statement = "SELECT t2.aaa myalias FROM cmis:document";       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);
        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t2", colRef.getTypeQueryName());
        assertEquals("aaa", colRef.getPropertyQueryName());
View Full Code Here

    @Test
    public void simpleFromTest1() throws Exception {
        String statement = "SELECT * FROM MyType MyAlias";
       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject from = walker.queryObj;
        Map<String,String> types = from.getTypes();
        assertTrue(1 == types.size());
        String key = types.keySet().iterator().next();
        assertEquals("MyAlias", key);
        assertEquals("MyType", types.get(key));
    }
View Full Code Here

TOP

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

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.