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 |
_iElement
current element number |
protected int |
_iLine
current line number |
protected java.io.CharArrayWriter |
contents
simple string processor |
protected com.americancoders.edi.TemplateComposite |
currentCompositeDE
current composite |
protected com.americancoders.edi.TemplateDE |
currentDataElement
current element |
protected java.lang.String |
currentID
current id string |
protected com.americancoders.edi.IDList |
currentIDList
current list of ids |
protected com.americancoders.edi.IDListProcessor |
currentIDListProcessor
id list processor |
protected com.americancoders.edi.TemplateLoop |
currentLoop
loop for loop control |
protected com.americancoders.edi.TemplateLoopContainer |
currentLoopContainer
current container for segments either a table or segments |
protected java.util.Stack |
currentLoopContainerStack
stack, since segments can be held by table and segments and
datalements by segments and composites we keep track of container depth through a stack |
protected com.americancoders.edi.TemplateSegment |
currentSegment
current segment |
protected com.americancoders.edi.TemplateTable |
currentTable
current Table |
protected com.americancoders.edi.TemplateTransactionSet |
currentTransactionSet
current transaction set |
protected java.util.Vector |
currentVector
current Vector for IDList processing |
protected java.lang.String |
elementID
|
protected java.lang.String |
idCode
current idCode string
code comes before value so save it |
protected java.lang.String |
idListFile
current idListFile name |
protected com.americancoders.edi.IDListParser |
idListParser
current IDList parser object |
protected java.util.Hashtable |
idLists
list of IDs |
protected java.lang.String |
nameOrID
|
protected java.lang.String |
nodeName
last node parsed |
protected java.lang.String |
segmentID
used to build the xmlTag if no xmlTag is defined |
static int |
typeSet
|
protected java.lang.String |
xmlDirectoryPath
directory path for xml file as specified in OBOE.properties |
protected java.lang.String |
xmlFoundDirectoryPath
directory path for found xml file |
|
Method Summary |
static com.americancoders.edi.TransactionSet |
buildTransactionSet(java.io.File inFile)
|
static com.americancoders.edi.TransactionSet |
buildTransactionSet(java.lang.String inTSID)
static class method will build a transaction set based on input string and OBOE.properties defintion
see OBOE.properties file to define the directory path |
static com.americancoders.edi.TransactionSet |
buildTransactionSet(java.lang.String inTSID,
java.lang.String inSearchDirective,
java.lang.String inVersionDirectory,
java.lang.String inReceiverIDDirectory,
java.lang.String inSenderIDDirectory,
java.lang.String inTestOrProductionDirectory)
static class method will build a transaction set based on input string, the searchDirective,
the four search directories
and OBOE.properties definition |
static com.americancoders.edi.TransactionSet |
buildTransactionSet(java.lang.String inTSID,
java.lang.String inSearchDirective,
java.lang.String inVersionDirectory,
java.lang.String inReceiverIDDirectory,
java.lang.String inSenderIDDirectory,
java.lang.String inTestOrProductionDirectory,
boolean inSaveInVectorIndicator)
static class method will build a transaction set based on input string, the searchDirective,
the four search directories
and OBOE.properties definition
see OBOE.properties file to define the directory path and optional searchDirective.
|
static com.americancoders.edi.TransactionSet |
buildTransactionSetFromString(java.lang.String inTS)
|
void |
characters(char[] ch,
int start,
int length)
Method handles #PCDATA |
static void |
clearTable()
static method to clear built hash table, created for test purposes |
void |
comment(char[] chars,
int start,
int length)
|
void |
endCDATA()
|
void |
endDTD()
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
Method called by the SAX parser at the |
void |
endEntity(java.lang.String arg0)
|
void |
error(org.xml.sax.SAXParseException e)
catches error SAXParseExceptions
this code causes exception to continue |
void |
fatalError(org.xml.sax.SAXParseException e)
catches fatal SAXParseExceptions
this code causes exception to continue |
static boolean |
getNamespaceOption()
look in OBOE.properties file for the namespace variable |
com.americancoders.edi.TemplateTransactionSet |
getTemplateTransactionSet()
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
I use this to keep track of line #s |
static void |
main(java.lang.String[] args)
static main class used for testing
Class contains a main method to allow it to invoked as an application.
|
void |
parse(org.xml.sax.InputSource is)
method to call parser with an InputSource argument |
void |
parse(java.lang.String is)
method to call parser with a String argument |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
resolves the DTD file name for the xerces parser |
com.americancoders.edi.TemplateDE |
setDataElement(int pos,
org.xml.sax.Attributes attributes)
help method to build a template data element |
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
com.americancoders.edi.TemplateComposite |
setTemplateComposite(int pos,
org.xml.sax.Attributes attributes)
help method to build a template composite |
void |
startCDATA()
|
void |
startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
method called for each xml element found.
|
void |
startEntity(java.lang.String arg0)
|
void |
warning(org.xml.sax.SAXParseException e)
catches warning SAXParseExceptions
this code sends exception to stdio and allows public classto continue |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xml.sax.ContentHandler |
endDocument, endPrefixMapping, processingInstruction, skippedEntity, startDocument, startPrefixMapping |
_iElement
protected int _iElement
- current element number
_iLine
protected int _iLine
- current line number
currentTransactionSet
protected com.americancoders.edi.TemplateTransactionSet currentTransactionSet
- current transaction set
currentTable
protected com.americancoders.edi.TemplateTable currentTable
- current Table
currentLoopContainer
protected com.americancoders.edi.TemplateLoopContainer currentLoopContainer
- current container for segments either a table or segments
currentSegment
protected com.americancoders.edi.TemplateSegment currentSegment
- current segment
currentCompositeDE
protected com.americancoders.edi.TemplateComposite currentCompositeDE
- current composite
currentDataElement
protected com.americancoders.edi.TemplateDE currentDataElement
- current element
currentLoop
protected com.americancoders.edi.TemplateLoop currentLoop
- loop for loop control
currentIDListProcessor
protected com.americancoders.edi.IDListProcessor currentIDListProcessor
- id list processor
currentID
protected java.lang.String currentID
- current id string
nodeName
protected java.lang.String nodeName
- last node parsed
nameOrID
protected java.lang.String nameOrID
segmentID
protected java.lang.String segmentID
- used to build the xmlTag if no xmlTag is defined
elementID
protected java.lang.String elementID
contents
protected java.io.CharArrayWriter contents
- simple string processor
idListFile
protected java.lang.String idListFile
- current idListFile name
typeSet
public static int typeSet
idCode
protected java.lang.String idCode
- current idCode string
code comes before value so save it
idListParser
protected com.americancoders.edi.IDListParser idListParser
- current IDList parser object
idLists
protected java.util.Hashtable idLists
- list of IDs
currentIDList
protected com.americancoders.edi.IDList currentIDList
- current list of ids
currentVector
protected java.util.Vector currentVector
- current Vector for IDList processing
xmlDirectoryPath
protected java.lang.String xmlDirectoryPath
- directory path for xml file as specified in OBOE.properties
xmlFoundDirectoryPath
protected java.lang.String xmlFoundDirectoryPath
- directory path for found xml file
currentLoopContainerStack
protected java.util.Stack currentLoopContainerStack
- stack, since segments can be held by table and segments and
datalements by segments and composites we keep track of container depth through a stack
TransactionSetFactory
public TransactionSetFactory()
throws java.lang.Exception
- construct the factory with a xml parser
- Throws:
java.lang.Exception - an xml parser exception
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler- Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
parse
public void parse(org.xml.sax.InputSource is)
throws org.xml.sax.SAXException,
java.io.IOException
- method to call parser with an InputSource argument
- Parameters:
is - InputSource
- Throws:
java.io.IOException - an i/o exception
org.xml.sax.SAXException - an xml parser exception
parse
public void parse(java.lang.String is)
throws org.xml.sax.SAXException,
java.io.IOException
- method to call parser with a String argument
- Parameters:
is - String of xml data
- Throws:
java.io.IOException - an i/o exception
org.xml.sax.SAXException - an xml parser exception
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
- resolves the DTD file name for the xerces parser
- Specified by:
resolveEntity in interface org.xml.sax.EntityResolver- Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
- Parameters:
publicId - - String name of xml public idsystemId - - String name of xml system id
- Returns:
- InputSource the dtd
- Throws:
org.xml.sax.SAXException - an xml parser exception
startElement
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- method called for each xml element found.
process logic
- test each name found for edi type: transactionSet, table, segment, dataelement
- for each type pull appropriate attributes and construct object
- for transaction set build transaction set
- for table build a table
- for segments build a template segment
- for data element build a template datalement
- Specified by:
startElement in interface org.xml.sax.ContentHandler- Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
- Parameters:
uri - URI of incoming filelocalName - String of element's local namerawName - String of element's raw nameattributes - Vector of the elements attributes
- Throws:
org.xml.sax.SAXException - many possible exceptions
endElement
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
throws org.xml.sax.SAXException
- Method called by the SAX parser at the
- Specified by:
endElement in interface org.xml.sax.ContentHandler- Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
- Parameters:
uri - URI of incoming filelocalName - String of element's local namerawName - String of element's raw name
- Throws:
org.xml.sax.SAXException - many possible *
characters
public void characters(char[] ch,
int start,
int length)
- Method handles #PCDATA
- Specified by:
characters in interface org.xml.sax.ContentHandler- Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
- Parameters:
ch - arraystart - position in array where next has been placedlength - int
setTemplateComposite
public com.americancoders.edi.TemplateComposite setTemplateComposite(int pos,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- help method to build a template composite
- Parameters:
pos - int position within segmentattributes - SAX2 attributes
- Returns:
- TemplateComposite template composite
- Throws:
org.xml.sax.SAXException - SAX errors
setDataElement
public com.americancoders.edi.TemplateDE setDataElement(int pos,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- help method to build a template data element
- Parameters:
pos - position within segment or compositeattributes - SAX2 attributes
- Returns:
- TemplateDE template data element
- Throws:
org.xml.sax.SAXException - SAX errors
ignorableWhitespace
public void ignorableWhitespace(char[] ch,
int start,
int length)
- I use this to keep track of line #s
- Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler- Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
- Parameters:
ch - char array of found whitespacesstart - int start position in arraylength - int length of what's been found
warning
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches warning SAXParseExceptions
this code sends exception to stdio and allows public classto continue
- Specified by:
warning in interface org.xml.sax.ErrorHandler- Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SaxException object
- Throws:
org.xml.sax.SAXException - exception
error
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches error SAXParseExceptions
this code causes exception to continue
- Specified by:
error in interface org.xml.sax.ErrorHandler- Overrides:
error in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SaxException object
- Throws:
org.xml.sax.SAXException - thrown
fatalError
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches fatal SAXParseExceptions
this code causes exception to continue
- Specified by:
fatalError in interface org.xml.sax.ErrorHandler- Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SAXException object
- Throws:
org.xml.sax.SAXException - thrown
startDTD
public void startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
throws org.xml.sax.SAXException
- Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endDTD
public void endDTD()
throws org.xml.sax.SAXException
- Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
startEntity
public void startEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endEntity
public void endEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
startCDATA
public void startCDATA()
throws org.xml.sax.SAXException
- Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endCDATA
public void endCDATA()
throws org.xml.sax.SAXException
- Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
comment
public void comment(char[] chars,
int start,
int length)
throws org.xml.sax.SAXException
- Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
getNamespaceOption
public static boolean getNamespaceOption()
- look in OBOE.properties file for the namespace variable
- Returns:
- boolean true if useNamepace = true
any other value return false
clearTable
public static void clearTable()
- static method to clear built hash table, created for test purposes
buildTransactionSet
public static com.americancoders.edi.TransactionSet buildTransactionSet(java.lang.String inTSID)
throws OBOEException
- static class method will build a transaction set based on input string and OBOE.properties defintion
see OBOE.properties file to define the directory path
- Parameters:
inTSID - String trransaction set id
- Returns:
- TransactionSet
- Throws:
OBOEException - io error most likely
buildTransactionSet
public static com.americancoders.edi.TransactionSet buildTransactionSet(java.lang.String inTSID,
java.lang.String inSearchDirective,
java.lang.String inVersionDirectory,
java.lang.String inReceiverIDDirectory,
java.lang.String inSenderIDDirectory,
java.lang.String inTestOrProductionDirectory)
throws OBOEException
- static class method will build a transaction set based on input string, the searchDirective,
the four search directories
and OBOE.properties definition
- Parameters:
inTSID - String TransactionSet idinSearchDirective - String - any combination of V, S, R, T. These provide
the search path for the rules files through a directory structure as specified by the next
four parameters. See full method for more details about this and the other parameters.inVersionDirectory - - specify directory as defined by the Version value.inReceiverIDDirectory - - specify directory as defined byinSenderIDDirectory - - specify directory as defined byinTestOrProductionDirectory - - specify directory as defined by
- Returns:
- TransactionSet
- Throws:
OBOEException - io exception
buildTransactionSet
public static com.americancoders.edi.TransactionSet buildTransactionSet(java.lang.String inTSID,
java.lang.String inSearchDirective,
java.lang.String inVersionDirectory,
java.lang.String inReceiverIDDirectory,
java.lang.String inSenderIDDirectory,
java.lang.String inTestOrProductionDirectory,
boolean inSaveInVectorIndicator)
throws OBOEException
- static class method will build a transaction set based on input string, the searchDirective,
the four search directories
and OBOE.properties definition
see OBOE.properties file to define the directory path and optional searchDirective.
At the very least the rules file must reside in the directory specified by the xmlPath.
The rules file name is appended with ".xml"
example #1 no search directive
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: c:/xmlDefinitions/840.xml
example #2 full search directive
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
searchDirective is VTRS
inVersion is 004010
inTestProduction is P
inReceiverID is 000001
inSenderID is AAAAA
method will search for file named: c:/xmlDefinitions/004010/P/000001/AAAAA/840.xml
if not found then it will search for file named: c:/xmlDefinitions/004010/P/000001/840.xml
if not found then it will search for file named: c:/xmlDefinitions/004010/P/840.xml
if not found then it will search for file named: c:/xmlDefinitions/004010/840.xml
if not found then it will search for file named: c:/xmlDefinitions/840.xml
if not found then it will throw OBOEException
example #2 partial search directive
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
searchDirective is RV
inVersion is 004010
inTestProduction is P
inReceiverID is 000001
inSenderID is AAAAA
method will search for file named: c:/xmlDefinitions/000001/004010/840.xml
if not found then it will search for file named: c:/xmlDefinitions/000001/840.xml
if not found then it will search for file named: c:/xmlDefinitions/840.xml
if not found then it will throw OBOEException
NoteIf any directory parameter is null or zero length that directory
is ignored even if the searchDirective specifies its usage.
NoteName the directories with the values a possible specified by your
standard. This will be the only way the incoming document parser can find them. For instance
in X12 specify a Version directory with the possible values of GS 480 value such as
"004010" or "003031". In EDIFact concatenate the UNH 0052 and 0054 fields such as "D93A" or "D99B".
- Parameters:
inTSID - String TransactionSet idinSearchDirective - String - any combination of V, S, R, T. These provide
the search path for the rules files through a directory structure as specified by the next
four parameters. The base directory is defined by the xmlPath property in OBOE.properties.
Any combination is possible to provide for the search directive. The directive value of
"STV" - indicates to search using the SendId paramter value as a directory, Test Indicator as
as Directory, and Version parameter value as a directory. While "VR" indicates to use the Version
number as a directory and Receiver id. The package starts at the lowest directory with its
search. If the xml rules files is not found there it will go up to the next directory and repeat this
process until the final directory as specified by the xmlPath property.
NoteIf a null is passed, the method will look in the OBOE.properties file
for a property named searchDirectiveusing the same values. Use this property for
incoming documents.inVersionDirectory - - specify directory as defined by the Version value.
For this and the other directory parameters do not specify a directory seperator. If
used specify the names as the same as the the incoming process.
For incoming processing the directory name will be passed from
- X12: "480 - Version Release Industry Identifier Code" from GS - Functional Group Header segment
- EDIFact: the concatenation of "0052 - Message type version" and "0054 Message type release" from UNH - Message Header
inReceiverIDDirectory - - specify directory as defined by
For this and the other directory parameters do not specify a directory seperator. If
used specify the names as the same as the the incoming process.
For incoming processing the directory name will be passed from
- X12: "I07 - Interchange Receiver ID"
- EDIFact: "0010 - Recipient Identification"
inSenderIDDirectory - - specify directory as defined by
For this and the other directory parameters do not specify a directory seperator. If
used specify the names as the same as the the incoming process.
For incoming processing the directory name will be passed from
- X12: "I06 - Interchange Sender ID"
- EDIFact: "0004 - Sender identification",
inTestOrProductionDirectory - - specify directory as defined by
For this and the other directory parameters do not specify a directory seperator. If
used specify the names as the same as the the incoming process.
For incoming processing the directory name will be passed from
- X12: "I14 - Test Indicator" values of P or T.
- EDIFact: "0035 - TEST INDICATOR"
inSaveInVectorIndicator - boolean to save EDI object in the tsBuilt
vector
- Returns:
- TransactionSet
- Throws:
OBOEException - io exception
buildTransactionSet
public static com.americancoders.edi.TransactionSet buildTransactionSet(java.io.File inFile)
buildTransactionSetFromString
public static com.americancoders.edi.TransactionSet buildTransactionSetFromString(java.lang.String inTS)
main
public static void main(java.lang.String[] args)
- static main class used for testing
Class contains a main method to allow it to invoked as an application.
format: java com.americancoders.edi.TransactionSetFactory xmlfilename idlistpath
where xmlfilename is a xml file based on transactionSet.dtd.
idlistpath is directory name where idlist files reside.
- Parameters:
args - String array
getTemplateTransactionSet
public com.americancoders.edi.TemplateTransactionSet getTemplateTransactionSet()
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.