Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.And


    private void splitNot(ConstraintSplitInfo constraintSplitInfo, Not not) throws RepositoryException {
        Constraint constraint = not.getConstraint();
        if (constraint instanceof Not) {
            split(constraintSplitInfo, ((Not) constraint).getConstraint());
        } else if (constraint instanceof And) {
            And and = (And) constraint;
            split(constraintSplitInfo, factory.or(factory.not(and.getConstraint1()),
                    factory.not(and.getConstraint2())));
        } else if (constraint instanceof Or) {
            Or or = (Or) constraint;
            split(constraintSplitInfo, factory.and(factory.not(or.getConstraint1()),
                    factory.not(or.getConstraint2())));
        } else {
View Full Code Here


     *             if the constraint type is unknown
     */
    private Set<String> getSelectorNames(Constraint constraint)
            throws UnsupportedRepositoryOperationException {
        if (constraint instanceof And) {
            And and = (And) constraint;
            return getSelectorNames(and.getConstraint1(), and.getConstraint2());
        } else if (constraint instanceof Or) {
            Or or = (Or) constraint;
            return getSelectorNames(or.getConstraint1(), or.getConstraint2());
        } else if (constraint instanceof Not) {
            Not not = (Not) constraint;
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

            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

    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);
        assertEquals("([x].[c0] IS NOT NULL) AND ([x].[c1] IS NOT NULL)", and.toString());
    }
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

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.