cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject SearchContext and plain expressions
Date Tue, 22 Mar 2011 15:42:50 GMT
Hi

SearchContext extension can be used today to make it easy to work with FIQL
expressions, ex:

@Context SearchContext context;
SearchCondition<Book> sc = context.getSearchCondition(Book.class);

List<Book> matchedBooks = sc.findAll(booksList);
// or
if (sc.isMet(book)) {
    // matched
}

// or

sc.visit(new SQLPrinterVisitor())


If you look at this code, there's nothing specific about FIQL here, it is
just that with FIQL this code is much more interesting due to FIQL letting
users express '<', '>', etc with ease.

This is one part of the story. Another one is that most users are likely
using plain old '?a=b&c=d' queries for searching. Thus adopting the above
code for the 'legacy' applications is problematic - it may actually never
make sense in some cases, but it might in other ones. So I'd just like the
above code to work for plain expressions as well - so we can have legacy
clients sending simple queries and newer clients which may be using FIQL for
issuing richer queries, with this code working for both cases.

So we just need a simple parser which, given a MultivaluedMap<String,
List<String>> map representing a captured plain expression will produce:

1. a=b&c=e

Complex AndSearchCondition with two PrimitiveSearchConditions

2. a=b&c=e&c=d

Complex AndSearchCondition with one PrimitiveSearchConditions (a=b) and one
complex OrSearchCondition with two PrimitiveSearchConditions (c=e&c=d)

This is it. The goal is to facilitate the adoption of the SearchContext
extension across the board.

Comments are welcome

thanks, Sergey

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message