|
I'm trying to model a COBOL copybook message using Bindy. The basic structure is a fixed length header followed by multiple fixed length bodies - all with no separators.
Can this be modeled for marshaling purposes using the following annotations: @FixedLengthRecord(length=60, paddingChar=' ') public class TestHeader { @DataField(pos = 1, length = 4) private String RECORD_ID; etc.... @OneToMany private List<TestBody> body; } @FixedLengthRecord(length=40, paddingChar=' ') public class TestBody { @DataField(pos = 1, length = 16) private String TYPE; etc } |
|
Hi
Why dont you try it for yourself? I would assume it would be doable with the outline you sketched. On Wed, Jan 4, 2012 at 6:15 AM, Fitzcaraldo <[hidden email]> wrote: > I'm trying to model a COBOL copybook message using Bindy. The basic > structure is a fixed length header followed by multiple fixed length bodies > - all with no separators. > > Can this be modeled for marshaling purposes using the following annotations: > > > @FixedLengthRecord(length=60, paddingChar=' ') > public class TestHeader { > > @DataField(pos = 1, length = 4) > private String RECORD_ID; > > etc.... > > @OneToMany > private List<TestBody> body; > > } > > > @FixedLengthRecord(length=40, paddingChar=' ') > public class TestBody { > > @DataField(pos = 1, length = 16) > private String TYPE; > > etc > > } > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Bindy-and-FixedLength-tp5118749p5118749.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ |
|
OK.
So I first tried without the @OneToMany section for the lineItems and successfully produced a TestHeader Object (using a shorter input stream) When I put the OneToMany with a full length input stream I get the following exception: Size of the record: 756 is not equal to the value provided in the model: 126 (126 bytes of header + 10x 63 bytes of body = 756) I was hoping it might produce as many TestBody objects as required. Is OneToMany supported with FixedLengthRecord? Using Camel 2.9.0-RC1 Here's the TestHeader class @XmlRootElement //JAXB annotation @XmlAccessorType(XmlAccessType.FIELD) @FixedLengthRecord(length=126, paddingChar=' ') public class TestHeader { @DataField(pos = 1, length = 4) private String RECORD_ID; @DataField(pos = 5, length = 1) private String ACTION; @DataField(pos = 6, length = 13) private String TRAN_NO; @DataField(pos = 19, length = 3) private String DATA_TYPE; @DataField(pos = 22, length = 6) private String TRAN_DEST; @DataField(pos = 28, length = 9) private String TRAN_SEQ_NO; @DataField(pos = 37, length = 8) private String RECORD_DATE; @DataField(pos = 45, length = 5) private String RECORD_TIME; @DataField(pos = 50, length = 2) private String COMP_CODE; @DataField(pos = 52, length = 30) private String CUST_NO; @DataField(pos = 82, length = 5) private String NO_LINE_ITEMS; @DataField(pos = 87, length = 15) private String ORD_NO; @DataField(pos = 102, length = 2) private String ORD_TYPE; @DataField(pos = 104, length = 7) private String ASSIGNMENT_NO; @DataField(pos = 111, length = 8) private String CUST_ORD_DATE; @DataField(pos = 119, length = 4) private String SOURCE_SYS; @DataField(pos = 123, length = 2) private String TPC_TYPE_CODE; @OneToMany private List<TestBody> lineItems; } and TestBody class @FixedLengthRecord(length=63, paddingChar=' ') public class TestBody { @DataField(pos = 1, length = 4) private String RECORD_ID; @DataField(pos = 5, length = 1) private String ACTION; @DataField(pos = 6, length = 8) private String RECORD_DATE; @DataField(pos = 14, length = 5) private String RECORD_TIME; @DataField(pos = 19, length = 6) private String ORD_LINE_NO; @DataField(pos = 25, length = 9) private String ORD_QTY; @DataField(pos = 34, length = 20) private String SKU; @DataField(pos = 54, length = 4) private String PKG_NO; @DataField(pos = 58, length = 2) private String UOM_ABBREV; @DataField(pos = 60, length = 2) private String DISTRO_TYPE; @DataField(pos = 62, length = 2) private String ITEM_TYPE; } |
|
Hi
We plan to fix and improve camel-bindy for Camel 2.10. There is a couple of JIRAs already. However your use-case may not be included. Fell free to create a JIRA with your use-case and attaching some sample code / unit test will help verify the solution. On Thu, Jan 5, 2012 at 5:30 AM, Fitzcaraldo <[hidden email]> wrote: > OK. > > So I first tried without the @OneToMany section for the lineItems and > successfully produced a TestHeader Object (using a shorter input stream) > > When I put the OneToMany with a full length input stream I get the following > exception: > > Size of the record: 756 is not equal to the value provided in the model: 126 > > (126 bytes of header + 10x 63 bytes of body = 756) > > I was hoping it might produce as many TestBody objects as required. > > Is OneToMany supported with FixedLengthRecord? > > Using Camel 2.9.0-RC1 > > Here's the TestHeader class > > @XmlRootElement //JAXB annotation > @XmlAccessorType(XmlAccessType.FIELD) > @FixedLengthRecord(length=126, paddingChar=' ') > public class TestHeader { > > @DataField(pos = 1, length = 4) > private String RECORD_ID; > > @DataField(pos = 5, length = 1) > private String ACTION; > > @DataField(pos = 6, length = 13) > private String TRAN_NO; > > @DataField(pos = 19, length = 3) > private String DATA_TYPE; > > @DataField(pos = 22, length = 6) > private String TRAN_DEST; > > @DataField(pos = 28, length = 9) > private String TRAN_SEQ_NO; > > @DataField(pos = 37, length = 8) > private String RECORD_DATE; > > @DataField(pos = 45, length = 5) > private String RECORD_TIME; > > @DataField(pos = 50, length = 2) > private String COMP_CODE; > > @DataField(pos = 52, length = 30) > private String CUST_NO; > > @DataField(pos = 82, length = 5) > private String NO_LINE_ITEMS; > > @DataField(pos = 87, length = 15) > private String ORD_NO; > > @DataField(pos = 102, length = 2) > private String ORD_TYPE; > > @DataField(pos = 104, length = 7) > private String ASSIGNMENT_NO; > > @DataField(pos = 111, length = 8) > private String CUST_ORD_DATE; > > @DataField(pos = 119, length = 4) > private String SOURCE_SYS; > > @DataField(pos = 123, length = 2) > private String TPC_TYPE_CODE; > > @OneToMany > private List<TestBody> lineItems; > > } > > and TestBody class > > @FixedLengthRecord(length=63, paddingChar=' ') > public class TestBody { > > @DataField(pos = 1, length = 4) > private String RECORD_ID; > > @DataField(pos = 5, length = 1) > private String ACTION; > > @DataField(pos = 6, length = 8) > private String RECORD_DATE; > > @DataField(pos = 14, length = 5) > private String RECORD_TIME; > > @DataField(pos = 19, length = 6) > private String ORD_LINE_NO; > > @DataField(pos = 25, length = 9) > private String ORD_QTY; > > @DataField(pos = 34, length = 20) > private String SKU; > > @DataField(pos = 54, length = 4) > private String PKG_NO; > > @DataField(pos = 58, length = 2) > private String UOM_ABBREV; > > @DataField(pos = 60, length = 2) > private String DISTRO_TYPE; > > @DataField(pos = 62, length = 2) > private String ITEM_TYPE; > > } > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Bindy-and-FixedLength-tp5118749p5121740.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ |
| Powered by Nabble | Edit this page |
