Gary, Gary Bentley wrote:
Along the lines of:#foreach( $mud in $mudsOnSpecial where $customer.hasPurchased($mud) order by $mud.price)
This looks like mixing SQL-ish syntax with Java collections, which is precisely what JoSQL was designed to do. Why extend Velocity when you can simply use JoSQL as it was intended:
#foreach($mud in $josql.execute("SELECT [whatever] FROM mud.Type WHERE $customer.hasPurchased($mud)", $mudsOnSpecial))
... with with your muds #endthen you just have to implement a JoSQL tool and shove it into the velocity context. You tool can do something like this:
public Iterator execute(String query, Object (or List?) source) { Query q = new Query(); q.parse(query); QueryResults qr = q.execute(source); List res = qr.getResults(); return res.iterator(); } I think this would be a whole lot easier than re-writing Velocity.Since this capability is orthogonal to Velocity's, it seems to be a better choice for architecture, too.
-chris
signature.asc
Description: OpenPGP digital signature