Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.Or


        }
        if (constraint instanceof And) {
            return indexAppliesTo((And)constraint);
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            return indexAppliesTo(or.getConstraint1()) || indexAppliesTo(or.getConstraint2());
        }
        if (constraint instanceof Not) {
            Not not = (Not)constraint;
            return indexAppliesTo(not.getConstraint());
        }
View Full Code Here


        NamedSelector selector = (NamedSelector)query.source();
        assertThat(selector.name(), is(selectorName("mgnl:content")));
        assertThat(selector.aliasOrName(), is(selectorName("mgnl:content")));
        assertThat(selector.alias(), is(nullValue()));
        // WHERE ...
        Or and = isOr(query.constraint());
        Comparison comparison1 = isComparison(and.left());
        assertThat(comparison1.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison1.getOperand2(), is((StaticOperand)literal("/modules/%/templates")));
        Comparison comparison2 = isComparison(and.right());
        assertThat(comparison2.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison2.getOperand2(), is((StaticOperand)literal("/modules/%/other")));
    }
View Full Code Here

        NamedSelector selector = (NamedSelector)query.source();
        assertThat(selector.name(), is(selectorName("mgnl:content")));
        assertThat(selector.aliasOrName(), is(selectorName("mgnl:content")));
        assertThat(selector.alias(), is(nullValue()));
        // WHERE ...
        Or and = isOr(query.constraint());
        Comparison comparison1 = isComparison(and.left());
        assertThat(comparison1.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison1.getOperand2(), is((StaticOperand)literal("/modules/%/templates")));
        Comparison comparison2 = isComparison(and.right());
        assertThat(comparison2.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison2.getOperand2(), is((StaticOperand)literal("/modules/%/other")));
    }
View Full Code Here

            Constraint right = replaceReferencesToRemovedSource(context, and.right(), rewrittenSelectors);
            if (left == and.left() && right == and.right()) return and;
            return new And(left, right);
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint left = replaceReferencesToRemovedSource(context, or.left(), rewrittenSelectors);
            Constraint right = replaceReferencesToRemovedSource(context, or.right(), rewrittenSelectors);
            if (left == or.left() && right == or.right()) return or;
            return new Or(left, right);
        }
        if (constraint instanceof Not) {
            Not not = (Not)constraint;
            Constraint wrapped = replaceReferencesToRemovedSource(context, not.getConstraint(), rewrittenSelectors);
            if (wrapped == not.getConstraint()) return not;
View Full Code Here

            Constraint right = replaceReferences(context, and.right(), mapping, node);
            if (left == and.left() && right == and.right()) return and;
            return new And(left, right);
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint left = replaceReferences(context, or.left(), mapping, node);
            Constraint right = replaceReferences(context, or.right(), mapping, node);
            if (left == or.left() && right == or.right()) return or;
            return new Or(left, right);
        }
        if (constraint instanceof Not) {
            Not not = (Not)constraint;
            Constraint wrapped = replaceReferences(context, not.getConstraint(), mapping, node);
            return wrapped == not.getConstraint() ? not : new Not(wrapped);
View Full Code Here

            Constraint right = replaceAliasesWithProperties(context, and.right(), propertyByAlias);
            if (left == and.left() && right == and.right()) return and;
            return new And(left, right);
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint left = replaceAliasesWithProperties(context, or.left(), propertyByAlias);
            Constraint right = replaceAliasesWithProperties(context, or.right(), propertyByAlias);
            if (left == or.left() && right == or.right()) return or;
            return new Or(left, right);
        }
        if (constraint instanceof Not) {
            Not not = (Not)constraint;
            Constraint wrapped = replaceAliasesWithProperties(context, not.getConstraint(), propertyByAlias);
            if (wrapped == not.getConstraint()) return not;
View Full Code Here

            Constraint right = replaceSubqueriesWithBindVariables(context, and.right(), subqueriesByVariableName);
            if (left == and.left() && right == and.right()) return and;
            return new And(left, right);
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint left = replaceSubqueriesWithBindVariables(context, or.left(), subqueriesByVariableName);
            Constraint right = replaceSubqueriesWithBindVariables(context, or.right(), subqueriesByVariableName);
            if (left == or.left() && right == or.right()) return or;
            return new Or(left, right);
        }
        if (constraint instanceof Not) {
            Not not = (Not)constraint;
            Constraint wrapped = replaceSubqueriesWithBindVariables(context, not.getConstraint(), subqueriesByVariableName);
            if (wrapped == not.getConstraint()) return not;
View Full Code Here

        assert constraint != null;
        assert context != null;
        assert columns != null;
        assert sources != null;
        if (constraint instanceof Or) {
            Or orConstraint = (Or)constraint;
            final RowFilter left = createRowFilter(orConstraint.left(), context, columns, sources);
            final RowFilter right = createRowFilter(orConstraint.right(), context, columns, sources);
            return new RowFilter() {
                @Override
                public boolean isCurrentRowValid( Batch batch ) {
                    return left.isCurrentRowValid(batch) || right.isCurrentRowValid(batch);
                }
View Full Code Here

            }
            // Neither are path-oriented ...
            return and;
        }
        if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint oldLeft = or.left();
            Constraint oldRight = or.right();
            Constraint newLeft = rewriteCriteria(context, oldLeft);
            Constraint newRight = rewriteCriteria(context, oldRight);
            if (newRight != oldRight) {
                // The right side is path-oriented ...
                if (newLeft != oldLeft) {
                    // The left is too, so create a new Or constraint to signal that it's path oriented ...
                    return new Or(newLeft, newRight);
                }
                // Only the right is, so swap the order ...
                return new Or(newRight, newLeft);
            }
            // Neither are path-oriented ...
            return or;
        }
        if (constraint instanceof Not) {
View Full Code Here

            Constraint newRight = rewrite(context, right);
            if (newLeft != left || newRight != right) {
                return new And(newLeft, newRight);
            }
        } else if (constraint instanceof Or) {
            Or or = (Or)constraint;
            Constraint left = or.left();
            Constraint right = or.right();
            Constraint newLeft = rewrite(context, left);
            Constraint newRight = rewrite(context, right);
            if (newLeft != left || newRight != right) {
                return new Or(newLeft, newRight);
            }
        } else if (constraint instanceof Not) {
            Not not = (Not)constraint;
            Constraint oldInner = not.getConstraint();
            Constraint newInner = rewrite(context, oldInner);
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.model.Or

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.