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

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


            Object rVal = walkExpr(stringNode);
            if (!(rVal instanceof String)) {
                throw new IllegalStateException("LIKE operator requires String literal on right hand side.");
            }

            ColumnReference colRef = getColumnReference(colNode);
            PropertyDefinition<?> pd = colRef.getPropertyDefinition();
            PropertyType propType = pd.getPropertyType();
            if (propType != PropertyType.STRING && propType != PropertyType.HTML && propType != PropertyType.ID
                    && propType != PropertyType.URI) {
                throw new IllegalStateException("Property type " + propType.value() + " is not allowed FOR LIKE");
            }
            if (pd.getCardinality() != Cardinality.SINGLE) {
                throw new IllegalStateException("LIKE is not allowed for multi-value properties ");
            }

            String propVal = (String) so.getProperties().get(colRef.getPropertyId()).getFirstValue();
            String pattern = translatePattern((String) rVal); // SQL to Java
                                                              // regex
                                                              // syntax
            Pattern p = Pattern.compile(pattern);
            return p.matcher(propVal).matches();
View Full Code Here


        protected Integer compareTo(Tree leftChild, Tree rightChild) {
            Object rVal = walkExpr(rightChild);

            // log.debug("retrieve node from where: " +
            // System.identityHashCode(leftChild) + " is " + leftChild);
            ColumnReference colRef = getColumnReference(leftChild);
            PropertyDefinition<?> pd = colRef.getPropertyDefinition();
            PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
            if (lVal instanceof List<?>) {
                throw new IllegalStateException("You can't query operators <, <=, ==, !=, >=, > on multi-value properties ");
            } else {
                return InMemoryQueryProcessor.this.compareTo(pd, lVal, rVal);
            }
View Full Code Here

        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == queryObj.getWhereReferences().size());

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

        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == queryObj.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);

        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t1", colRef.getQualifier());
        assertEquals("abc", colRef.getPropertyQueryName());
    }
View Full Code Here

        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == queryObj.getWhereReferences().size());

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

        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == queryObj.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);

        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t1", colRef.getQualifier());
        assertEquals("*", colRef.getPropertyQueryName());
    }
View Full Code Here

        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == queryObj.getWhereReferences().size());
        assertTrue(selects.get(0) instanceof ColumnReference);

        ColumnReference colRef = ((ColumnReference)selects.get(0));
        assertEquals("t2", colRef.getQualifier());
        assertEquals("aaa", colRef.getPropertyQueryName());
    }
View Full Code Here

        assertTrue(1 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(2 == selects.size());
        for (CmisSelector select : selects) {
            assertTrue(select instanceof ColumnReference);
            ColumnReference colRef = ((ColumnReference) select);
            assertEquals(bookType, colRef.getTypeDefinition());
            assertTrue(colRef.getPropertyQueryName().equals(TITLE_PROP) || colRef.getPropertyQueryName().equals(AUTHOR_PROP));
        }
    }
View Full Code Here

        Map<String,String> types = queryObj.getTypes();
        assertTrue(2 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(2 == selects.size());

        ColumnReference colRef = ((ColumnReference) selects.get(0));
        assertEquals(colRef.getTypeDefinition(), bookType);
        assertTrue(colRef.getPropertyQueryName().equals(TITLE_PROP));

        colRef = ((ColumnReference) selects.get(1));
        assertEquals(colRef.getTypeDefinition(), myType);
        assertTrue(colRef.getPropertyQueryName().equals(STRING_PROP));
    }
View Full Code Here

        assertNotNull(walker);
        Map<String, String> types = queryObj.getTypes();
        assertEquals(2, types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertEquals(1, selects.size());
        ColumnReference colRef = ((ColumnReference) selects.get(0));
        assertEquals(bookType, colRef.getTypeDefinition());
        assertEquals(TITLE_PROP, colRef.getPropertyQueryName());
        assertEquals("A", colRef.getQualifier());
    }
View Full Code Here

TOP

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

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.