Search in sources :

Example 1 with SortOrder

use of org.apache.cayenne.query.SortOrder in project cayenne by apache.

the class QueryDescriptorLoader method addOrdering.

public void addOrdering(String path, String descending, String ignoreCase) {
    if (orderings == null) {
        orderings = new ArrayList<>();
    }
    if (path != null && isBlank(path)) {
        path = null;
    }
    boolean isDescending = "true".equalsIgnoreCase(descending);
    boolean isIgnoringCase = "true".equalsIgnoreCase(ignoreCase);
    SortOrder order;
    if (isDescending) {
        order = isIgnoringCase ? SortOrder.DESCENDING_INSENSITIVE : SortOrder.DESCENDING;
    } else {
        order = isIgnoringCase ? SortOrder.ASCENDING_INSENSITIVE : SortOrder.ASCENDING;
    }
    orderings.add(new Ordering(path, order));
}
Also used : Ordering(org.apache.cayenne.query.Ordering) SortOrder(org.apache.cayenne.query.SortOrder)

Aggregations

Ordering (org.apache.cayenne.query.Ordering)1 SortOrder (org.apache.cayenne.query.SortOrder)1