Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.And


    @Test
    public void and() throws RepositoryException {
        Constraint c0 = f.propertyExistence("x", "c0");
        Constraint c1 = f.propertyExistence("x", "c1");
        And and = f.and(c0, c1);
        assertEquals(and.getConstraint1(), c0);
        assertEquals(and.getConstraint2(), c1);
    }
View Full Code Here


     * Test case for {@link QueryObjectModelFactory#and(Constraint, Constraint)}
     */
    public void testAnd() throws RepositoryException {
        PropertyExistence c1 = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyExistence c2 = qf.propertyExistence(SELECTOR_NAME1, propertyName2);
        And and = qf.and(c1, c2);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint1() instanceof PropertyExistence);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint2() instanceof PropertyExistence);
    }
View Full Code Here

     * Test case for {@link QueryObjectModelFactory#and(Constraint, Constraint)}
     */
    public void testAnd() throws RepositoryException {
        PropertyExistence c1 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyExistence c2 = qomFactory.propertyExistence(SELECTOR_NAME1, propertyName2);
        And and = qomFactory.and(c1, c2);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint1() instanceof PropertyExistence);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint2() instanceof PropertyExistence);
    }
View Full Code Here

            Map<String, NodeType> selectorMap,
            JackrabbitIndexSearcher searcher, IndexReader reader)
            throws RepositoryException, IOException {
        Predicate filter = Predicate.TRUE;
        if (constraint instanceof And) {
            And and = (And) constraint;
            filter = mapConstraintToQueryAndFilter(
                    query, and.getConstraint1(), selectorMap, searcher, reader);
            Predicate other = mapConstraintToQueryAndFilter(
                    query, and.getConstraint2(), selectorMap, searcher, reader);
            if (filter == Predicate.TRUE) {
                filter = other;
            } else if (other != Predicate.TRUE) {
                filter = Predicates.and(filter, other);
            }
View Full Code Here

    protected void addBooleanConstraint(
            BooleanQuery query, Constraint constraint, Occur occur,
            Map<String, NodeType> selectorMap, JackrabbitIndexSearcher searcher)
            throws RepositoryException, IOException {
        if (occur == MUST && constraint instanceof And) {
            And and = (And) constraint;
            addBooleanConstraint(
                    query, and.getConstraint1(), occur, selectorMap, searcher);
            addBooleanConstraint(
                    query, and.getConstraint2(), occur, selectorMap, searcher);
        } else if (occur == SHOULD && constraint instanceof Or) {
            Or or = (Or) constraint;
            addBooleanConstraint(
                    query, or.getConstraint1(), occur, selectorMap, searcher);
            addBooleanConstraint(
View Full Code Here

            Map<String, NodeType> selectorMap,
            JackrabbitIndexSearcher searcher, IndexReader reader)
            throws RepositoryException, IOException {
        Predicate filter = Predicate.TRUE;
        if (constraint instanceof And) {
            And and = (And) constraint;
            filter = mapConstraintToQueryAndFilter(
                    query, and.getConstraint1(), selectorMap, searcher, reader);
            Predicate other = mapConstraintToQueryAndFilter(
                    query, and.getConstraint2(), selectorMap, searcher, reader);
            if (filter == Predicate.TRUE) {
                filter = other;
            } else if (other != Predicate.TRUE) {
                filter = Predicates.and(filter, other);
            }
View Full Code Here

    protected void addBooleanConstraint(
            BooleanQuery query, Constraint constraint, Occur occur,
            Map<String, NodeType> selectorMap, JackrabbitIndexSearcher searcher)
            throws RepositoryException, IOException {
        if (occur == MUST && constraint instanceof And) {
            And and = (And) constraint;
            addBooleanConstraint(
                    query, and.getConstraint1(), occur, selectorMap, searcher);
            addBooleanConstraint(
                    query, and.getConstraint2(), occur, selectorMap, searcher);
        } else if (occur == SHOULD && constraint instanceof Or) {
            Or or = (Or) constraint;
            addBooleanConstraint(
                    query, or.getConstraint1(), occur, selectorMap, searcher);
            addBooleanConstraint(
View Full Code Here

    @Test
    public void and() throws RepositoryException {
        Constraint c0 = f.propertyExistence("x", "c0");
        Constraint c1 = f.propertyExistence("x", "c1");
        And and = f.and(c0, c1);
        assertEquals(and.getConstraint1(), c0);
        assertEquals(and.getConstraint2(), c1);
    }
View Full Code Here

     * Test case for {@link QueryObjectModelFactory#and(Constraint, Constraint)}
     */
    public void testAnd() throws RepositoryException {
        PropertyExistence c1 = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyExistence c2 = qf.propertyExistence(SELECTOR_NAME1, propertyName2);
        And and = qf.and(c1, c2);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint1() instanceof PropertyExistence);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint2() instanceof PropertyExistence);
    }
View Full Code Here

    private void split(ConstraintSplitInfo constraintSplitInfo, Constraint constraint) throws RepositoryException {
        if (constraint instanceof Not) {
            splitNot(constraintSplitInfo, (Not) constraint);
        } else if (constraint instanceof And) {
            And and = (And) constraint;
            split(constraintSplitInfo, and.getConstraint1());
            split(constraintSplitInfo, and.getConstraint2());
        } else if (constraint instanceof Or) {
            if (isReferencingBothSides(getSelectorNames(constraint))) {
                Or or = (Or) constraint;
                //the problem here is when you split an OR that has both condition sides referencing both join sides.
                // it should split into 2 joins
View Full Code Here

TOP

Related Classes of javax.jcr.query.qom.And

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.