Examples of Ordering


Examples of javax.jcr.query.qom.Ordering

    }

    @Test
    public void descending() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Ordering o = f.descending(p);
        assertEquals(p, o.getOperand());
        assertEquals(QueryObjectModelConstants.JCR_ORDER_DESCENDING, o.getOrder());
        assertEquals("[selectorName].[propertyName] DESC", o.toString());
    }
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

        Selector s = f.selector("nt:file", "x");
        BindVariableValue b = f.bindVariable("var");
        Constraint c = f.propertyExistence("x", "c");
        PropertyValue p = f.propertyValue("x", "propertyName");
        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());
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

    }

    @Test
    public void descending() throws RepositoryException {
        PropertyValue p = f.propertyValue("selectorName", "propertyName");
        Ordering o = f.descending(p);
        assertEquals(p, o.getOperand());
        assertEquals(QueryObjectModelConstants.JCR_ORDER_DESCENDING, o.getOrder());
    }
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

        Selector s = f.selector("nodeTypeName", "x");
        BindVariableValue b = f.bindVariable("var");
        Constraint c = f.propertyExistence("x", "c");
        PropertyValue p = f.propertyValue("x", "propertyName");
        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());
View Full Code Here

Examples of javax.jcr.query.qom.Ordering

     * @throws RepositoryException if an error occurs.
     */
    protected QueryObjectModel createQOM(boolean ascending)
            throws RepositoryException {
        DynamicOperand op = createOrderingOperand();
        Ordering ordering;
        if (ascending) {
            ordering = qf.ascending(op);
        } else {
            ordering = qf.descending(op);
        }
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 org.apache.cayenne.query.Ordering

        }

        Iterator<Ordering> it = ((SelectQuery) q).getOrderings().iterator();

        while (it.hasNext()) {
            Ordering ord = it.next();

            if (ord.isCaseInsensitive()) {
                out.append("UPPER(");
            }

            Expression exp = ord.getSortSpec();

            if (exp.getType() == Expression.OBJ_PATH) {
                appendObjPath(exp);
            }
            else if (exp.getType() == Expression.DB_PATH) {
                appendDbPath(exp);
            }
            else {
                throw new CayenneRuntimeException("Unsupported ordering expression: "
                        + exp);
            }

            // Close UPPER() modifier
            if (ord.isCaseInsensitive()) {
                out.append(")");
            }

            orderByColumnList.add(out.toString());

            // "ASC" is a noop, omit it from the query
            if (!ord.isAscending()) {
                out.append(" DESC");
            }

            if (it.hasNext()) {
                out.append(", ");
View Full Code Here

Examples of org.apache.cayenne.query.Ordering

    }

    public void testSuccessLockingOnMixed() throws Exception {
        createTestData("testLockingOnMixed");
        SelectQuery query = new SelectQuery(SimpleLockingTestEntity.class);
        query.addOrdering(new Ordering("db:LOCKING_TEST_ID", SortOrder.ASCENDING));

        List allObjects = context.performQuery(query);
        assertEquals(3, allObjects.size());

        SimpleLockingTestEntity object1 = (SimpleLockingTestEntity) allObjects.get(0);
View Full Code Here

Examples of org.apache.cayenne.query.Ordering

        // case insensitive ordering appends extra columns
        // to the query when query is using DISTINCT...
        // verify that the result is not messed up

        SelectQuery query = new SelectQuery(Artist.class);
        Ordering ordering = new Ordering(
                Artist.ARTIST_NAME_PROPERTY,
                SortOrder.ASCENDING_INSENSITIVE);
        query.addOrdering(ordering);
        query.setDistinct(true);
View Full Code Here

Examples of org.apache.cayenne.query.Ordering

    public void onRender() {
        super.onRender();

        if (getSchedulerService() != null) {
            List<JobAndSimpleTrigger> rowList = getSchedulerService().getJobAndTriggerList();
            Collections.sort(rowList, new Ordering("job.name", Ordering.ASC));
            table.setRowList(rowList);
        }
    }
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.