JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS Message Library for EDIFACT User's Guide     Java CAPS Documentation
search filter icon
search icon

Document Information

Using the Message Library for EDIFACT

Overview of the EDIFACT Message Library

About the EDIFACT Message Library

References

Character Encoding

UN/EDIFACT Directory Support

SEF File Support

UN/EDIFACT Validation Support

UNA Segment Support

On Demand Parsing

Errors and Exceptions

Installing the Message Library for EDIFACT

Using UN/EDIFACT Message Libraries

Displaying UN/EDIFACT OTDs

To Display UN/EDIFACT OTDs

Building UN/EDIFACT OTD Collaborations

To Build UN/EDIFACT OTD Collaborations

Customizing the UN/EDIFACT OTDs

To Customize UN/EDIFACT OTDs

Creating UN/EDIFACT OTDs from SEF Files

To Create UN/EDIFACT OTDs from SEF files

Possible Differences in Output When Using Pass-Through

Java Methods for UN/EDIFACT OTDs

Get and Set Methods

Setting Delimiters and Indicators

Available Methods

check

Signature

Description

Exceptions

checkAll

Signature

Description

Exceptions

clone

Signature

Description

Exceptions

countxxx

Signature

Description

Exceptions

countLoopxxx

Signature

Description

Exceptions

getxxx

Signature

Description

Exceptions

getAllErrors

Signature

Description

Exceptions

getDecimalMark

Signature

Description

Exceptions

getElementSeparator

Signature

Description

Exceptions

Example

getFGValidationResult

Signature

Description

Exceptions

getICValidationResult

Signature

Description

Exceptions

getInputSource

Signature

Description

Exceptions

getLoopxxx

Signature

Description

Exceptions

getMaxDataError

Signature

Description

Exceptions

getMaxFreedSegsComsNum

Signature

Description

Exceptions

getMaxParsedSegsComsNum

Signature

Description

Exceptions

getMsgValidationResult

Signature

Description

Exceptions

getRelease

Signature

Description

Exceptions

getRepetitionSeparator

Signature

Description

Exceptions

Examples

getSegmentCount

Signature

Description

Exceptions

getSegmentTerminator

Signature

Description

Exceptions

Example

getSubelementSeparator

Signature

Description

Exceptions

Example

getTSValidationResult

Signature

Description

Exceptions

getUnmarshalErrors

Signature

Description

Exceptions

hasxxx

Signature

Description

Exceptions

hasLoopxxx

Signature

Description

Exceptions

isUnmarshalComplete

Signature

Description

Exceptions

marshal

Signature

Description

Exceptions

marshalToBytes

Signature

Description

Exceptions

marshalToString

Signature

Description

Throws

performValidation

Signature

Description

Exceptions

reset

Signature

Description

Exceptions

setxxx

Signature

Description

Exceptions

setDecimalMark

Signature

Description

Exceptions

setDefaultEDFDelimiters

Signature

Description

Exceptions

Example

setElementSeparator

Signature

Description

Exceptions

Examples

setLoopxxx

Signature

Description

Exceptions

setMaxDataError

Signature

Description

Exceptions

setMaxFreedSegsComsNum

Signature

Description

Exceptions

setMaxParsedSegsComsNum

Signature

Description

Exceptions

setRelease

Signature

Description

Exceptions

setRepetitionSeparator

Signature

Description

Exceptions

Example

setSegmentTerminator

Signature

Description

Exceptions

Example

setSubelementSeparator

Signature

Description

Exceptions

Example

unmarshal

Signature

Description

Exceptions

unmarshalFromBytes

Signature

Description

Exceptions

unmarshalFromString

Signature

Description

Exceptions

EDFOTDErrors Schema File and Sample XML

Contents of the EDFOTDErrors.xsd File

Sample Validation Output XML

Java Methods for UN/EDIFACT OTDs

This topic describes the Java methods available for UN/EDIFACT OTDs and contains the following topics:


Note - You can view complete method information for the EDIFACT OTDs by opening the Class Browser dialog box from the Java Collaboration Definition Editor toolbar.


Get and Set Methods

The OTDs in the EDIFACT Message Library contain the Java methods that enable you to set and get the delimiters, which in turn extend the functionality of the EDIFACT Message Library.

The following get and set methods are available under the root node and at the xxx_Outer, xxx_Inner, and xxx levels:

The following methods are available from the loop elements:

Setting Delimiters and Indicators

The OTDs must include some way for delimiters to be defined so that they can be mapped successfully from one OTD to another. The UN/EDIFACT delimiters are as follows:

When unmarshaling inbound messages, the UN/EDIFACT OTDs use delimiters specified in the UNA segment when that segment is present. If the segment is absent, the OTD uses the default industrial standard delimiters. It is unnecessary to specify delimiters for incoming messages.

For outbound messages using UN/EDIFACT OTDs, you can specify delimiters in two ways:

  1. You can set the delimiter and indicator characters from the corresponding elements within the UNB segment. For more information, refer to UNA Segment Support.

  2. You can set the delimiters in the Java Collaboration Editor using the methods or bean nodes that are provided in the OTDs. Use the following methods to specify delimiters and indicators:

If the input data is already unmarshaled into an UN/EDIFACT OTD, you can use the get methods to retrieve the delimiters from the input data. If the Collaboration puts the data into UN/EDIFACT format, you can use the set methods to set the delimiters in the output OTD. See Get and Set Methods.

Available Methods

This section describes the signature and description for each available UN/EDIFACT OTD method.

check

Signature
public java.lang.String[] check()
Description

Validates the content of the OTD data tree at runtime and returns a string array of validation errors for the message body only; validation errors for envelope segments are not included. To include envelope segments, see the checkAll() method below.

The method returns null if there are no validation errors.

Exceptions

None.

checkAll

Signature
public java.lang.String[] checkAll()
Description

Validates the content of the OTD data tree at runtime and returns a string array of validation errors for the message body and the envelope segments. The checkAll() method is only available for fully enveloped OTDs.

The method returns null if there are no validation errors.

Exceptions

None.

clone

Signature
public java.lang.Object clone()
Description

Creates and returns a copy of this OTD instance.

Exceptions

java.lang.CloneNotSupportedException

countxxx

Signature
public int countxxx()

where xxx is the bean name for repeatable nodes.

Description

Counts the repetitions of the node at runtime.

Exceptions

None.

countLoopxxx

Signature
public int countLoopxxx()

where xxx is the bean node for a repeatable segment loop.

Description

Counts the repetitions of the loop at runtime.

Exceptions

None.

getxxx

Signature
public item getxxx()

where xxx is the bean name for the node and where item is the Java type for the node.

public item[] getxxx()

where xxx is the bean name for the repeatable node and where item[] is the Java type for the node.

Description

Returns the node object or the object array for the node.

Exceptions

None.

getAllErrors

Signature
public java.lang.String[] getAllErrors()
Description

Returns all the validation errors as a string array. These validation errors include errors encountered during unmarshaling input data and the validation results from both the message and the envelope segments.

Exceptions

None.

getDecimalMark

Signature
public char getDecimalMark()
Description

Returns the decimal mark.

Exceptions

None.

getElementSeparator

Signature
public char getElementSeparator()
Description

Gets the elementSeparator character.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new com.stc
.edifact_v3_d95B.EDF_..._Outer();
......
......
char elmSep=myOTD.getElementSeparator();

getFGValidationResult

Signature
public com.stc.otd.runtime.edi.FGError[] getFGValidationResult()
Description

Returns the validation errors for the functional group envelope in the format of an FGError array. This method is available only at the Outer and Inner root levels of fully-enveloped OTDs.

Exceptions

None.

getICValidationResult

Signature
public com.stc.otd.runtime.edi.ICError[] getICValidationResult()
Description

Returns the validation errors for the interchange envelope in the format of an ICError array. This method is available only at the Outer and Inner root levels of fully-enveloped OTDs.

Exceptions

None.

getInputSource

Signature
public byte[] getInputSource()
Description

Returns the byte array of the original input data source.

Exceptions

None.

getLoopxxx

Signature
public item getLoopxxx()

where Loopxxx is the bean name for the segment loop and where item is the Java type for the segment loop.

public item[] getLoopxxx()

where Loopxxx is the bean name for the repeatable segment loop and where item[] is the Java type for the repeatable segment loop.

Description

Returns the segment loop object or the object array for the segment loop.

Exceptions

None.

getMaxDataError

Signature
public int getMaxDataError()
Description

Returns the maximum number of message validation errors held in the msgValidationResult bean node. If this method returns -1 there is no limit of how many errors can be reported.

Exceptions

None.

getMaxFreedSegsComsNum

Signature
public int getMaxFreedSegsComsNum()
Description

Returns the maximum number of segment and composite objects marked to be freed from memory.

Exceptions

None.

getMaxParsedSegsComsNum

Signature
public int getMaxParsedSegsComsNum()
Description

Returns the maximum number of segments and composite objects to be parsed.

Exceptions

None.

getMsgValidationResult

Signature
public com.stc.otd.runtime.check.sef.DataError[] getMsgValidationResult()
Description

Returns the validation errors for the message body. Use this method after the performValidation() method. For information, refer to performValidation.

This method is available at the Outer, Inner, and message root levels of fully-enveloped OTDs. It is also available at the top root level of non-enveloped OTDs.

Exceptions

None.

getRelease

Signature
public char getRelease()
Description

Returns the release character.

Exceptions

None.

getRepetitionSeparator

Signature
public char getRepetitionSeparator()
Description

Returns the repetition separator character.

Exceptions

None.

Examples
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new com.stc.
edifact_v3_d95B.EDF_..._Outer();
......
......
char repSep=myOTD.getRepetitionSeparator();

getSegmentCount

Signature
public int getSegmentCount()
Description

Returns the segment count at the current level.

Exceptions

None.

getSegmentTerminator

Signature
public char getSegmentTerminator()
Description

Returns the segment terminator character.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer 
myOTD=new com.stc.edifact_v3_d95B.EDF_..._Outer();
......
......
char segTerm=myOTD.getSegmentTerminator();

getSubelementSeparator

Signature
public char getSubelementSeparator()
Description

Returns the subelement/composite element separator character.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer 
myOTD=new com.stc.edifact_v3_d95B.EDF_..._Outer();
......
......
char subeleSep=myOTD.getSubelementSeparator();

getTSValidationResult

Signature
public com.stc.otd.runtime.edi.TSError[] getTSValidationResult()
Description

Returns the validation errors for the message envelope (segments UNH/UIH and UNT/UIT) in the format of an TSError array. This method is available only in the Outer, Inner, and message root levels of fully enveloped OTDs. It is also available at the top root level of non-enveloped OTDs.

Exceptions

None.

getUnmarshalErrors

Signature
public com.stc.otd.runtime.check.sef.DataError[] getUnmarshalErrors()
Description

Returns the unmarshal errors as an array of the DataError objects. The unmarshal errors are reported from an UnmarshalException generated during unmarshaling. Usually these errors are associated with otd.isUnmarshalComplete=false.

Exceptions

None.

hasxxx

Signature
public boolean hasxxx()

where xxx is the bean name for the node.

Description

Verifies if the node is present in the runtime data.

Exceptions

None.

hasLoopxxx

Signature
public boolean hasLoopxxx()

where Loopxxx is the bean name for the segment loop.

Description

Verifies if the segment loop is present in the runtime data.

Exceptions

None.

isUnmarshalComplete

Signature
public boolean isUnmarshalComplete()
Description

Flag for whether or not unmarshaling completed successfully. For more information, see On Demand Parsing and Errors and Exceptions.

Exceptions

None.

marshal

Signature
public void marshal(com.stc.otd.runtime.OtdOutputStream)
Description

Marshals the internal data tree into an output stream. For more information, see On Demand Parsing .

Exceptions

java.io.IOException for output problems

com.stc.otd.runtime.MarshalException for an inconsistent internal tree

marshalToBytes

Signature
public byte[] marshalToBytes()
Description

Marshals the internal data tree into a byte array.

Exceptions

java.io.IOException for output problems

com.stc.otd.runtime.MarshalException for an inconsistent internal tree

marshalToString

Signature
public java.lang.String marshalToString()
Description

Marshals the internal data tree into a String.

Throws

java.io.IOException for input problems

com.stc.otd.runtime.MarshalException for an inconsistent internal tree

performValidation

Signature
public void performValidation()
Description

Performs validation on the OTD instance unmarshaled from input data. You can access the validation results from a list of nodes, such as allErrors, msgValidationResult, and the node for reporting envelope errors (such as ICValidationResult, FGValidationResult, and TSValidationResult).

For more information, see UN/EDIFACT Validation Support.

Exceptions

None.

reset

Signature
public void reset()
Description

Clears out any data and resources held by this OTD instance.

Exceptions

None.

setxxx

Signature
public void setxxx(item)

where xxx is the bean name for the node and where item is the Java type for the node.

public void setxxx(item[])

where xxx is the bean name for the repeatable node and where item[] is the Java type for the node.

Description

Sets the node object or the object array for the node.

Exceptions

None.

setDecimalMark

Signature
public void setDecimalMark(char)
Description

Sets the decimal mark.

Exceptions

None.

setDefaultEDFDelimiters

Signature
public void setDefaultEDFDelimiters()
Description

Sets the current delimiters to the default UN/EDIFACT delimiters:

For more information, refer to Setting Delimiters and Indicators.

Exceptions

None

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new
 com.stc.edifact_v3_d95B.EDF_..._Outer();
......
......
myOTD.setDefaultEDFDelimiters();

setElementSeparator

Signature
public void setElementSeparator(char)
Description

Sets the element separator character. For more information, refer to Setting Delimiters and Indicators.

Exceptions

None

Examples
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new com.stc.
edifact_v3_d95B.EDF_..._Outer();
......
......
char c=’+’;
myOTD.setElementSeparator(c);

setLoopxxx

Signature
public void setLoopxxx(item)

where Loopxxx is the bean name for the segment loop and where item is the Java type for the segment loop.

public void setLoopxxx(item[])

where Loopxxx is the bean name for the repeatable segment loop and where item[] is the Java type for the repeatable segment loop.

Description

Sets the segment loop object or the object array for the segment loop.

Exceptions

None.

setMaxDataError

Signature
public void setMaxDataError(int)
Description

Returns the maximum number of message validation errors held in the msgValidationResult bean node. If this method returns -1 there is no limit of how many errors can be reported.

Exceptions

None.

setMaxFreedSegsComsNum

Signature
public void setMaxFreedSegsComsNum(int)
Description

Sets the maximum number of segment and composite objects marked to be freed from memory. For more information, see On Demand Parsing.

Exceptions

None.

setMaxParsedSegsComsNum

Signature
public void setMaxParsedSegsComsNum(int)
Description

Sets the maximum number of segments and composite objects to be parsed. For more information, refer to On Demand Parsing.

Exceptions

None.

setRelease

Signature
public void setRelease(char)
Description

Sets the release character.

Exceptions

None.

setRepetitionSeparator

Signature
public void setRepetitionSeparator(char)
Description

Sets the repetition separator character. For more information, refer to Setting Delimiters and Indicators.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new
 com.stc.edifact_v3_d95B.EDF_..._Outer();
......
......
char c=’*’;
myOTD.setRepetitionSeparator(c);

setSegmentTerminator

Signature
public void setSegmentTerminator(char)
Description

Sets the segment terminator character. For more information, see Setting Delimiters and Indicators.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new com.stc.
edifact_v3_d95B.EDF_..._Outer();
......
......
char c=’~’;
myOTD.setSegmentTerminator(c);

setSubelementSeparator

Signature
public void setSubelementSeparator(char)
Description

Sets the subelement separator character. For more information, see Setting Delimiters and Indicators.

Exceptions

None.

Example
com.stc.edifact_v3_d95B.EDF_..._...Outer myOTD=new com.stc.
edifact_v3_d95B.EDF_..._Outer();
......
......
char c=’:’;
myOTD.setSubelementSeparator(c);

unmarshal

Signature
public void unmarshal(com.stc.otd.runtime.OtdInputStream)
Description

Unmarshals the given input into an internal data tree. For more information, see On Demand Parsing and Errors and Exceptions.

Exceptions

java.io.IOException for output problems

com.stc.otd.runtime.UnmarshalException for a lexical or other mismatch

unmarshalFromBytes

Signature
public void unmarshalFromBytes(byte[])
Description

Unmarshals the given input byte array into an internal data tree.

Exceptions

java.io.IOException for input problems

com.stc.otd.runtime.UnmarshalException for an inconsistent internal tree

unmarshalFromString

Signature
public void unmarshalFromString(java.lang.String)
Description

Unmarshals (deserializes, parses) the given input string into an internal data tree.

Exceptions

java.io.IOException for input problems

com.stc.otd.runtime.UnmarshalException for an inconsistent internal tree. This typically occurs when the OTD does not recognize the incoming message as X12.