@Test public void testSum() throws Exception { SimpleFeatureSource source = bugs.getFeatureSource("bugsites"); TransformProcess process = new TransformProcess(); String definition = "the_geom=the_geom\nnumber=cat"; SimpleFeatureCollection origional = source.getFeatures(); SimpleFeatureCollection result = process.execute(origional, definition); assertEquals(origional.size(), result.size()); SimpleFeatureType schema = result.getSchema(); AttributeDescriptor number = schema.getDescriptor("number"); assertTrue(Long.class.isAssignableFrom(number.getType().getBinding())); }
@DescribeResult(name = "result", description = "Transformed feature collection") public 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) throws ProcessException { if (transform == null) { return features; } List<Definition> list = toDefinition(transform); return executeList(features, list); }
TransformProcess implements VectorProcess { @DescribeResult(name = "result", description = "Transformed feature collection") public 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) throws ProcessException { if (transform == null) { return features; } List<Definition> list = toDefinition(transform); return executeList(features, list); } }
TransformProcess implements VectorProcess { @DescribeResult(name = "result", description = "Transformed feature collection") public 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) throws ProcessException { if (transform == null) { return features; } List<Definition> list = toDefinition(transform); return executeList(features, list); }  }
TransformProcess implements VectorProcess { @DescribeResult(name = "result", description = "Transformed feature collection") public 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) throws ProcessException { if (transform == null) { return features; } List<Definition> list = toDefinition(transform); return executeList(features, 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 { @DescribeResult(name = "result", description = "Transformed feature collection") public 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) throws ProcessException { if (transform == null) { return features; } List<Definition> list = toDefinition(transform); return executeList(features, 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);  }