The odata4j AppEngineConsumerExample demonstrates how to filter entities on string and numeric values with code similar to the following:
reportEntity("\nNon-discontinued product with reorderLevel > 25 (two filter predicates): " ,
c.getEntities("Product")
.filter("reorderLevel gt 25 and discontinued eq false")
.top(1)
.execute().first());
I'm fairly new to Java (my background is .NET/C#), but the above makes sense. However, I'm unsure how to do something similar for dates. The dates coming from my WCF OData service are formatted as "yyyy-MM-dd'T'HH:mm:ss".
Thanks in advance for your help!
It turns out this is a function of OData itself rather than odata4j. The string passed to the filter function in odata4j is the same expression that would be passed via a URL. I found tons of filter examples on the Netflix OData Catalog page.
To filter dates, use something like this:
reportEntity("\nProduct with order date greater than March 1, 2010: " ,
c.getEntities("Product")
.filter("OrderDate gt datetime'2010-03-01'")
.top(1)
.execute().first());