Package org.apache.jackrabbit.oak.query.xpath.Expression

Examples of org.apache.jackrabbit.oak.query.xpath.Expression.AndCondition


        } else if (where instanceof AndCondition) {
            // conditions of type
            // @a = 1 and (@x = 1 or @y = 2)
            // are automatically converted to
            // (@a = 1 and @x = 1) union (@a = 1 and @y = 2)
            AndCondition and = (AndCondition) where;
            if (and.left instanceof OrCondition && !(and.right instanceof OrCondition)) {
                // swap left and right
                and = new AndCondition(and.right, and.left);
            }
            if (and.right instanceof OrCondition) {
                OrCondition or = (OrCondition) and.right;
                if (or.getCommonLeftPart() != null) {
                    // @x = 1 or @x = 2
                    // is automatically converted to
                    // @x in (1, 2)
                    // within the query engine               
                } else if (or.left instanceof Contains && or.right instanceof Contains) {
                    // do not optimize "contains"
                } else {
                    // same as above, but with the added "and"
                    // TODO avoid code duplication if possible
                    Statement s1 = new Statement();
                    s1.columnSelector = columnSelector;
                    s1.selectors = selectors;
                    s1.columnList = columnList;
                    s1.where = new AndCondition(and.left, or.left);
                    Statement s2 = new Statement();
                    s2.columnSelector = columnSelector;
                    s2.selectors = selectors;
                    s2.columnList = columnList;
                    s2.where = new AndCondition(and.left, or.right);
                    s2.xpathQuery = xpathQuery;
                    return new UnionStatement(s1.optimize(), s2.optimize());
                }
            }
        }
View Full Code Here


        } else if (condition instanceof AndCondition) {
            // conditions of type
            // @a = 1 and (@x = 1 or @y = 2)
            // are automatically converted to
            // (@a = 1 and @x = 1) union (@a = 1 and @y = 2)
            AndCondition and = (AndCondition) condition;
            and = and.pullOrRight();
            if (and.right instanceof OrCondition) {
                OrCondition or = (OrCondition) and.right;
                if (or.getCommonLeftPart() != null) {
                    // @x = 1 or @x = 2
                    // is automatically converted to
                    // @x in (1, 2)
                    // within the query engine               
                } else if (or.left instanceof Contains && or.right instanceof Contains) {
                    // do not optimize "contains"
                } else {
                    // same as above, but with the added "and"
                    addToUnionList(new AndCondition(and.left, or.left), unionList);
                    addToUnionList(new AndCondition(and.left, or.right), unionList);
                    return;
                }
            }
        }
        unionList.add(condition);
View Full Code Here

        } else if (condition instanceof AndCondition) {
            // conditions of type
            // @a = 1 and (@x = 1 or @y = 2)
            // are automatically converted to
            // (@a = 1 and @x = 1) union (@a = 1 and @y = 2)
            AndCondition and = (AndCondition) condition;
            and = and.pullOrRight();
            if (and.right instanceof OrCondition) {
                OrCondition or = (OrCondition) and.right;
                // same as above, but with the added "and"
                addToUnionList(new AndCondition(and.left, or.left), unionList);
                addToUnionList(new AndCondition(and.left, or.right), unionList);
                return;
            }
        }
        unionList.add(condition);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.query.xpath.Expression.AndCondition

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.