use of org.apache.olingo.server.api.uri.queryoption.OrderByItem in project teiid by teiid.
the class ODataSQLBuilder method processOrderBy.
private OrderBy processOrderBy(OrderBy orderBy, List<OrderByItem> orderByItems, DocumentNode resource) throws TeiidException {
for (OrderByItem obitem : orderByItems) {
ODataExpressionToSQLVisitor visitor = new ODataExpressionToSQLVisitor(resource, false, getUriInfo(), this.metadata, this.odata, this.nameGenerator, this.params, this.parseService);
Expression expr = visitor.getExpression(obitem.getExpression());
if (expr instanceof ElementSymbol) {
orderBy.addVariable(expr, !obitem.isDescending());
} else {
AliasSymbol alias = new AliasSymbol("_orderByAlias", expr);
orderBy.addVariable(alias, !obitem.isDescending());
visitor.getEntityResource().addProjectedColumn(alias, EdmInt32.getInstance(), null, false);
}
}
return orderBy;
}
Aggregations