Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.Selector


            assertEquals("Wrong operator", operator, comp.getOperator());
        }
    }

    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


        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }

    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);
View Full Code Here

        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }

    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);
View Full Code Here

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

    public void testCreateQueryWithConstraintOrderingAndColumn() 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);
        Column column = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
        QueryObjectModel qom = qf.createQuery(selector, propExist,
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#join(Source, Source, String, JoinCondition)}
     */
    public void testJoin() throws RepositoryException {
        Selector s1 = qf.selector(ntBase, SELECTOR_NAME1);
        Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1);
        JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
            String joinType = (String) it.next();
            Join join = qf.join(s1, s2, joinType, cond);
            assertTrue("Not a selector source", join.getLeft() instanceof Selector);
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#selector(String, String)}
     */
    public void testSelector() throws RepositoryException {
        Selector selector = qf.selector(ntBase, SELECTOR_NAME1);
        assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
        assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#selector(String, String)}
     */
    public void testSelectorWithName() throws RepositoryException {
        Selector selector = qf.selector(ntBase, SELECTOR_NAME1);
        assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
        assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
    }
View Full Code Here

    }

    private Map<String, NodeType> getSelectorNames(Source source)
            throws RepositoryException {
        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return Collections.singletonMap(selector.getSelectorName(),
                    getNodeType(selector));
        } else if (source instanceof Join) {
            Join join = (Join) source;
            Map<String, NodeType> map = new LinkedHashMap<String, NodeType>();
            map.putAll(getSelectorNames(join.getLeft()));
View Full Code Here

    }

    private Set<String> getSelectorNames(Source source)
            throws RepositoryException {
        if (source instanceof Selector) {
            Selector selector = (Selector) source;
            return Collections.singleton(selector.getSelectorName());
        } else if (source instanceof Join) {
            Join join = (Join) source;
            Set<String> set = new LinkedHashSet<String>();
            set.addAll(getSelectorNames(join.getLeft()));
            set.addAll(getSelectorNames(join.getRight()));
View Full Code Here

            return readAny();
        }
    }

    private Source parseSource() throws RepositoryException {
        Selector selector = parseSelector();
        selectors.add(selector);
        Source source = selector;
        while (true) {
            JoinType type;
            if (readIf("RIGHT")) {
View Full Code Here

TOP

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

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.