Open Business Objects for EDI
v3.6.0

com.americancoders.edi
Class CompositeDE

java.lang.Object
  |
  +--com.americancoders.edi.CompositeDE
All Implemented Interfaces:
IContainedObject, IDataElementContainer, IIdentifier

public class CompositeDE
extends java.lang.Object
implements IDataElementContainer, IContainedObject

class for all Composite Data Elements

OBOE - Open Business Objects for EDI

Part of the OBOE Basic Extended Package
An EDI and XML Translator Written In Java
Copyright 1998-2009 - American Coders, LTD - Raleigh NC USA
All rights reserved
American Coders, Ltd
P. O. Box 97462
Raleigh, NC 27624 USA
1-919-846-2014
http://www.americancoders.com

Version:
3.6.0
Author:
Joe McVerry - American Coders, Ltd.

Field Summary
protected  int cursor
          cursor to current deArrayGroup
protected  java.lang.Object[] deArray
          an array of Field objects
protected  java.util.Vector deArrayGroup
          deArray group
protected  com.americancoders.edi.TemplateComposite myTemplate
          String of composite's xml tag
protected  com.americancoders.edi.IContainedObject parent
          owning object
 
Constructor Summary
CompositeDE(com.americancoders.edi.TemplateComposite inTemplateComposite, com.americancoders.edi.IContainedObject inParent)
          creates a compsosite using a templage
 
Method Summary
 java.lang.Object buildDE(int pos)
          defines a dataelement by the predefined templateDE array
 java.lang.Object buildDE(java.lang.String ID)
          defines a dataelement by the predefined templateDE array
 java.lang.Object[] createNewGroup()
          creates a new dearray set for multi-occuring composites
 int doIUseThisXMLElement(java.lang.String inTag, int startAt)
          routine to ask if it uses a dataelement
 java.lang.String get()
          returns all the data associated
field values separated by '*'
 com.americancoders.edi.DataElement getDataElement(int inPos)
          returns a data element by its location
 com.americancoders.edi.DataElement getDataElement(java.lang.String inID)
          returns a data element by its id
 int getDataElementLength()
          returns the length of the data in the data elements
 int getDataElementSize()
          returns the number of defined data element
 java.lang.String getDataElementValue(int pos)
          returns the value set in the data element if the data element is not built it will return a zero-length string.
 java.lang.String getDataElementValue(java.lang.String ID)
          returns the value set in the data element if the data element is not built it will return a zero-length string.
 int getDEArrayCount()
          returns number of elements in deArrayGroup
 java.lang.String getFixedLengthFormattedText()
          gets the text formatted to maximum length of fields
 java.lang.String getFormattedText(int formatType)
          returns the formatted text
 java.lang.String getID()
          returns the id field
 java.lang.String getName()
          returns the name field
 int getOccurs()
          returns the occurs value
 com.americancoders.edi.IContainedObject getParent()
          gets parent attribute
 char getRequired()
          returns the required indicator
 int getSequence()
          returns the sequence
 com.americancoders.edi.TemplateComposite getTemplate()
          returns the templateComposite object used to build this CompoisteDE
 java.lang.String getXMLTag()
          returns the xml tag field
 int gotoGroup(int inPos)
          moves the cursor to a dearraygroup and resets the group.
 boolean isDataElement(int inPos)
          returns a boolean if vector position held by a data element
 boolean isUsed()
          returns boolean indicating if composite is used
 java.lang.Object[] nextGroup()
          moves the cursor to the next group
 boolean parse(com.americancoders.edi.ITokenizer TransactionTokenizedString)
          parsing logic for compositeDE
 void parse(org.w3c.dom.Node node)
          parses a XML EDI Document adds to datalement vector
 void parse(java.io.PushbackInputStream pis)
          parses a Fixed Length EDI Document adds to datalement vector or compositeDE and adds to secondary segment vector
 boolean parse(java.lang.String TokenizedString, com.americancoders.edi.ITokenizer TransactionTokenizedString)
          parsing logic for compositeDE for repeating composites
 int resetCursor()
          moves the cursor to the first deArray and sets the deArray
 com.americancoders.edi.DataElement setDataElementValue(int pos, java.lang.String inValue)
          sets the value set in the data element without needing to build the data element object if the data element is not built it will be built.
 com.americancoders.edi.DataElement setDataElementValue(java.lang.String ID, java.lang.String inValue)
          returns the value set in the data element if the data element is not built it will return a zero-length string.
 void setParent(com.americancoders.edi.IContainedObject inParent)
          sets parent attribute
 java.lang.String toString()
          the toString method
 int trim()
          removes empty trailing data elements and returns the number of used dataelements
 void validate(com.americancoders.edi.DocumentErrors inDErr)
          returns error responses of contents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

deArray

protected java.lang.Object[] deArray
an array of Field objects


myTemplate

protected com.americancoders.edi.TemplateComposite myTemplate
String of composite's xml tag


cursor

protected int cursor
cursor to current deArrayGroup


deArrayGroup

protected java.util.Vector deArrayGroup
deArray group


parent

protected com.americancoders.edi.IContainedObject parent
owning object

Constructor Detail

CompositeDE

public CompositeDE(com.americancoders.edi.TemplateComposite inTemplateComposite,
                   com.americancoders.edi.IContainedObject inParent)
creates a compsosite using a templage

Parameters:
inTemplateComposite - TemplateComposite used to build this composite
inParent - owning Object
Method Detail

getTemplate

public com.americancoders.edi.TemplateComposite getTemplate()
returns the templateComposite object used to build this CompoisteDE

Returns:
TemplateComposite

buildDE

public java.lang.Object buildDE(int pos)
defines a dataelement by the predefined templateDE array

Specified by:
buildDE in interface IDataElementContainer
Parameters:
pos - field to build is identified by its templates position
position is relative to 1.
Returns:
Object always a DataElement, I used Object to keep it consistent with what Segments buildDE returns.

createNewGroup

public java.lang.Object[] createNewGroup()
                                  throws OBOEException
creates a new dearray set for multi-occuring composites

Returns:
Object[]
Throws:
OBOEException

gotoGroup

public int gotoGroup(int inPos)
              throws OBOEException
moves the cursor to a dearraygroup and resets the group.
offset by 1

Parameters:
inPos -
Returns:
int offset in vector
Throws:
OBOEException

resetCursor

public int resetCursor()
                throws OBOEException
moves the cursor to the first deArray and sets the deArray

Returns:
int always zero
Throws:
OBOEException

getDEArrayCount

public int getDEArrayCount()
                    throws OBOEException
returns number of elements in deArrayGroup

Returns:
int
OBOEException

nextGroup

public java.lang.Object[] nextGroup()
                             throws OBOEException
moves the cursor to the next group

Returns:
Object[], null if at end of group
Throws:
OBOEException

getID

public java.lang.String getID()
returns the id field

Specified by:
getID in interface IIdentifier
Returns:
String id value

getName

public java.lang.String getName()
returns the name field

Returns:
String name value

getXMLTag

public java.lang.String getXMLTag()
returns the xml tag field

Specified by:
getXMLTag in interface IIdentifier
Returns:
String tag value

isUsed

public boolean isUsed()
returns boolean indicating if composite is used

Returns:
boolean

getRequired

public char getRequired()
returns the required indicator

Returns:
char

getSequence

public int getSequence()
returns the sequence

Returns:
int

getOccurs

public int getOccurs()
returns the occurs value

Returns:
int

getDataElementSize

public int getDataElementSize()
returns the number of defined data element

Specified by:
getDataElementSize in interface IDataElementContainer
Returns:
int DataElement count

getDataElement

public com.americancoders.edi.DataElement getDataElement(java.lang.String inID)
returns a data element by its id

Specified by:
getDataElement in interface IDataElementContainer
Parameters:
inID - String id of dataelement to return
Returns:
DataElement

getDataElement

public com.americancoders.edi.DataElement getDataElement(int inPos)
returns a data element by its location

Specified by:
getDataElement in interface IDataElementContainer
Parameters:
inPos - int position of data element to return
position is relative to 1.
Returns:
DataElement

isDataElement

public boolean isDataElement(int inPos)
returns a boolean if vector position held by a data element

Parameters:
inPos - is object in the array a dataelement
position is relative to 1.
Returns:
boolean

parse

public boolean parse(com.americancoders.edi.ITokenizer TransactionTokenizedString)
              throws OBOEException
parsing logic for compositeDE

Parameters:
TransactionTokenizedString -
Returns:
boolean true if tokenizedstring was used
Throws:
OBOEException - most likely the composite item can't find any of the fields coming in.

parse

public boolean parse(java.lang.String TokenizedString,
                     com.americancoders.edi.ITokenizer TransactionTokenizedString)
              throws OBOEException
parsing logic for compositeDE for repeating composites

Parameters:
TokenizedString - String partially tokenized
TransactionTokenizedString - ITokenizer - parent of DataTokenizer
Returns:
boolean true if tokenizedstring was used
Throws:
OBOEException - most likely the composite item can't find any of the fields coming in.

parse

public void parse(java.io.PushbackInputStream pis)
           throws OBOEException,
                  java.io.IOException
parses a Fixed Length EDI Document adds to datalement vector or compositeDE and adds to secondary segment vector

Parameters:
pis - PushbackInputStream
Throws:
OBOEException - as thrown
java.io.IOException

parse

public void parse(org.w3c.dom.Node node)
           throws OBOEException
parses a XML EDI Document adds to datalement vector

Parameters:
node - Node
Throws:
OBOEException - Node is unknown to composite

get

public java.lang.String get()
returns all the data associated
field values separated by '*'

Returns:
String for all DataElements

getDataElementLength

public int getDataElementLength()
returns the length of the data in the data elements

Returns:
int

getFormattedText

public java.lang.String getFormattedText(int formatType)
returns the formatted text

Parameters:
formatType - x12, edifact...
Returns:
String of formatted text

validate

public void validate(com.americancoders.edi.DocumentErrors inDErr)
returns error responses of contents

Parameters:
inDErr - DocumentErrors

trim

public int trim()
removes empty trailing data elements and returns the number of used dataelements

Returns:
int

doIUseThisXMLElement

public int doIUseThisXMLElement(java.lang.String inTag,
                                int startAt)
routine to ask if it uses a dataelement

Parameters:
inTag - String id
startAt - int position to start at
Returns:
boolen true the segment id is part of this group

setParent

public void setParent(com.americancoders.edi.IContainedObject inParent)
sets parent attribute

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

getParent

public com.americancoders.edi.IContainedObject getParent()
gets parent attribute

Specified by:
getParent in interface IContainedObject
Returns:
TemplateSegmentContainer

getFixedLengthFormattedText

public java.lang.String getFixedLengthFormattedText()
gets the text formatted to maximum length of fields

Returns:
String

toString

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

Overrides:
toString in class java.lang.Object

buildDE

public java.lang.Object buildDE(java.lang.String ID)
Description copied from interface: IDataElementContainer
defines a dataelement by the predefined templateDE array

Specified by:
buildDE in interface IDataElementContainer
Parameters:
ID - field to build is identified by its templates id value
Returns:
Object always a DataElement, I used Object to keep it consistent with what Segments buildDE returns.

getDataElementValue

public java.lang.String getDataElementValue(java.lang.String ID)
                                     throws OBOEException
Description copied from interface: IDataElementContainer
returns the value set in the data element if the data element is not built it will return a zero-length string. if the position is out of range the OBOEException will be thrown.

Specified by:
getDataElementValue in interface IDataElementContainer
Parameters:
ID - String ID of datalement to look for
Returns:
String contents of data lement
Throws:
OBOEException - ID is unknown, or position is for a composite de

getDataElementValue

public java.lang.String getDataElementValue(int pos)
                                     throws OBOEException
Description copied from interface: IDataElementContainer
returns the value set in the data element if the data element is not built it will return a zero-length string. if the position is out of range the OBOEException will be thrown.

Specified by:
getDataElementValue in interface IDataElementContainer
Parameters:
pos - int position within the segement
Returns:
String contents of data lement
Throws:
OBOEException - ID is unknown

setDataElementValue

public com.americancoders.edi.DataElement setDataElementValue(java.lang.String ID,
                                                              java.lang.String inValue)
                                                       throws OBOEException
Description copied from interface: IDataElementContainer
returns the value set in the data element if the data element is not built it will return a zero-length string. if the position is out of range the OBOEException will be thrown.

Specified by:
setDataElementValue in interface IDataElementContainer
Parameters:
ID - String ID of datalement to look for
Returns:
DataElement DataElement object
Throws:
OBOEException - ID is unknown, or position is for a composite de

setDataElementValue

public com.americancoders.edi.DataElement setDataElementValue(int pos,
                                                              java.lang.String inValue)
                                                       throws OBOEException
Description copied from interface: IDataElementContainer
sets the value set in the data element without needing to build the data element object if the data element is not built it will be built. if the position is out of range the OBOEException will be thrown.

Specified by:
setDataElementValue in interface IDataElementContainer
Parameters:
pos - int position within the segement
Returns:
DataElement DataElement object
Throws:
OBOEException - ID is unknown

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.