Hey Tom,
Answers:
1. Unfortunately not. I've test it in our system on real data (CODECO,APERAK,COARRI), sorry.
2. When I've wrote it no model mapping exists. I'll take a look how to do this.
3. Short explanation:
There are 3 modes: segment, field and component - what we are currently doing.
For each mode there are inner classes to keep trucking of loops and mandatory elements:
SegmentsContext, FieldsContext and ComponetsContext. All of these classes have methods to find offset of
next element in model by XML tag. These methods also check for mandatory element.
'advance' methods moves to the current model element and outputs separators for skipped elements.
SegmentsContext contains list of segments for current segment group,
FieldsContext contains list of fields for current segment and
ComponetsContext contains list of components for current field.
There is stack of SegmentContext for nested segment loops.
There are 4 predefined parameters for referencing from source XML file.
These parameters make life easy especially for segment counting.
messageDate and messageTime for setting current date and time of message.
unbSyntaxId for setting Syntax ID of UNB segment using encoding of output 'Writer' object.
segmentCount for UNT segment 'segmentCount' field.
Example of source XML:
<?xml version="1.0" encoding="UTF-8"?>
<unEdifact>
<UNB>
<syntaxIdentifier>
<id>$
{unbSyntaxId}
</id>
<versionNum>2</versionNum>
</syntaxIdentifier>
<sender>
<id>$
{sender}
</id>
</sender>
<recipient>
<id>$
{recipient}
</id>
</recipient>
<dateTime>
<date>$
{messageDate}
</date>
<time>$
{messageTime}
</time>
</dateTime>
<controlRef>1234567890</controlRef>
</UNB>
<unEdifactMessage>
....
<UNT>
<segmentCount>$
{segmentCount}
</segmentCount>
<messageRefNum>1234567890</messageRefNum>
</UNT>
</unEdifactMessage>
<UNZ>
<controlCount>1</controlCount>
<controlRef>1234567890</controlRef>
</UNZ>
</unEdifact>
Additional parameters can be set by setParameter (String name, Object value) and
referenced by $
{param_name}
.
We have UN/EDIFACT serialisation as part of the EJC generated Java objects