Ability to use order(<orderByClause>) on filterMany() (related to #1943) #1964

This commit is contained in:
rob bygrave
2020-03-03 22:31:01 +13:00
parent 4767aff046
commit ddf3c753d6
15 changed files with 49 additions and 42 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ public interface ExpressionList<T> {
* optional asc and desc keywords representing ascending and descending order
* respectively.
*/
Query<T> order(String orderByClause);
ExpressionList<T> order(String orderByClause);
/**
* Return the OrderBy so that you can append an ascending or descending
@@ -340,8 +340,9 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
}
@Override
public Query<T> order(String orderByClause) {
return query.order(orderByClause);
public ExpressionList<T> order(String orderByClause) {
query.order(orderByClause);
return this;
}
@Override
@@ -28,6 +28,7 @@ public class FilterExpressionList<T> extends DefaultExpressionList<T> {
private int firstRow;
private int maxRows;
private String orderByClause;
public FilterExpressionList(FilterExprPath pathPrefix, FilterExpressionList<T> original) {
super(null, original.expr, null, original.getUnderlyingList());
@@ -123,21 +124,6 @@ public class FilterExpressionList<T> extends DefaultExpressionList<T> {
throw new PersistenceException(notAllowedMessage);
}
@Override
public OrderBy<T> order() {
return rootQuery.order();
}
@Override
public Query<T> order(String orderByClause) {
return rootQuery.order(orderByClause);
}
@Override
public Query<T> orderBy(String orderBy) {
return rootQuery.orderBy(orderBy);
}
@Override
public Query<T> query() {
return rootQuery;
@@ -153,6 +139,22 @@ public class FilterExpressionList<T> extends DefaultExpressionList<T> {
return rootQuery.setMapKey(mapKey);
}
@Override
public OrderBy<T> order() {
return rootQuery.order();
}
@Override
public Query<T> orderBy(String orderBy) {
return rootQuery.orderBy(orderBy);
}
@Override
public ExpressionList<T> order(String orderByClause) {
this.orderByClause = orderByClause;
return this;
}
@Override
public ExpressionList<T> setMaxRows(int maxRows) {
this.maxRows = maxRows;
@@ -183,6 +185,9 @@ public class FilterExpressionList<T> extends DefaultExpressionList<T> {
if (maxRows > 0) {
query.setMaxRows(maxRows);
}
if (orderByClause != null) {
query.order(orderByClause);
}
}
}
@@ -799,7 +799,7 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
}
@Override
public Query<T> order(String orderByClause) {
public ExpressionList<T> order(String orderByClause) {
return exprList.order(orderByClause);
}