Hi Kevin, I will have a look on that this afternoon and coming back to you with info. I have done the code and test it with Key value pair format but not yet for CSV. This could be possible. I think that @Section tag is not checked in bindyCSVFormat.
Concerning version number, this should be camel 2.2 ? Can you confirm Claus ? Charles Moulliard Senior Enterprise Architect Apache Camel Committer ***************************** blog : http://cmoulliard.blogspot.com twitter : http://twitter.com/cmoulliard Linkedlin : http://www.linkedin.com/in/charlesmoulliard Apache Camel Group : http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm On Wed, Dec 23, 2009 at 8:55 AM, Kevin Jackson <[email protected]> wrote: > 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 >
