Package org.modeshape.jcr.query.model

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


        return new And(left, right);
    }

    protected Comparison like( DynamicOperand left,
                               StaticOperand right ) {
        return new Comparison(left, Operator.LIKE, right);
    }
View Full Code Here


        return new Comparison(left, Operator.LIKE, right);
    }

    protected Comparison lessThan( DynamicOperand left,
                                   StaticOperand right ) {
        return new Comparison(left, Operator.LESS_THAN, right);
    }
View Full Code Here

        return new Comparison(left, Operator.LESS_THAN, right);
    }

    protected Comparison equals( DynamicOperand left,
                                 StaticOperand right ) {
        return new Comparison(left, Operator.EQUAL_TO, right);
    }
View Full Code Here

        // Create the equivalent plan nodes for what should be created ...
        PlanNode viewProject = new PlanNode(Type.PROJECT, selector("t1"));
        PlanNode viewSelect = new PlanNode(Type.SELECT, viewProject, selector("t1"));
        PlanNode viewSource = new PlanNode(Type.SOURCE, viewSelect, selector("t1"));
        viewProject.setProperty(Property.PROJECT_COLUMNS, columns(column("t1", "c11"), column("t1", "c12")));
        viewSelect.setProperty(Property.SELECT_CRITERIA, new Comparison(new PropertyValue(selector("t1"), "c13"),
                                                                        Operator.LESS_THAN, new Literal(3L)));
        viewSource.setProperty(Property.SOURCE_NAME, selector("t1"));
        viewSource.setProperty(Property.SOURCE_COLUMNS, schemata.getTable(selector("t1")).getColumns());

        // Execute the rule ...
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 ...
        Comparison comparison = isComparison(query.constraint());
        assertThat(comparison.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison.getOperand2(), is((StaticOperand)literal("/modules/%/templates")));
    }
View Full Code Here

        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

        SameNodeJoinCondition joinCondition = isSameNodeJoinCondition(join.getJoinCondition());
        assertThat(joinCondition.selector1Name(), is(selectorName("modetest:queryable")));
        assertThat(joinCondition.selector2Name(), is(selectorName("mix:referenceable")));
        assertThat(joinCondition.getSelector2Path(), is(nullValue()));
        // WHERE ...
        Comparison comparison = isComparison(query.constraint());
        assertThat(comparison.getOperand1(), is((DynamicOperand)nodePath(selectorName("modetest:queryable"))));
        assertThat(comparison.getOperand2(), is((StaticOperand)literal("/testroot/someQueryableNodeD/%")));
    }
View Full Code Here

        assertThat(selector.name(), is(selectorName("nt:base")));
        assertThat(selector.aliasOrName(), is(selectorName("nt:base")));
        assertThat(selector.alias(), is(nullValue()));
        // WHERE ...
        And and = isAnd(query.constraint());
        Comparison comparison1 = isComparison(and.left());
        assertThat(comparison1.getOperand1(), is((DynamicOperand)nodePath(selectorName("nt:base"))));
        assertThat(comparison1.getOperand2(), is((StaticOperand)literal("/a/b/%")));
        Not not = isNot(and.right());
        Comparison comparison2a = isComparison(not.getConstraint());
        assertThat(comparison2a.getOperand1(), is((DynamicOperand)nodePath(selectorName("nt:base"))));
        assertThat(comparison2a.getOperand2(), is((StaticOperand)literal("/a/b/%/%")));
    }
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 ...
        Comparison comparison = isComparison(query.constraint());
        assertThat(comparison.getOperand1(), is((DynamicOperand)nodePath(selectorName("mgnl:content"))));
        assertThat(comparison.getOperand2(), is((StaticOperand)literal("/modules/%/templates")));
    }
View Full Code Here

        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

TOP

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

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.