0

How to pass a raw expression to ExpressionVisitor implementation of Odata4 using olingo4. This is how it was done in olingo2 JDBC Visitor Filter

String rawExpression = "'a' eq 'b' or ('c' eq 'd' and 'b' eq 'd')";
FilterExpression expression = UriParser.parseFilter(null, null, rawExpression);
String whereClauseSimple = (String) expression.accept(new JdbcSimpleStringVisitor());
SkyWalker
  • 28,384
  • 14
  • 74
  • 132
Tirtha
  • 145
  • 2
  • 17

1 Answers1

1

There is currently (released version 4.2.0) no API exposure for this functionality.

You could set a dependency to the server-core module directly and call "new Parser(edm,odata).parseUri(final String path, final String query, final String fragment)"

or use the filter parser direclty by creating a UriTokenizer and then calling "FilterParserparse(UriTokenizer tokenizer, final EdmType referencedType, final Collection crossjoinEntitySetNames, final Map aliases)"

chrisam
  • 553
  • 2
  • 4
  • Thanks @chrisam ! I am trying to generate Elasticsearch query from `odata4` $filters. I am not implementing the whole `oData 4` protocol. I am looking for a way to parse the $filter string and get the ExpressionVisitor working. Is there a way I can do it without passing edm or EdmType in FilterParserparse or Parser method in Olingo 4.2. – Tirtha Jul 15 '16 at 18:38
  • 1
    @Tirtha No there is not. The parser requires an EDM in V4. – chrisam Jul 27 '16 at 08:25