com.americancoders.edi
Class TransactionSetFactory

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--com.americancoders.edi.TransactionSetFactory

public class TransactionSetFactory
extends org.xml.sax.HandlerBase

class for building a Transaction Set from an edi xml file
Class contains a main method to allow it to be invoked as an application.
format: java com.americancoders.edi.TransactionSetFactory xmlfilename,
where xmlfilename is a xml file based on transactionSet.dtd.
OBOE - Open Business Objects for EDI
An EDI and XML Translator Written In Java
Copyright 1998-2000 - 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:
1.4.1
Author:
Joe McVerry, American Coders Ltd.

Field Summary
protected  int _iElement
           
protected  TemplateComposite currentCompositeDE
           
protected  TemplateDE currentDataElement
           
protected  java.lang.String currentID
           
protected  java.lang.String currentLoopID
           
protected  java.util.Stack currentSegContainerStack
           
protected  Table currentTable
           
protected  TemplateSegment currentTemplateSegment
           
protected  ITemplateSegmentContainer currentTemplateSegmentContainer
           
protected static TransactionSet currentTransactionSet
           
 
Constructor Summary
TransactionSetFactory()
          construct the factory with a xml parser
 
Method Summary
static 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 file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
method will search for the OBOE.properties file local directory user.home directory java.home directory
static TransactionSet buildTransactionSet(java.lang.String inTSID, java.lang.String inPropertiesFileName)
          static class method will build a transaction set based on input string and OBOE.properties definition see OBOE.properties file to define the directory path file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
static TransactionSet buildTransactionSet(java.lang.String inTSID, java.net.URL inURL)
          static class method will build a transaction set based on url file name and OBOE.properties defintion used by the sample html viewer on web page see OBOE.properties file to define the directory path file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
 void endDocument()
          method called when xml file is read to completion
 void endElement(java.lang.String name)
          Method called by the SAX parser at the
 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 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.
 TemplateDE setDataElement(int pos, org.xml.sax.AttributeList atts)
          help method to build a template data element
 TemplateComposite setTemplateComposite(int pos, org.xml.sax.AttributeList atts)
          help method to build a template composite
 void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
          method called for each xml element found.
 void warning(org.xml.sax.SAXParseException e)
          catches warning SAXParseExceptions this code sends exception to stdio and allows class to continue
 
Methods inherited from class org.xml.sax.HandlerBase
characters, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_iElement

protected int _iElement

currentTransactionSet

protected static TransactionSet currentTransactionSet

currentTable

protected Table currentTable

currentTemplateSegmentContainer

protected ITemplateSegmentContainer currentTemplateSegmentContainer

currentTemplateSegment

protected TemplateSegment currentTemplateSegment

currentCompositeDE

protected TemplateComposite currentCompositeDE

currentDataElement

protected TemplateDE currentDataElement

currentLoopID

protected java.lang.String currentLoopID

currentID

protected java.lang.String currentID

currentSegContainerStack

protected java.util.Stack currentSegContainerStack
Constructor Detail

TransactionSetFactory

public TransactionSetFactory()
construct the factory with a xml parser
Parameters:
org.xml.sax.Parser - parser
Method Detail

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList atts)
                  throws org.xml.sax.SAXException
method called for each xml element found.
process logic

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Method called by the SAX parser at the
Overrides:
endElement in class org.xml.sax.HandlerBase
Parameters:
String - name of element found
Throws:
org.xml.sax.SAXException -  

setTemplateComposite

public TemplateComposite setTemplateComposite(int pos,
                                              org.xml.sax.AttributeList atts)
                                       throws org.xml.sax.SAXException
help method to build a template composite
Parameters:
AttributeList - attributes associated with data element
Returns:
TemplateComposite template composite

setDataElement

public TemplateDE setDataElement(int pos,
                                 org.xml.sax.AttributeList atts)
                          throws org.xml.sax.SAXException
help method to build a template data element
Parameters:
int - pos in segment or composite
AttributeList - attributes associated with data element
Returns:
TemplateDE template data element

endDocument

public void endDocument()
method called when xml file is read to completion
Overrides:
endDocument in class org.xml.sax.HandlerBase

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 class to continue
Overrides:
warning in class org.xml.sax.HandlerBase

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
catches error SAXParseExceptions this code causes exception to continue
Overrides:
error in class org.xml.sax.HandlerBase

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
catches fatal SAXParseExceptions this code causes exception to continue
Overrides:
fatalError in class org.xml.sax.HandlerBase

buildTransactionSet

public static TransactionSet buildTransactionSet(java.lang.String inTSID)
                                          throws java.lang.Exception
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 file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
method will search for the OBOE.properties file
Parameters:
String - transaction id
Returns:
TransactionSet

buildTransactionSet

public static TransactionSet buildTransactionSet(java.lang.String inTSID,
                                                 java.lang.String inPropertiesFileName)
                                          throws java.lang.Exception
static class method will build a transaction set based on input string and OBOE.properties definition see OBOE.properties file to define the directory path file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
Parameters:
String - qualified properties files name
String - transaction id
Returns:
TransactionSet

buildTransactionSet

public static TransactionSet buildTransactionSet(java.lang.String inTSID,
                                                 java.net.URL inURL)
                                          throws java.lang.Exception
static class method will build a transaction set based on url file name and OBOE.properties defintion used by the sample html viewer on web page see OBOE.properties file to define the directory path file name is preppended with xmlPath from OBOE.properties and appended with ".xml"
example
OBOE.properties file contains: xmlPath = c:/xmlDefinitions/
input String is 840
method will read file named: x:/xmlDefinitions/840.xml
Parameters:
String - transaction id
URL - url of properties file
Returns:
TransactionSet

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
where xmlfilename is a xml file based on transactionSet.dtd.