camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Jackson <foamd...@gmail.com>
Subject bean -> camel-bindy -> csv problem
Date Wed, 23 Dec 2009 07:55:33 GMT
Hi,

We have a requirement to generate CSV in the format

header,,,,
line,1,,
line,2,,
line,3,,
footer,3

My reading of the docs (such as they are) suggests that this may be
possible with @Link, @OneToMany and @Section

I have the following model:

@CsvRecord
class PurchaseOrder {

 @Link
 private Header;

 @Link
 private Footer

 @OneToMany
 private Line

}

@Link
@Section(number=1)
class Header {

}

@Link
@Section(number=3)
class Footer {

}

@Section(number=2)
class Line {

}

Reading the docs [1] there is a suggestion that the @Section
annotation is really only useful for FIX style k:v pairs, rather than
vanilla CSV.

The output I get with this is odd:
line,1,,,
line,2,,,
line,3,,,
header,,,,
footer,3,,, <- this actually contains the correct data in position
1&2, but then contains data in position 3->6 copied from the first
line record, as the footer only has 1 field in the class I'm failing
to see how this extra data is being bound.

The @Section(number=1) etc seems to be ignored in this instance.

Is it possible to create this format of structured CSV from bindy
(camel 2.1)?  If so what am I doing wrong?  If it isn't possible (yet)
I'm more than willing to contribute a patch to make this possible

Thanks,
Kev

[1] http://camel.apache.org/bindy.html

Mime
View raw message