On Tue, Apr 15, 2014 at 10:54 AM, Andrea Aime
<andrea.a...@geo-solutions.it>wrote:

> On Tue, Apr 15, 2014 at 9:50 AM, Sampo Savolainen <
> sampo.savolai...@spatineo.com> wrote:
>
>> Hi Andrea,
>>
>> CQL looks like a definite contender. The standard FilterFactory expects
>> to get properties from SimpleFeatures and does not understand Java Beans
>> notation. To get around this, I created a FilterFactory that extends the
>> basic impl and returns a different PropertyName implementation for
>> properties. This implementation simply uses commons-beans to access the
>> java bean properties. This works well, but I was wondering if it would make
>> sense to create an "official" PropertyAccessorFactory capable of retrieving
>> data from any java bean? This might pose some security issues and I trust
>> you to be a better judge at this.
>>
>
> Wondering, do you really have the evaluate filters against beans?
>

My idea was to build a context for the stored query parameter evaluation
which would contain the following information:
 - Values passed as view parameters
 - Filter envelope
 - Feature type info

The admin could then configure the layer to map these values to the stored
query parameters in the layer configuration like so:

<StoredQueryConfiguration storedQueryId="urn::whatever..">
  <ParameterMapping>
    <ParameterName>bbox</ParameterName>
    <ExpressionValue
language="MysticEL">${envelope.minx},${envelope.miny},${envelope.maxy},${envelope.maxy},${featureType.defaultCRS}</ExpressionValue>
  </ParameterMapping>
  <ParameterMapping>
    <ParameterName>xyz</ParameterName>
    <ExpressionValue language="MysticEL">${viewparam.xyz[0] * 60 *
1000}</ExpressionValue>
  </ParameterMapping>
  <ParameterMapping>
    <ParameterName>timestep</ParameterName>
    <DefaultValue>720</DefaultValue>
  </ParameterMapping>
</StoredQueryConfiguration>

I'm using a hypothetical EL here to provide readability. The above xml
structure is raw, not much though has been put into it yet. Comments are
always appreciated.

As in the example above, the same configuration could be used to provide
sane defaults to be used when no value is provided in the request.



> But yes, I don't think there is any issue adding a javabean based property
> accessor (maybe check if you need to add dependencies though, like
> commons-beanutils, to make it run, or if the stuff you need is already
> there)
>

Ok. I'll look into that once we get settled if I really need beans or not.

Do you see a way to achieve what I proposed above without using beans? I
could always synthesize a simple feature type and use that as the CQL
context, but that seems like an awful amount of work (and kludges) to get
something pretty simple achieved.


Another thing I'm missing is that I can't find a CQL function to convert
>> numbers into strings. As I'm using the expression language to produce
>> values to put in the stored query parameters, such a function would be
>> invaluable. Is there such a function or should I add one as an extension? I
>> would first just add it to my use case but you can later figure out if it's
>> needed in the main CQL toolkit. I'm thinking "toString(expr)", any thoughts?
>>
>
> numberFormat:
> http://docs.geoserver.org/stable/en/user/filter/function_reference.html#parsing-and-formatting-functions
>

Brilliant. I knew I must've missed it. Thanks.


 Sampo


-- 
Sampo Savolainen
R&D Director, Spatineo Oy
sampo.savolai...@spatineo.com
+358-407555649
Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
www.spatineo.com, twitter.com/#!/spatineo
www.linkedin.com/company/spatineo-inc

This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to