com.ddtek.xmlconverter.adapter.edi
Interface EDIConverterListener

All Superinterfaces:
ConverterListener

public interface EDIConverterListener
extends ConverterListener

This is an extension of the ConverterListener interface which can handle events specific to EDI converters. Some of the added methods handle EDI specific errors, while others are used to report status information such as the start of a message or a segment.

(It is modeled somewhat on the SAX ErrorHandler interface.)

If an XML Converter application needs to implement customized error handling then it may implement this interface and register it with the Converter object. This may be done either by assigning an EDIConverterListener to the ConverterFactory in which case they all share the same instance, or afterwards to an individual Converter, ConvertToXML or ConvertFromXML object.

Since:
3.2
See Also:
ConverterException, ConverterListener, EDIConverterException

Method Summary
 void endGroup(EDISegmentDetails details)
          endGroup is called at the end of each message group or batch.
 void endInterchange(EDISegmentDetails details)
          endInterchange is called at the end of each interchange marker segment.
 void endMessage(EDISegmentDetails details)
          endMessage is called at the end of each message.
 int invalidCharacter(char chr, String coding)
          If a character does not match the specified encoding in the EDI stream, this is called to figure out how to handle the situation.
 void processSegment(EDISegmentDetails details)
          Each segment processed, including those that trigger other events such as startMessage or endMessage, also triggers this event.
 void startGroup(EDISegmentDetails details)
          startGroup is called at the beginning of each message group or batch.
 void startInterchange(EDISegmentDetails details)
          startInterchange is called at the beginning of each interchange marker segment.
 void startMessage(EDISegmentDetails details)
          startMessage is called at the beginning of each message.
 String unknownCodelistValue(String segment, int pos, int sub, int tri, int rep, String element, String item)
          This entry point is called if normal code list validation fails for an item.
 
Methods inherited from interface com.ddtek.xmlconverter.ConverterListener
error, fatalError, warning
 

Method Detail

unknownCodelistValue

String unknownCodelistValue(String segment,
                            int pos,
                            int sub,
                            int tri,
                            int rep,
                            String element,
                            String item)
This entry point is called if normal code list validation fails for an item. If the tbl=no URI option is enabled, this method will still be called, but returning 'null' will not force an exception.

Parameters:
segment - This is the name of the segment.
pos - This is the position within the segment.
sub - If the element is a component element, this is the position within the parent element otherwise 0.
tri - If the element is a component within a component element, this is the tertiary position otherwise 0.
rep - If the element is a repeating element within the segment, this is the position within the repeat group. It will always be at least 1.
element - This is the name of the element.
item - The code list value as included in the EDI or XML file. This will never be null.
Returns:
'null' to cause the caller to force an exception (unless tbl=no is set on the URI), or any string (including a zero-length string "") to allow the code list value to be accepted.

invalidCharacter

int invalidCharacter(char chr,
                     String coding)
If a character does not match the specified encoding in the EDI stream, this is called to figure out how to handle the situation.

Parameters:
chr - is the character in the EDI stream that does not seem to make sense
coding - is the name of the EDI-specific encoding, such as UNOB or IATA.
Returns:
-1 means the character should be handled as an invalid character, otherwise the return value is used as the new value in the output stream, even if it is not supported by the coding.

startInterchange

void startInterchange(EDISegmentDetails details)
                      throws Exception
startInterchange is called at the beginning of each interchange marker segment. For HL7, this means at the FHS if present. For X12: ISA. For EDIFACT: UNB or UIB.

Throws:
Exception

endInterchange

void endInterchange(EDISegmentDetails details)
                    throws Exception
endInterchange is called at the end of each interchange marker segment. For HL7, this means at the FHT if present. For X12: IEA. For EDIFACT: UNZ or UIZ.

Throws:
Exception

startMessage

void startMessage(EDISegmentDetails details)
                  throws Exception
startMessage is called at the beginning of each message. For HL7, this means at the MSH segment. For X12: ST. For EDIFACT: UNH or UIH.

Throws:
Exception

endMessage

void endMessage(EDISegmentDetails details)
                throws Exception
endMessage is called at the end of each message. This is not called in HL7, since there is no "end message" to correspond to the "start message" MSH segment. For X12: SE. For EDIFACT: UNT or UIT.

Throws:
Exception

startGroup

void startGroup(EDISegmentDetails details)
                throws Exception
startGroup is called at the beginning of each message group or batch. For HL7, this means at the BHS if present. For X12: GS. For EDIFACT: UNG or UIG, if present. If grouping is not used in the interchange, then startGroup/endGroup are not called.

Throws:
Exception

endGroup

void endGroup(EDISegmentDetails details)
              throws Exception
endGroup is called at the end of each message group or batch. For HL7, this means at the BHT if present. For X12: GE. For EDIFACT: UNE or UIE. If grouping is not used in the interchange, then startGroup/endGroup are not called.

Throws:
Exception

processSegment

void processSegment(EDISegmentDetails details)
                    throws Exception
Each segment processed, including those that trigger other events such as startMessage or endMessage, also triggers this event.

Throws:
Exception