Search in sources :

Example 6 with OrderingImpl

use of org.apache.jackrabbit.oak.query.ast.OrderingImpl in project jackrabbit-oak by apache.

the class QueryImpl method getSortOrder.

private List<OrderEntry> getSortOrder(FilterImpl filter) {
    if (orderings == null) {
        return null;
    }
    ArrayList<OrderEntry> sortOrder = new ArrayList<OrderEntry>();
    for (OrderingImpl o : orderings) {
        DynamicOperandImpl op = o.getOperand();
        OrderEntry e = op.getOrderEntry(filter.getSelector(), o);
        if (e == null) {
            continue;
        }
        sortOrder.add(e);
    }
    if (sortOrder.size() == 0) {
        return null;
    }
    return sortOrder;
}
Also used : DynamicOperandImpl(org.apache.jackrabbit.oak.query.ast.DynamicOperandImpl) OrderEntry(org.apache.jackrabbit.oak.spi.query.QueryIndex.OrderEntry) OrderingImpl(org.apache.jackrabbit.oak.query.ast.OrderingImpl) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList)

Example 7 with OrderingImpl

use of org.apache.jackrabbit.oak.query.ast.OrderingImpl in project jackrabbit-oak by apache.

the class UnionQueryImpl method toString.

@Override
public String toString() {
    StringBuilder buff = new StringBuilder();
    buff.append(left.toString());
    buff.append(" union ");
    if (unionAll) {
        buff.append("all ");
    }
    buff.append(right.toString());
    if (orderings != null) {
        buff.append(" order by ");
        int i = 0;
        for (OrderingImpl o : orderings) {
            if (i++ > 0) {
                buff.append(", ");
            }
            buff.append(o);
        }
    }
    return buff.toString();
}
Also used : OrderingImpl(org.apache.jackrabbit.oak.query.ast.OrderingImpl)

Aggregations

OrderingImpl (org.apache.jackrabbit.oak.query.ast.OrderingImpl)7 DynamicOperandImpl (org.apache.jackrabbit.oak.query.ast.DynamicOperandImpl)3 ArrayList (java.util.ArrayList)2 OrderEntry (org.apache.jackrabbit.oak.spi.query.QueryIndex.OrderEntry)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 ParseException (java.text.ParseException)1 RepositoryException (javax.jcr.RepositoryException)1 BindVariableValueImpl (org.apache.jackrabbit.oak.query.ast.BindVariableValueImpl)1 ColumnImpl (org.apache.jackrabbit.oak.query.ast.ColumnImpl)1 PropertyValueImpl (org.apache.jackrabbit.oak.query.ast.PropertyValueImpl)1 IndexPlan (org.apache.jackrabbit.oak.spi.query.QueryIndex.IndexPlan)1