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));
}