Announcement Announcement Module
Collapse
No announcement yet.
Multiple lines, optional field, Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple lines, optional field,

    In my project I parse a file with edifact format. The file contains multiple lines (records) which have the same configuration. The problem is that some of the fields of a record are optional or mandatory. This depends in which part of the file this record is used.
    The following 2 lines explains the problem.
    FII+BF+838383::::EUR+:::93939393:25:131+NL'
    FII+BF+12345::::+:::93939393:25:131'

    I definend the following in my context:
    <bean id="orderFileTokenizer" class="org.springframework.batch.item.file.transfo rm.PatternMatchingCompositeLineTokenizer">
    ...
    <property name="tokenizers">
    <map>
    <entry key="FII*" value-ref=FIITokenizer" />
    <entry key="*" value-ref="defaultLineTokenizer"/>
    </map>
    </property>
    </bean>
    ...
    <bean id="parentLineTokenizer" class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer" abstract="true">
    <property name="delimiter" value="+"/>
    </bean>
    <bean id="FIITokenizer" parent="parentLineTokenizer">
    <property name="names" value="FII_SEG,FII_PARTY_QUAL,FII_ACCOUNT,FII_INST ITUTION,FII_COUNTRY" />
    <!--<property name="names" value="" />-->
    </bean>

    In my case the FII_COUNTRY is an optional field which is not possible to configure. How can I handle this problem.

    Many thanks for an advice.

    Dirk

  • #2
    One point I forgot, is there also a solution to have more delimiters? In my example I have a + as delimeter for the fields(objects). An object can be an aggregation of other fields which are delimeted by the :
    In my implementation I retrieve the whole object with the colons. In the custom mapper I parse the fields and set them to the correct field in the object.
    Is this the right way to do or is there an better way to do this.

    Regards Dirk

    Comment

    Working...
    X