I have to admit this was a mistake on my end.  There was an environmental issue causing this problem that I was unable to diagnose at the time.  You can ignore this question.


On Tue, Aug 6, 2013 at 11:00 AM, lindsey <lindsey@mosaicatm.com> wrote:
Hi all -

I've been using a couple custom filter functions that I wrote, for about a
month now.  The framework has worked well for me, but I have one issue that
I haven't been able to work out yet.  My function takes in a handful of
parameters.  The parameters of String or primitive numeric types are working
great.  However I am having trouble with time based <PropertyName>
parameters.

My feature is backed by a PostGIS data store and the table in question uses
"timestamp with time zone" type. So I was thinking I'd use the
java.sql.Timestamp in the FunctionName definition, like this:

     parameter("featureStartTime", Timestamp.class)

...and this in the evaluate method:

    Timestamp timeParam = super.getParameters().get(index).evaluate(feature,
Timestamp.class);

Unfortunately though, that always returns null.  I have confirmed that the
database records indeed to have non null values.

I have also tried to handle these as strings, but in that - somewhat
surprisingly - it returns a "-1" value.  I suppose this is the equivalent to
null.  Date type also fails - returning null.

As a workaround so far, I have just been changing that field in my test
database to be a varchar and then converting in my code after reading the
param as a string.  However, I'm now about ready to move to a production
database that uses the postgresql timestamp, so I can no longer hack my way
around it.

I apologize if the answer is already in the docs/forums somewhere (I assume
it must be) but I have not been able to find it yet.   Any help would be
greatly appreciated.

Thanks,

Jeremy




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Handling-timestamp-parameters-in-custom-filter-function-tp5071089.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users