[ https://issues.apache.org/jira/browse/OLINGO-1120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16964543#comment-16964543 ]
Odair Brentam commented on OLINGO-1120: --------------------------------------- Nevermind, olingo 4 process the "and" and "or" operators in the correct order when calling visitBinaryOperator method. so lets say you need to add parenthesis because you are building an sql query, just do something as follows. if (operator == BinaryOperatorKind.AND if (operator == BinaryOperatorKind.AND || operator == BinaryOperatorKind.OR) { return " (" + left + operator.toString() + right + ") "; } > Is grouping in $filter with "(" and ")" possible? > -------------------------------------------------- > > Key: OLINGO-1120 > URL: https://issues.apache.org/jira/browse/OLINGO-1120 > Project: Olingo > Issue Type: Question > Components: odata4-server > Affects Versions: (Java) V4 4.3.0 > Reporter: Werner Mueller > Priority: Major > > I'm implementing an OData-server-application with Version v4.3.0 of Olingo. > According to > https://olingo.apache.org/doc/odata4/tutorials/sqo_f/tutorial_sqo_f.html > I created an ExpressionVisitor > to construct a valid JDBC/SQL-where constraint. > I had a look to > https://olingo.apache.org/doc/odata2/tutorials/Olingo_Tutorial_AdvancedRead_FilterVisitor.html > also. > My problem is with grouping. > OData states that the Operators "(" and ")" should have the highest > precedence (5.1.1.9 Operator Precedence, > http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html) > How can I handle grouping with the ExpressionVisitor? > These are my urls for testing: > http://localhost:8080/Odata.svc/SomeEnittySet?$filter=(id gt 5 or shortName > ne 'xxx' or name eq 'test') or (name eq 'xxx' and id lt 567) > and > http://localhost:8080/Odata.svc/SomeEnittySet?$filter=(id gt 5 or shortName > ne 'xxx' or name eq 'test') or name eq 'xxx' and id lt 567 -- This message was sent by Atlassian Jira (v8.3.4#803005)