Hi

I've had a brief private discussion with Andy but given that we are good CXF
citizens :-) we've moving the discussion to the dev list.

CXF JAX-RS offers the Search extensions [1] which let capture and simplify
working with the FIQL query expressions.
Arul has a nice post about it [2].

What we'd like to do next is to simplify building the FIQL expressions (or
other query language expressions if needed) on the client side so that once
the input is collected we just pass the data to the builder and have the
result passed to WebClients or proxies.

The idea is to follow the builder pattern popular in the JAX-RS space :

SearchConditionBuilder builder = SearchConditionBuilder.newInstance();

// a=b & c >d
builder.query("a=b").query("c>d").build()

builder.query("a=b").query("c>d")

is equivalent to

builder.query("a=b").and().query("c>d")

// a=b || c >d
builder.query("a=b").or().query("c>d").build()

Here the user is passing simple literal expressions, with the relevant
query(String s) implementation enforcing that
after removing all the spaces the characters preceding the '='/'>'/etc sign
is the name of the field.

or

builder.query(new PrimitiveStatement("a", "b", '=')).or().query(new
PrimitiveStatement("c", "d", '>')).build()

or() is a join operation allowing to build something like (a==b && c==f) ||
(....)

finally,

builder.query(new Book()).build()

will result in the Book instance's getters being invoked and the complex
query consisting of multiple simple experssions joined by 'and' being built.

The builder should provide a simple and intuitiv given that it's unlikely
users will build uber-complex search queries.

The end result is we will do something like :

// collect user input
String query = convertToFiqlUsingBuilder(userInput);

webClient.query(query).get();

Let us know please if you have any comments
thanks, Sergey


[1]
http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-FIQLsearchqueries
[2] http://aruld.info/sakila-restful-search-using-cxf-fiql/

Reply via email to