Open Business Objects for EDI
v3.6.0

com.americancoders.edi
Class Envelope

java.lang.Object
  |
  +--com.americancoders.edi.SegmentContainer
        |
        +--com.americancoders.edi.Envelope
All Implemented Interfaces:
IContainedObject, IIdentifier, ISegmentContainer
Direct Known Subclasses:
ACHEnvelope, EDIFactEnvelope, TradacomsEnvelope, X12Envelope

public abstract class Envelope
extends SegmentContainer
implements IContainedObject, ISegmentContainer

class for wrapping an EDI transaction set within an EDI Envelope


Nested Class Summary
protected  class Envelope.PreDelimiter
           
 
Field Summary
static int ACH_FORMAT
          indicates file format
static int ACH_FORMAT_FOR_CBR_PBR
          indicates file format
static int CSV_FORMAT
          indicates file format
static java.lang.String EDIFact_ESCAPE_CHARACTER
           
static java.lang.String EDIFact_FIELD_DELIMITER
           
static int EDIFACT_FORMAT
          indicates file format
static java.lang.String EDIFact_GROUP_DELIMITER
           
static java.lang.String EDIFact_REPEAT_DELIMITER
           
static java.lang.String EDIFact_SEGMENT_DELIMITER
           
 java.lang.String escapeCharacter
           
 java.lang.String fieldDelimiter
           
static int FIXED_LENGTH_FORMAT
          indicates file format
protected  int format
          Envelope
protected  java.util.Vector functionalGroups
          store functional groups in an vector
 java.lang.String groupDelimiter
           
protected  com.americancoders.edi.TemplateEnvelope myTemplate
          store template object
static int PIXES_FORMAT
          indicates file format
static java.lang.String PREBUILD_ESCAPE_DELIMITER
          constant for element escape character
static java.lang.String PREBUILD_FIELD_DELIMITER
          constant for field delimiter
static int PREBUILD_FORMAT
          indicates file format
static java.lang.String PREBUILD_GROUP_DELIMITER
          constant for group delimiter
static java.lang.String PREBUILD_REPEAT_DELIMITER
          constant for element repeat character
static java.lang.String PREBUILD_SEGID_DELIMITER
          TRADACOMS has one more
static java.lang.String PREBUILD_SEGMENT_DELIMITER
          constant for segment delimiter
 java.lang.String repeatDelimiter
           
protected  com.americancoders.edi.Envelope response
          response envelope if this is outgoing then it's the receiver response if it's not outgoing then it is response to this incoming envelope
protected  java.lang.String revision
          revision (3040, D99A...
 java.lang.String segmentDelimiter
           
static java.lang.String TRADACOMS_ESCAPE_CHARACTER
           
static java.lang.String TRADACOMS_FIELD_DELIMITER
           
static int TRADACOMS_FORMAT
          indicates file format
static java.lang.String TRADACOMS_GROUP_DELIMITER
           
static java.lang.String TRADACOMS_REPEAT_DELIMITER
           
static java.lang.String TRADACOMS_SEGID_DELIMITER
           
static java.lang.String TRADACOMS_SEGMENT_DELIMITER
           
static int VALID_XML_FORMAT
          indicates file format
static int VALID_XML_FORMAT_WITH_POSITION
          indicates file format
static java.lang.String X12_ESCAPE_CHARACTER
           
static java.lang.String X12_FIELD_DELIMITER
           
static int X12_FORMAT
          indicates file format
static java.lang.String X12_GROUP_DELIMITER
           
static java.lang.String X12_REPEAT_DELIMITER
           
static java.lang.String X12_SEGMENT_DELIMITER
           
static int XML_FORMAT
          indicates file format,
use this for getFormattedText calls and other methods that need to know or use the transaction set type
 
Fields inherited from class com.americancoders.edi.SegmentContainer
container, dupSegment, myTemplateContainer
 
Constructor Summary
Envelope()
          instantiates the class from all related OBOE classes
 
Method Summary
 void addFunctionalGroup(com.americancoders.edi.FunctionalGroup inFunctionalGroup)
          adds a Functional Group object to the vector (container);
abstract  com.americancoders.edi.FunctionalGroup createFunctionalGroup()
          creates a basic functionalgroup object
 int getFormat()
          gets the format attribute
static int getFormat(org.w3c.dom.Node node)
          gets the format of an well formed xml envelope by peeking into the envelope
abstract  java.lang.String getFormattedText(int format)
           
abstract  com.americancoders.edi.FunctionalGroup getFunctionalGroup(int pos)
          gets a Functional Group object from the vector (container);
check for runtime array out of bounds exception
abstract  int getFunctionalGroupCount()
          gets the count of Functional Group object in the vector (container);
abstract  java.util.Vector getFunctionalGroups()
          gets the Vector of Functional Group objects
 java.lang.String getID()
          returns the ID which is "envelope".
abstract  com.americancoders.edi.Segment getInterchange_Header()
          gets the Interchange Header
abstract  com.americancoders.edi.Segment getInterchange_Trailer()
          gets the Interchange Trailer
 com.americancoders.edi.IContainedObject getParent()
          gets parent attribute
 com.americancoders.edi.Envelope getResponse()
          gets the response attribute
 java.lang.String getRevision()
          gets the revision attribute
 com.americancoders.edi.TemplateSegment getTemplateSegment(java.lang.String inID)
          method of SegmentContainer interface
Envelope's segments built from instance methods so we return a null and hope the call can figure it out
 com.americancoders.edi.TemplateSegmentContainer getTemplateSegmentContainer()
          return segment container template
 java.lang.String getXMLTag()
          gets the xml tag
abstract  void parse(org.w3c.dom.Node node)
           
abstract  boolean parse(java.io.PushbackInputStream pis)
           
static com.americancoders.edi.Envelope processEDIEnvelope(java.io.InputStream inStream)
           
 void setDelimiters(java.lang.String inDelimiters)
          sets the segment, field, group (compositeDE) delimiters
if you need to use different delimiters, call this method prior to the first getFormattedText call.
 void setDelimitersFromProperties()
          sets the segment, field, group (compositeDE) delimiters from the properties file.
abstract  void setDelimitersInHeader()
          sets the Delimter fields in the header
abstract  void setFGCountInTrailer()
          sets the functional group count in the trailer
 void setFormat(int inFormat)
          sets the format attribute
 void setParent(com.americancoders.edi.IContainedObject inParent)
          sets parent attribute
 void setResponse(com.americancoders.edi.Envelope inResponse)
          sets the respons attribute
 void setRevision(java.lang.String inRevision)
          sets the revision attribute
 java.lang.String toString()
          the toString method
 int trim()
          removes unused Segments and return the number of subsegments in container
abstract  void validate()
          validate contents of envelope
abstract  void validate(com.americancoders.edi.DocumentErrors inDErr)
          validate contents of envelope
doesn't throw exceptions but places errors in DocumentErrors object
abstract  void writeFormattedText(java.io.Writer inWriter, int format)
          like getFormattedText; writes to a Writer object instead of building a string.
 
Methods inherited from class com.americancoders.edi.SegmentContainer
addSegment, addSegment, addSegment, addSegmentToVector, createSegment, createSegment, createSegmentByIDAndName, defineContainer, equivalentSegments, getContainerSize, getSegment, getSegment, getSegment, getSegment, getSegment, getSegment, getSegmentByDataElementValue, getSegmentCount, getSegmentCount, isNull, isSegment, isSegment, isVector, parse, removeSegment, removeSegment, removeSegment, removeSegment, resetToFirstEquivalentSegment, setSegmentAt, setSegmentAt, whyNotUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.americancoders.edi.ISegmentContainer
addSegment, createSegment, getSegment, getSegment, getSegmentCount, removeSegment
 

Field Detail

functionalGroups

protected java.util.Vector functionalGroups
store functional groups in an vector


myTemplate

protected com.americancoders.edi.TemplateEnvelope myTemplate
store template object


format

protected int format
Envelope


PREBUILD_FORMAT

public static final int PREBUILD_FORMAT
indicates file format

See Also:
Constant Field Values

XML_FORMAT

public static final int XML_FORMAT
indicates file format,
use this for getFormattedText calls and other methods that need to know or use the transaction set type

See Also:
Constant Field Values

X12_FORMAT

public static final int X12_FORMAT
indicates file format

See Also:
Constant Field Values

EDIFACT_FORMAT

public static final int EDIFACT_FORMAT
indicates file format

See Also:
Constant Field Values

VALID_XML_FORMAT

public static final int VALID_XML_FORMAT
indicates file format

See Also:
Constant Field Values

CSV_FORMAT

public static final int CSV_FORMAT
indicates file format

See Also:
Constant Field Values

FIXED_LENGTH_FORMAT

public static final int FIXED_LENGTH_FORMAT
indicates file format

See Also:
Constant Field Values

TRADACOMS_FORMAT

public static final int TRADACOMS_FORMAT
indicates file format

See Also:
Constant Field Values

VALID_XML_FORMAT_WITH_POSITION

public static final int VALID_XML_FORMAT_WITH_POSITION
indicates file format

See Also:
Constant Field Values

ACH_FORMAT

public static final int ACH_FORMAT
indicates file format

See Also:
Constant Field Values

ACH_FORMAT_FOR_CBR_PBR

public static final int ACH_FORMAT_FOR_CBR_PBR
indicates file format

See Also:
Constant Field Values

PIXES_FORMAT

public static final int PIXES_FORMAT
indicates file format

See Also:
Constant Field Values

revision

protected java.lang.String revision
revision (3040, D99A...


response

protected com.americancoders.edi.Envelope response
response envelope if this is outgoing then it's the receiver response if it's not outgoing then it is response to this incoming envelope


PREBUILD_SEGMENT_DELIMITER

public static final java.lang.String PREBUILD_SEGMENT_DELIMITER
constant for segment delimiter

See Also:
Constant Field Values

X12_SEGMENT_DELIMITER

public static final java.lang.String X12_SEGMENT_DELIMITER
See Also:
Constant Field Values

EDIFact_SEGMENT_DELIMITER

public static final java.lang.String EDIFact_SEGMENT_DELIMITER
See Also:
Constant Field Values

TRADACOMS_SEGMENT_DELIMITER

public static final java.lang.String TRADACOMS_SEGMENT_DELIMITER
See Also:
Constant Field Values

segmentDelimiter

public java.lang.String segmentDelimiter

PREBUILD_FIELD_DELIMITER

public static final java.lang.String PREBUILD_FIELD_DELIMITER
constant for field delimiter

See Also:
Constant Field Values

X12_FIELD_DELIMITER

public static final java.lang.String X12_FIELD_DELIMITER
See Also:
Constant Field Values

EDIFact_FIELD_DELIMITER

public static final java.lang.String EDIFact_FIELD_DELIMITER
See Also:
Constant Field Values

TRADACOMS_FIELD_DELIMITER

public static final java.lang.String TRADACOMS_FIELD_DELIMITER
See Also:
Constant Field Values

fieldDelimiter

public java.lang.String fieldDelimiter

PREBUILD_GROUP_DELIMITER

public static final java.lang.String PREBUILD_GROUP_DELIMITER
constant for group delimiter

See Also:
Constant Field Values

X12_GROUP_DELIMITER

public static final java.lang.String X12_GROUP_DELIMITER
See Also:
Constant Field Values

EDIFact_GROUP_DELIMITER

public static final java.lang.String EDIFact_GROUP_DELIMITER
See Also:
Constant Field Values

TRADACOMS_GROUP_DELIMITER

public static final java.lang.String TRADACOMS_GROUP_DELIMITER
See Also:
Constant Field Values

groupDelimiter

public java.lang.String groupDelimiter

PREBUILD_REPEAT_DELIMITER

public static final java.lang.String PREBUILD_REPEAT_DELIMITER
constant for element repeat character

See Also:
Constant Field Values

X12_REPEAT_DELIMITER

public static final java.lang.String X12_REPEAT_DELIMITER
See Also:
Constant Field Values

EDIFact_REPEAT_DELIMITER

public static final java.lang.String EDIFact_REPEAT_DELIMITER
See Also:
Constant Field Values

TRADACOMS_REPEAT_DELIMITER

public static final java.lang.String TRADACOMS_REPEAT_DELIMITER
See Also:
Constant Field Values

repeatDelimiter

public java.lang.String repeatDelimiter

PREBUILD_ESCAPE_DELIMITER

public static final java.lang.String PREBUILD_ESCAPE_DELIMITER
constant for element escape character

See Also:
Constant Field Values

X12_ESCAPE_CHARACTER

public static final java.lang.String X12_ESCAPE_CHARACTER
See Also:
Constant Field Values

EDIFact_ESCAPE_CHARACTER

public static final java.lang.String EDIFact_ESCAPE_CHARACTER
See Also:
Constant Field Values

TRADACOMS_ESCAPE_CHARACTER

public static final java.lang.String TRADACOMS_ESCAPE_CHARACTER
See Also:
Constant Field Values

escapeCharacter

public java.lang.String escapeCharacter

PREBUILD_SEGID_DELIMITER

public static final java.lang.String PREBUILD_SEGID_DELIMITER
TRADACOMS has one more

See Also:
Constant Field Values

TRADACOMS_SEGID_DELIMITER

public static final java.lang.String TRADACOMS_SEGID_DELIMITER
See Also:
Constant Field Values
Constructor Detail

Envelope

public Envelope()
instantiates the class from all related OBOE classes

Method Detail

getTemplateSegmentContainer

public com.americancoders.edi.TemplateSegmentContainer getTemplateSegmentContainer()
Description copied from interface: ISegmentContainer
return segment container template

Specified by:
getTemplateSegmentContainer in interface ISegmentContainer
Returns:
TemplateSegmentContainer

setDelimitersFromProperties

public void setDelimitersFromProperties()
sets the segment, field, group (compositeDE) delimiters from the properties file.
if you need to use different delimiters, call this method prior to the first getFormattedText call. You only need to call it once since all delimiters are defined as class variables and as such the method contains logic so that it only works on the first method call. Uses property x12Delimiters. x12Delimiters format is 3 characters
  1. segment
  2. field
  3. group
If property is not found it uses the default

in OBOE.properties files add the following
&nbps; x12Delimiters="!@#"
&nbps; EDIFactDelimiters="..."

at this time no exceptions are thrown, all exceptions are caught and written to the System.err file.


setDelimiters

public void setDelimiters(java.lang.String inDelimiters)
sets the segment, field, group (compositeDE) delimiters
if you need to use different delimiters, call this method prior to the first getFormattedText call. You only need to call it once since all delimiters are defined as class variables

Parameters:
inDelimiters - String format is 3 or 4 or 5 characters
  1. segment
  2. field
  3. group
  4. repeat
  5. escape

parse

public abstract void parse(org.w3c.dom.Node node)
                    throws OBOEException,
                           java.io.FileNotFoundException,
                           java.io.IOException
OBOEException
java.io.FileNotFoundException
java.io.IOException

parse

public abstract boolean parse(java.io.PushbackInputStream pis)
                       throws OBOEException,
                              java.io.FileNotFoundException,
                              java.io.IOException
OBOEException
java.io.FileNotFoundException
java.io.IOException

getFormattedText

public abstract java.lang.String getFormattedText(int format)
                                           throws OBOEException
Parameters:
format - int - format type see TransactionSet
Returns:
a formatted document in a String
Throws:
OBOEException

writeFormattedText

public abstract void writeFormattedText(java.io.Writer inWriter,
                                        int format)
                                 throws OBOEException,
                                        java.io.IOException
like getFormattedText; writes to a Writer object instead of building a string.

Parameters:
inWriter - writer - object written to
format - int - format type see TransactionSet
Throws:
OBOEException
java.io.IOException

validate

public abstract void validate()
                       throws OBOEException
validate contents of envelope

Throws:
OBOEException

validate

public abstract void validate(com.americancoders.edi.DocumentErrors inDErr)
validate contents of envelope
doesn't throw exceptions but places errors in DocumentErrors object


getInterchange_Header

public abstract com.americancoders.edi.Segment getInterchange_Header()
gets the Interchange Header

Returns:
Segment

getInterchange_Trailer

public abstract com.americancoders.edi.Segment getInterchange_Trailer()
gets the Interchange Trailer

Returns:
Segment

createFunctionalGroup

public abstract com.americancoders.edi.FunctionalGroup createFunctionalGroup()
creates a basic functionalgroup object

Returns:
FunctionalGroup

addFunctionalGroup

public void addFunctionalGroup(com.americancoders.edi.FunctionalGroup inFunctionalGroup)
adds a Functional Group object to the vector (container);

Parameters:
inFunctionalGroup - a functional Group object

getFunctionalGroupCount

public abstract int getFunctionalGroupCount()
gets the count of Functional Group object in the vector (container);

Returns:
int count

getFunctionalGroup

public abstract com.americancoders.edi.FunctionalGroup getFunctionalGroup(int pos)
gets a Functional Group object from the vector (container);
check for runtime array out of bounds exception

Parameters:
pos - int position within container.
Returns:
a FunctionalGroup object

getFunctionalGroups

public abstract java.util.Vector getFunctionalGroups()
gets the Vector of Functional Group objects

Returns:
a Vector of FunctionalGroup objects

setFormat

public void setFormat(int inFormat)
sets the format attribute

Parameters:
inFormat - - int

getFormat

public int getFormat()
gets the format attribute

Returns:
int

getFormat

public static int getFormat(org.w3c.dom.Node node)
                     throws OBOEException
gets the format of an well formed xml envelope by peeking into the envelope

Parameters:
node - DOM Node
Returns:
int
Throws:
OBOEException - an envelope node not passed
OBOEException - incorrect interchange header node.

setRevision

public void setRevision(java.lang.String inRevision)
sets the revision attribute

Parameters:
inRevision - - String

getRevision

public java.lang.String getRevision()
gets the revision attribute

Returns:
String

setResponse

public void setResponse(com.americancoders.edi.Envelope inResponse)
sets the respons attribute

Parameters:
inResponse - - Envelope

getResponse

public com.americancoders.edi.Envelope getResponse()
gets the response attribute

Returns:
Envelope

setDelimitersInHeader

public abstract void setDelimitersInHeader()
                                    throws OBOEException
sets the Delimter fields in the header

OBOEException

setFGCountInTrailer

public abstract void setFGCountInTrailer()
                                  throws OBOEException
sets the functional group count in the trailer

OBOEException

getTemplateSegment

public com.americancoders.edi.TemplateSegment getTemplateSegment(java.lang.String inID)
method of SegmentContainer interface
Envelope's segments built from instance methods so we return a null and hope the call can figure it out

Parameters:
inID - - template segment to get
Returns:
TemplateSegment - in this case a null

getID

public java.lang.String getID()
returns the ID which is "envelope".
required for SegmentContainer interface

Specified by:
getID in interface IIdentifier
Specified by:
getID in class SegmentContainer
Returns:
String

setParent

public void setParent(com.americancoders.edi.IContainedObject inParent)
Description copied from interface: IContainedObject
sets parent attribute

Specified by:
setParent in interface IContainedObject
Parameters:
inParent - IContainedObject

getParent

public com.americancoders.edi.IContainedObject getParent()
Description copied from interface: IContainedObject
gets parent attribute

Specified by:
getParent in interface IContainedObject
Returns:
IContainedObject

getXMLTag

public java.lang.String getXMLTag()
Description copied from interface: IIdentifier
gets the xml tag

Specified by:
getXMLTag in interface IIdentifier
Returns:
String

processEDIEnvelope

public static com.americancoders.edi.Envelope processEDIEnvelope(java.io.InputStream inStream)
                                                          throws OBOEException,
                                                                 java.io.IOException
OBOEException
java.io.IOException

toString

public java.lang.String toString()
the toString method

Overrides:
toString in class java.lang.Object

trim

public int trim()
Description copied from class: SegmentContainer
removes unused Segments and return the number of subsegments in container

Overrides:
trim in class SegmentContainer
Returns:
int

Open Business Objects for EDI
v3.6.0


OBOE is a trademark or registered trademark of American Coders, Ltd. in the US and other countries.
Copyright 1999-2004 American Coders, Ltd.
POB 97462
Raleigh NC 27624 USA
All Rights Reserved.