[ 
http://jira.codehaus.org/browse/GEOT-1169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabriel Roldán reopened GEOT-1169:
----------------------------------


reopening as it still needs to be ported to 2.3.x

> CQL Parser should allow nested function calls
> ---------------------------------------------
>
>                 Key: GEOT-1169
>                 URL: http://jira.codehaus.org/browse/GEOT-1169
>             Project: GeoTools
>          Issue Type: Improvement
>          Components: new modules
>    Affects Versions: 2.3.1, 2.4.M0
>            Reporter: Gabriel Roldán
>         Assigned To: Gabriel Roldán
>            Priority: Critical
>             Fix For: 2.3.1, 2.4.M0
>
>         Attachments: 1167-1168-1169.patch
>
>
> CQL defines attribute and literals as possible rutine invocation arguments. 
> We need them to be any {{Expression}}, most notably nested functions.
> Test case:
> {code}
>   /**
>      * The CQL grammar allows only literals and attribute names as function
>      * arguments.
>      * <p>
>      * This tests the extension to allow for a generic expression as function
>      * argument, as allowed by
>      * [EMAIL PROTECTED] FilterFactory#function(String, Expression[])}
>      * </p>
>      * <p>
>      * In particular, it is often needed to nest functions like to concatenate
>      * various strings:
>      * <code>strConcat(A, strConcat(B, strConcat(C, ".")))</code>
>      * </p>
>      * 
>      * @throws ParseException
>      */
>     public void testExtensionFunctionWithAnyExpressionArgument() throws 
> ParseException {
>         String cqlExpression = "strConcat(A, strConcat(B, strConcat(C, 
> \".\")))";
>         Expression expression = FilterBuilder.parseExpression(cqlExpression);
>         assertNotNull(expression);
>         assertTrue(expression instanceof Function);
>         Function function = (Function) expression;
>         assertEquals(2, function.getParameters().size());
>         Expression propertyName = (Expression) 
> function.getParameters().get(0);
>         assertTrue(propertyName instanceof PropertyName);
>         assertEquals("A", ((PropertyName) propertyName).getPropertyName());
>         Expression arg2 = (Expression) function.getParameters().get(1);
>         assertTrue(arg2 instanceof Function);
>         function = (Function) arg2;
>         propertyName = (Expression) function.getParameters().get(0);
>         assertTrue(propertyName instanceof PropertyName);
>         assertEquals("B", ((PropertyName) propertyName).getPropertyName());
>         arg2 = (Expression) function.getParameters().get(1);
>         assertTrue(arg2 instanceof Function);
>         function = (Function) arg2;
>         propertyName = (Expression) function.getParameters().get(0);
>         assertTrue(propertyName instanceof PropertyName);
>         assertEquals("C", ((PropertyName) propertyName).getPropertyName());
>         arg2 = (Expression) function.getParameters().get(1);
>         assertTrue(arg2 instanceof Literal);
>         assertEquals(".", ((Literal) arg2).getValue());
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to