Examples of Ordering


Examples of javax.jcr.query.qom.Ordering

    /**
     * Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
     */
    public void testOrderingDescending() throws RepositoryException {
        PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering desc = qf.descending(op);
        assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING",
                QueryObjectModelConstants.JCR_ORDER_DESCENDING, desc.getOrder());
        assertTrue("Not a PropertyValue operand", desc.getOperand() instanceof PropertyValue);
    }
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    }

    private Ordering[] parseOrder() throws RepositoryException {
        ArrayList<Ordering> orderList = new ArrayList<Ordering>();
        do {
            Ordering ordering;
            DynamicOperand op = parseDynamicOperand();
            if (readIf("DESC")) {
                ordering = factory.descending(op);
            } else {
                readIf("ASC");
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    /**
     * Test case for {@link QueryObjectModelFactory#ascending(DynamicOperand)}
     */
    public void testOrderingAscending() throws RepositoryException {
        PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering asc = qf.ascending(op);
        assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_ASCENDING",
                QueryObjectModelConstants.JCR_ORDER_ASCENDING, asc.getOrder());
        assertTrue("Not a PropertyValue operand", asc.getOperand() instanceof PropertyValue);
    }
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

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

Examples of javax.jcr.query.qom.Ordering

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

Examples of javax.jcr.query.qom.Ordering

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

Examples of javax.jcr.query.qom.Ordering

    public void testCreateQueryFromSourceWithConstraintOrderingAndColumn() 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);
        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);
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    /**
     * Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
     */
    public void testOrderingDescending() throws RepositoryException {
        PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
        Ordering desc = qf.descending(op);
        assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING",
                QueryObjectModelConstants.JCR_ORDER_DESCENDING, desc.getOrder());
        assertTrue("Not a PropertyValue operand", desc.getOperand() instanceof PropertyValue);
    }
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    }

    private Ordering[] parseOrder() throws RepositoryException {
        ArrayList<Ordering> orderList = new ArrayList<Ordering>();
        do {
            Ordering ordering;
            DynamicOperand op = parseDynamicOperand();
            if (readIf("DESC")) {
                ordering = factory.descending(op);
            } else {
                readIf("ASC");
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    }

    @Test
    public void ascending() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Ordering o = f.ascending(p);
        assertEquals(p, o.getOperand());
        assertEquals(QueryObjectModelConstants.JCR_ORDER_ASCENDING, o.getOrder());
        assertEquals("[selectorName].[propertyName]", p.toString());
    }
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.