Examples of QueryObjectModel


Examples of javax.jcr.query.qom.QueryObjectModel

        }
    }

    public void testCreateQuery() throws RepositoryException {
        Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
        QueryObjectModel qom = qf.createQuery(selector, null, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertNull("Constraint must be null", qom.getConstraint());
        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 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, propertyName1);
        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

Examples of javax.jcr.query.qom.QueryObjectModel

        assertEquals("Wrong size of columns", 1, qom.getColumns().length);
    }

    public void testCreateQueryFromSource() throws RepositoryException {
        Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
        QueryObjectModel qom = qf.createQuery(selector, null, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertNull("Constraint must be null", qom.getConstraint());
        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 testCreateQueryFromSourceWithConstraint() throws RepositoryException {
        Source 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 testCreateQueryFromSourceWithConstraintAndOrdering() throws RepositoryException {
        Source 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

        Source 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, propertyName1);
        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

Examples of javax.jcr.query.qom.QueryObjectModel

    public void testSelector() throws RepositoryException {
        // make sure there's at least one node with this node type
        testRootNode.addNode(nodeName1, testNodeType);
        superuser.save();
        QueryObjectModel qom = qf.createQuery(
                qf.selector(testNodeType, "s"), null, null, null);
        forQOMandSQL2(qom, new Callable() {
            public Object call(Query query) throws RepositoryException {
                NodeIterator it = query.execute().getNodes();
                while (it.hasNext()) {
View Full Code Here

Examples of javax.jcr.query.qom.QueryObjectModel

    }

    private String[] getBindVariableNames(Query query) {
        List<String> names = new ArrayList<String>();
        if (query instanceof QueryObjectModel) {
            QueryObjectModel qom = (QueryObjectModel) query;
            collectBindVariableNames(qom.getConstraint(), names);
        } else {
            // TODO: use when available
            // names.addAll(Arrays.asList(q.getBindVariableNames()));
        }
        return names.toArray(new String[names.size()]);
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.