Hi Mauricio,
Sorry I forgot two minor remarks:
1. I think that we should add the same patch in the methods
public Object visit(PropertyIsGreaterThan filter, Object extraData) and
public Object visit(PropertyIsLessrThan filter, Object extraData)
In order to avoid the classCast exception problem.
2. In the method
public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object extraData)
the log is wrong:
LOGGER.finer("exporting PropertyIsLessThanOrEqualTo");
Should be:
LOGGER.finer("exporting PropertyIsGreaterThanOrEqualTo ");
Cheers
Nicolas
-----Message d'origine-----
De : LECARTNicolas - MSY
Envoyé : lundi 20 décembre 2010 17:23
À : LECARTNicolas - MSY; 'Mauricio Pazos';
'[email protected]'
Objet : RE: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing
Hello Mauricio,
I checked the patch in FilterToCQL class, and I noticed an issue in the code.
In the method
public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object extraData) {
LOGGER.finer("exporting PropertyIsLessThanOrEqualTo");
StringBuffer output = asStringBuffer(extraData);
Object expr1 = filter.getExpression1();
if( expr1 instanceof PropertyName){
PropertyName propertyName = (PropertyName) filter.getExpression1();
propertyName.accept(this, output);
output.append(" >= ");
filter.getExpression2().accept(this, output);
}
else {
PropertyName propertyName = (PropertyName) filter.getExpression2();
propertyName.accept(this, output);
output.append(" >= ");
filter.getExpression1().accept(this, output);
}
return output;
}
In the else statement the comparison operator is not ">=" but "<=".
The " output.append(" >= ");" has to be repalced with
"output.append(" <= ");"
I can demonstrate this with an example: let say the method is called with this
filter : [ Tue Oct 10 01:30:00 CEST 2006 <= dateAttr ]
With your code, the output variable will contain
dateAttr <= 2006-10-10T01:30:00Z which is wrong.
There is the same issue in the method:
public Object visit(PropertyIsLessThanOrEqualTo filter, Object extraData)
{
LOGGER.finer("exporting PropertyIsLessThanOrEqualTo");
StringBuffer output = asStringBuffer(extraData);
Object expr1 = filter.getExpression1();
if( expr1 instanceof PropertyName){
PropertyName propertyName = (PropertyName) filter.getExpression1();
propertyName.accept(this, output);
output.append(" <= ");
filter.getExpression2().accept(this, output);
}
else {
PropertyName propertyName = (PropertyName) filter.getExpression2();
propertyName.accept(this, output);
output.append(" <= ");
filter.getExpression1().accept(this, output);
}
return output;
}
In this method, in the else statement,
the "output.append(" <= ");" has to be replaced with
"output.append(" >= ");"
Best regards
Nicolas
________________________________________
De : LECARTNicolas - MSY
Envoyé : lundi 20 décembre 2010 13:18
À : 'Mauricio Pazos'; [email protected]
Objet : RE: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing
Thank you Mauricio,
I will check the method ang get back to you.
Best regards
Nicolas
________________________________________
De : Mauricio Pazos [mailto:[email protected]]
Envoyé : lundi 20 décembre 2010 12:56
À : [email protected]
Objet : Re: [Geotools-gt2-users] DURING predicate and BEFORE predicate parsing
On Friday 17 December 2010 09:43:20 pm Mauricio Pazos wrote:
> Good!, I am going to add this patch in trunk. Your collaboration is
> welcome.
>
>
> all the best
I have added the unit test for FilterToCQL. FilterToCQL was fixed for "after"
and "before" sentences.
The "during" sentence require more work. I have added a FIXME where I think is
required to extend the code
Have look in the method
public Object visit(And filter, Object extraData)
in the class
http://svn.osgeo.org/geotools/trunk/modules/library/cql/src/main/java/org/geotools/filter/text/cql2/FilterToCQL.java
cheers
--
Mauricio Pazos
www.axios.es
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users