use of org.apache.qpid.server.filter.OrderByExpression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method orderByClause.
public final List<OrderByExpression> orderByClause() throws ParseException {
List<OrderByExpression> returnVal = new ArrayList<OrderByExpression>();
OrderByExpression element;
element = orderByClauseElement();
returnVal.add(element);
label_11: while (true) {
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 38:
;
break;
default:
break label_11;
}
jj_consume_token(38);
element = orderByClauseElement();
returnVal.add(element);
}
jj_consume_token(0);
{
if (true)
return returnVal;
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.OrderByExpression in project qpid-broker-j by apache.
the class ConfiguredObjectFilterParser method orderByClauseElement.
public final OrderByExpression orderByClauseElement() throws ParseException {
Expression expr;
OrderByExpression orderByExpr;
OrderByExpression.Order order = OrderByExpression.Order.ASC;
expr = addExpression();
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ASC:
case DESC:
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ASC:
jj_consume_token(ASC);
break;
case DESC:
jj_consume_token(DESC);
order = OrderByExpression.Order.DESC;
break;
default:
jj_consume_token(-1);
throw new ParseException();
}
break;
default:
;
}
{
if (true)
return new OrderByExpression(expr, order);
}
throw new Error("Missing return statement in function");
}
use of org.apache.qpid.server.filter.OrderByExpression in project qpid-broker-j by apache.
the class ConfiguredObjectQuery method parseOrderByClause.
private List<OrderByExpression> parseOrderByClause(final String orderByClause, final HeadersAndValueExpressions headersAndValue) {
final List<OrderByExpression> orderByExpressions;
ConfiguredObjectFilterParser parser = new ConfiguredObjectFilterParser();
parser.setConfiguredObjectExpressionFactory(new ConfiguredObjectExpressionFactory() {
@Override
public ConfiguredObjectExpression createConfiguredObjectExpression(final String propertyName) {
if (headersAndValue.hasHeader(propertyName)) {
Expression expression = headersAndValue.getValueExpressionForHeader(propertyName);
return object -> expression.evaluate(object);
} else {
return super.createConfiguredObjectExpression(propertyName);
}
}
});
try {
orderByExpressions = parser.parseOrderBy(orderByClause);
} catch (ParseException | TokenMgrError e) {
throw new SelectorParsingException("Unable to parse orderBy clause", e);
}
return orderByExpressions;
}
use of org.apache.qpid.server.filter.OrderByExpression in project qpid-broker-j by apache.
the class ConfiguredObjectQueryTest method testArithmeticStatementInOrderBy.
public void testArithmeticStatementInOrderBy() {
final List<OrderByExpression> orderByExpressions;
String orderByClause = "a + b";
ConfiguredObjectFilterParser parser = new ConfiguredObjectFilterParser();
parser.setConfiguredObjectExpressionFactory(new ConfiguredObjectExpressionFactory());
try {
orderByExpressions = parser.parseOrderBy(orderByClause);
assertEquals(1, orderByExpressions.size());
} catch (ParseException | TokenMgrError e) {
throw new SelectorParsingException("Unable to parse orderBy clause", e);
}
}
Aggregations