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

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


            }
        }

        @Override
        public Boolean walkEqAny(Tree opNode, Tree literalNode, Tree colNode) {
            ColumnReference colRef = getColumnReference(colNode);
            PropertyDefinition<?> pd = colRef.getPropertyDefinition();
            PropertyData<?> lVal = so.getProperties().get(colRef.getPropertyId());
            Object literal = walkExpr(literalNode);
            if (pd.getCardinality() != Cardinality.MULTI) {
                throw new IllegalStateException("Operator = ANY only is allowed on multi-value properties ");
            } else if (lVal == null) {
                return false;
View Full Code Here


            }
        }

        @Override
        public Boolean walkIsNull(Tree opNode, Tree colNode) {
            ColumnReference colRef = getColumnReference(colNode);
            PropertyDefinition<?> pd = colRef.getPropertyDefinition();
            Object propVal = PropertyUtil.getProperty(so, colRef.getPropertyId(), pd);
            return propVal == null;
        }
View Full Code Here

            return propVal == null;
        }

        @Override
        public Boolean walkIsNotNull(Tree opNode, Tree colNode) {
            ColumnReference colRef = getColumnReference(colNode);
            PropertyDefinition<?> pd = colRef.getPropertyDefinition();
            Object propVal = PropertyUtil.getProperty(so, colRef.getPropertyId(), pd);
            return propVal != null;
        }
View Full Code Here

            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) PropertyUtil.getProperty(so, colRef.getPropertyId(), pd);
           
            String pattern = translatePattern((String) rVal); // SQL to Java
                                                              // regex
                                                              // syntax
            Pattern p = Pattern.compile(pattern);
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();
            Object val = PropertyUtil.getProperty(so, colRef.getPropertyId(), pd);
            if (val==null) {
                return null;
            } else if (val instanceof List<?>) {
                throw new IllegalStateException("You can't query operators <, <=, ==, !=, >=, > on multi-value properties ");
            } else {
View Full Code Here

        }
        return typeQueryName;
    }

    private Object xgetPropertyValue(Tree columnNode, StoredObject so) {
        ColumnReference colRef = getColumnReference(columnNode);
        PropertyDefinition<?> pd = colRef.getPropertyDefinition();
        return PropertyUtil.getProperty(so, colRef.getPropertyId(), pd);
    }
View Full Code Here

        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

        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

        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

        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

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.