use of com.github.rutledgepaulv.qbuilders.visitors.RSQLVisitor in project downlords-faf-client by FAForever.
the class SearchController method buildQuery.
/**
* Builds the query string if possible, returns empty string if not. A query string can not be built if the user
* selected no or invalid values.
*/
private String buildQuery(SpecificationController initialSpecification, List<LogicalNodeController> queryNodes) {
QBuilder qBuilder = new QBuilder();
Optional<Condition> condition = initialSpecification.appendTo(qBuilder);
if (!condition.isPresent()) {
return "";
}
for (LogicalNodeController queryNode : queryNodes) {
Optional<Condition> currentCondition = queryNode.appendTo(condition.get());
if (!currentCondition.isPresent()) {
break;
}
condition = currentCondition;
}
return (String) condition.get().query(new RSQLVisitor());
}
Aggregations