@Test public void testDefinitionListDelimiterLF() throws Exception { String definition = "the_geom=the_geom;\n cat=cat+1;"; List<Definition> def = TransformProcess.toDefinition(definition); assertEquals(2, def.size()); assertEquals("the_geom", def.get(0).name); assertTrue(def.get(0).expression instanceof PropertyName); assertEquals("cat", def.get(1).name); }
public static List<Definition> toDefinition(String definition) { List<Definition> list = new ArrayList<Definition>(); HashSet<String> check = new HashSet<String>(); String[] defs = splitDefinitions(definition); for (String line : defs) { int mark = line.indexOf("="); if (mark != -1) { String name = line.substring(0, mark).trim(); String expressionDefinition = line.substring(mark + 1).trim(); if (check.contains(name)) { throw new IllegalArgumentException( "Attribute " + name + " defined more than once"); } Expression expression; try { expression = ECQL.toExpression(expressionDefinition); } catch (CQLException e) { throw new IllegalArgumentException( "Unable to parse expression " + name + "=" + expressionDefinition + " " + e, e); } Definition def = new Definition(); def.name = name; def.expression = expression; list.add(def); check.add(name); } } return list; }
TransformProcess implements VectorProcess { public static List<Definition> toDefinition(String definition) { List<Definition> list = new ArrayList<Definition>(); HashSet<String> check = new HashSet<String>(); String[] defs = splitDefinitions(definition); for (String line : defs) { int mark = line.indexOf("="); if (mark != -1) { String name = line.substring(0, mark).trim(); String expressionDefinition = line.substring(mark + 1).trim(); if (check.contains(name)) { throw new IllegalArgumentException( "Attribute " + name + " defined more than once"); } Expression expression; try { expression = ECQL.toExpression(expressionDefinition); } catch (CQLException e) { throw new IllegalArgumentException( "Unable to parse expression " + name + "=" + expressionDefinition + " " + e, e); } Definition def = new Definition(); def.name = name; def.expression = expression; list.add(def); check.add(name); } } return list; } }
TransformProcess implements VectorProcess { public static List<Definition> toDefinition(String definition) { List<Definition> list = new ArrayList<Definition>(); HashSet<String> check = new HashSet<String>(); String[] defs = splitDefinitions(definition); for (String line : defs) { int mark = line.indexOf("="); if (mark != -1) { String name = line.substring(0, mark).trim(); String expressionDefinition = line.substring(mark + 1).trim(); if (check.contains(name)) { throw new IllegalArgumentException( "Attribute " + name + " defined more than once"); } Expression expression; try { expression = ECQL.toExpression(expressionDefinition); } catch (CQLException e) { throw new IllegalArgumentException( "Unable to parse expression " + name + "=" + expressionDefinition + " " + e, e); } Definition def = new Definition(); def.name = name; def.expression = expression; list.add(def); check.add(name); } } return list; }  }
TransformProcess implements VectorProcess { public static List<Definition> toDefinition(String definition) { List<Definition> list = new ArrayList<Definition>(); HashSet<String> check = new HashSet<String>(); String[] defs = splitDefinitions(definition); for (String line : defs) { int mark = line.indexOf("="); if (mark != -1) { String name = line.substring(0, mark).trim(); String expressionDefinition = line.substring(mark + 1).trim(); if (check.contains(name)) { throw new IllegalArgumentException( "Attribute " + name + " defined more than once"); } Expression expression; try { expression = ECQL.toExpression(expressionDefinition); } catch (CQLException e) { throw new IllegalArgumentException( "Unable to parse expression " + name + "=" + expressionDefinition + " " + e, e); } Definition def = new Definition(); def.name = name; def.expression = expression; list.add(def); check.add(name); } } return list; }  @DescribeResult(name = "result", description = "Transformed feature collection") SimpleFeatureCollection execute(
            @DescribeParameter(name = "features", description = "Input feature collection")
                    SimpleFeatureCollection features,
            @DescribeParameter(
                        name = "transform",
                        description =
                                "The transform specification, as a list of specifiers of the form name=expression, delimited by newlines or semicolons."
                    )
                    String transform); @DescribeResult(name = "result", description = "Transformed feature collection") SimpleFeatureCollection executeList(
            @DescribeParameter(name = "features", description = "Input feature collection")
                    SimpleFeatureCollection features,
            @DescribeParameter(
                        name = "transform",
                        description = "List of Definitions for the output feature attributes"
                    )
                    List<Definition> transform); static List<Definition> toDefinition(String definition); static SimpleFeatureType toReShapeFeatureType(
            SimpleFeatureCollection delegate, List<Definition> definitionList); }
TransformProcess implements VectorProcess { public static List<Definition> toDefinition(String definition) { List<Definition> list = new ArrayList<Definition>(); HashSet<String> check = new HashSet<String>(); String[] defs = splitDefinitions(definition); for (String line : defs) { int mark = line.indexOf("="); if (mark != -1) { String name = line.substring(0, mark).trim(); String expressionDefinition = line.substring(mark + 1).trim(); if (check.contains(name)) { throw new IllegalArgumentException( "Attribute " + name + " defined more than once"); } Expression expression; try { expression = ECQL.toExpression(expressionDefinition); } catch (CQLException e) { throw new IllegalArgumentException( "Unable to parse expression " + name + "=" + expressionDefinition + " " + e, e); } Definition def = new Definition(); def.name = name; def.expression = expression; list.add(def); check.add(name); } } return list; }  @DescribeResult(name = "result", description = "Transformed feature collection") SimpleFeatureCollection execute(
            @DescribeParameter(name = "features", description = "Input feature collection")
                    SimpleFeatureCollection features,
            @DescribeParameter(
                        name = "transform",
                        description =
                                "The transform specification, as a list of specifiers of the form name=expression, delimited by newlines or semicolons."
                    )
                    String transform); @DescribeResult(name = "result", description = "Transformed feature collection") SimpleFeatureCollection executeList(
            @DescribeParameter(name = "features", description = "Input feature collection")
                    SimpleFeatureCollection features,
            @DescribeParameter(
                        name = "transform",
                        description = "List of Definitions for the output feature attributes"
                    )
                    List<Definition> transform); static List<Definition> toDefinition(String definition); static SimpleFeatureType toReShapeFeatureType(
            SimpleFeatureCollection delegate, List<Definition> definitionList);  }