Hi Stephan
On 06/12/13 14:17, Klevenz, Stephan wrote:
Hi Sergey,
try this:
FilterExpression filterExpression = UriParser.parseFilter(null, null,
"Name eq 'Milk' and Price lt '2.55M'");
The metadata objects are optional and can be null. If they are set then
the parser will validate the filter.
And you'll find a tutorial about how to proceed with the expression here:
http://olingo.incubator.apache.org/doc/tutorials/Olingo_Tutorial_AdvancedRe
ad_FilterVisitor.html
Let us know if you require more information.
I think this is exactly what we need, thanks a mill, how did I miss that
link ? :-)
Cheers, Sergey
Regards,
Stephan
On 06.12.13 11:28, "Sergey Beryozkin" <[email protected]> wrote:
Hi
This may be a user-level question but I haven't been able to find a
users forum.
I've checked several Olingo titorials, they are very good and detailed
at explaining how custom extensions and providers can be registered with
Olingo core for Olingo to drive the proper exposition of the data.
What I'd like to understand, and I think this can be of interest to many
users planning to do some work with the help of Olingo, is how to get
Olingo Parser and other relevant API used directly.
For example, suppose I write a standalone JAX-RS application which has
no OData support yet:
@GET
@Path("/books/{id}")
public Book getBookById(@PathParam("id") String id) {
//
}
Now I'd like to provide the way for users to search for Books. And I'd
like to try OData, so I add another method to my JAX-RS resource:
@GET
@Path("/books")
public List<Book> findBooks(@QueryParam("$filter") String odataQuery) {
}
In order to implement this method I'd like to know how I can use OLingo
parser to parse a captured $filter expression and how to introspect the
parser output in order to build an actual DB query, lets say SQL one.
Perhaps a tutorial can be added ?
For example, lets say a findBooks() Method captures a
"Name eq 'Milk' and Price lt '2.55M'"
expression. How would one go and convert it to SQL with the help of
Olingo withing the *existing* JAX-RS application ?
Thanks, Sergey