I'm trying to create a filter function for my needs, and I've run into a bit of a problem with the OptionsQueryParser.parseFilter(s) function. There seem to be several examples from the OData version 4 specification which it cannot parse. Specifically the following fail:
$filter="Name eq 'Milk' and Price lt 2.55"
e.getMessage()=Unable to read expression with tokens: [[2], [.], [55]]
$filter="Name eq 'Milk' or Price lt 2.55"
e.getMessage()=Unable to read expression with tokens: [[2], [.], [55]]
$filter="style has Sales.Pattern'Yellow'"
e.getMessage()=Unable to read expression with tokens: [[style], [ ], [has], [ ], [Sales], [.], [Pattern], ['Yellow']]
$filter="Price add 2.45 eq 5.00"
e.getMessage()=Unable to read expression with tokens: [[2], [.], [45]]
$filter="Price sub 0.55 eq 2.00"
e.getMessage()=Unable to read expression with tokens: [[0], [.], [55]]
$filter="Price mul 2.0 eq 5.10"
e.getMessage()=Unable to read expression with tokens: [[2], [.], [0]]
$filter="Price div 2.55 eq 1"
e.getMessage()=Unable to read expression with tokens: [[2], [.], [55]]
$filter="contains(CompanyName,'Alfreds')"
e.getMessage()=Unable to read expression with tokens: [[CompanyName], [,], ['Alfreds']]
$filter="fractionalseconds(BirthDate) lt 0.1"
e.getMessage()=Unable to read expression with tokens: [[fractionalseconds], [(][BirthDate][)]]
$filter="isof(NorthwindModel.BigOrder)"
e.getMessage()=Unable to read expression with tokens: [[NorthwindModel], [.], [BigOrder]]
$filter="isof($it,NorthwindModel.BigOrder)"
e.getMessage()=Unable to tokenize: isof($it,NorthwindModel.BigOrder) current: 5 rem: $it,NorthwindModel.BigOrder)
$filter="isof(Customer,NorthwindModel.VIPCustomer)"
e.getMessage()=Unable to read expression with tokens: [[NorthwindModel], [.], [VIPCustomer]]
I've also commented out all the statements that print to the console (leaving only those that print to syserr), yet I still get two strings printed to the console:
My code is attached. I think this is a fault in odata4j's implementation of OptionsQueryParser.parseFilter(), but I'm hoping that there is something I should be doing differently?
Mark Tiggas