Examples of QueryObjectModel


Examples of javax.jcr.query.qom.QueryObjectModel

    private static void collectSelectorNames(Query query,
                                             QueryResult result,
                                             List<String> sn) throws RepositoryException {
        if (query instanceof QueryObjectModel) {
            QueryObjectModel qom = (QueryObjectModel) query;
            collectSelectorNames(qom.getSource(), sn);
        } else {
            sn.addAll(Arrays.asList(result.getSelectorNames()));
        }
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

    private static void collectSelectorNames(Query query,
                                             QueryResult result,
                                             List<String> sn) throws RepositoryException {
        if (query instanceof QueryObjectModel) {
            QueryObjectModel qom = (QueryObjectModel) query;
            collectSelectorNames(qom.getSource(), sn);
        } else {
            sn.addAll(Arrays.asList(result.getSelectorNames()));
        }
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

                f.selector(NodeType.NT_BASE, null).toString());
       
        Source source1 = f.selector(NodeType.NT_BASE, "selector");
        Column[] columns = new Column[] { f.column("selector", null, null) };
        Constraint constraint2 = f.childNode("selector", "/");
        QueryObjectModel qom = f.createQuery(source1, constraint2, null,
                columns);
        assertEquals("select [selector].* from " +
                "[nt:base] AS [selector] " +
                "where ISCHILDNODE([selector], [/])", qom.toString());
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

        c = f.and(f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, b), c);
        Ordering o = f.ascending(p);
        Column col = f.column("x", "propertyName", "columnName");
        Ordering[] ords = new Ordering[]{o};
        Column[] cols = new Column[]{col};
        QueryObjectModel q = f.createQuery(s, c, ords, cols);
        assertEquals(Query.JCR_JQOM, q.getLanguage());
        String[] bv = q.getBindVariableNames();
        assertEquals(1, bv.length);
        assertEquals("var", bv[0]);
        assertEquals(s, q.getSource());
        assertEquals(c, q.getConstraint());
        assertEquals(o, q.getOrderings()[0]);
        assertEquals(col, q.getColumns()[0]);
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

        c = f.and(f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, b), c);
        Ordering o = f.ascending(p);
        Column col = f.column("selectorName", "propertyName", "columnName");
        Ordering[] ords = new Ordering[]{o};
        Column[] cols = new Column[]{col};
        QueryObjectModel q = f.createQuery(s, c, ords, cols);
        // assertEquals(Query.JCR_SQL2, q.getLanguage());
        String[] bv = q.getBindVariableNames();
        assertEquals(1, bv.length);
        assertEquals("var", bv[0]);
        assertEquals(s, q.getSource());
        assertEquals(c, q.getConstraint());
        assertEquals(o, q.getOrderings()[0]);
        assertEquals(col, q.getColumns()[0]);
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

            } else {
                qomBuilder.getColumns().add(factory.column("event", prop, val));               
            }
        }

        QueryObjectModel qom = qomBuilder.createQOM();
        QueryResultWrapper res = (QueryResultWrapper) qom.execute();
        return res;
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

                    QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO,
                    factory.literal(session.getValueFactory().createValue(val))));
        }


        QueryObjectModel qom = qomBuilder.createQOM();
        QueryResultWrapper res = (QueryResultWrapper) qom.execute();
        return res;
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

    }

    public void testCreateQueryWithConstraint() throws RepositoryException {
        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
        QueryObjectModel qom = qf.createQuery(
                selector, propExist, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

    public void testCreateQueryWithConstraintAndOrdering() throws RepositoryException {
        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering ordering = qf.ascending(propValue);
        QueryObjectModel qom = qf.createQuery(selector, propExist,
                new Ordering[]{ordering}, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
        PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
        PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering ordering = qf.ascending(propValue);
        Column column = qf.column(SELECTOR_NAME1, propertyName1, null);
        QueryObjectModel qom = qf.createQuery(selector, propExist,
                new Ordering[]{ordering}, new Column[]{column});
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 1, qom.getColumns().length);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.