Sun Message Library for HL7

com.stc.hl7.builder
Class HL7OTDBuilder

java.lang.Object
  extended by com.stc.hl7.builder.HL7OTDBuilder
All Implemented Interfaces:
com.stc.otd.builder.OtdBuilder, java.io.Serializable

public class HL7OTDBuilder
extends java.lang.Object
implements com.stc.otd.builder.OtdBuilder

The HL7OTDBuilder builds HL7 OTDs. The input metadata comes from a Microsoft Access Database. The resulting OTDs are stored in the destination directory specified in the OtdBuilderSpec. These OTDs are organized by version id and then by OTD name.

Version:
$Revision: 1.35 $
Author:
SeeBeyond eWays Team
See Also:
Serialized Form

Nested Class Summary
static class HL7OTDBuilder.HL7PropName
          Enumeration of node types.
 
Field Summary
 java.lang.String mBaseDir
          Location of .otd output directory
(package private)  boolean mBuildAll
          Build all versions in the HL7 Access Database
(package private)  boolean mBuildGeneric
          Build the Generic OTDS - event and ACK
 java.lang.String mDatabasePath
          The fully qualified path to the HL7 MS Access database
 
Fields inherited from interface com.stc.otd.builder.OtdBuilder
PACKAGE_NAME_PREFIX
 
Constructor Summary
HL7OTDBuilder()
          Constructs an HL7OTDBuilder
HL7OTDBuilder(java.lang.String baseDir, java.lang.String databasePath, java.util.ArrayList hl7VerList)
          Constructs an HL7OTDBuilder with the given OTDBuilderSpec
 
Method Summary
 void buildExternalOTDs(java.util.ArrayList nodes, NodeDescList segList, NodeDescList compList, HL7Version hl7Version, java.util.Hashtable segs)
          Builds .fog files for segments and composites as external templates
 void buildGenericOtds(HL7DBConnection hl7db)
          Builds the Generic HL7 Event and the Generic Acknowledgement
 void buildOtd()
          Sets up to build the .fog file
 void buildOtd(com.stc.otd.forest.OtdMetaContainer otdMetaContainer)
          Populates the empty OtdMetaContainer obtained from the OtdContext.createOtd method.
 com.stc.otd.fog.FogComposite createExtRefNode(com.stc.otd.fog.provider.FogOrderImpl fogOrder, java.lang.String nodeName, java.util.Hashtable nodes, com.stc.otd.fog.FogComposite main)
          Creates external template for segment
 void generateCode(com.stc.otd.forest.OtdMetaContainer otdMetaContainer)
          generateCode method will invoke the otd type specific code generator to generate the java otd code.
 com.stc.otd.builder.OtdBuilderSpec getOtdBuilderSpec()
          Getter for HL7OTDBuilderSpec attribute of the OtdBuilder
 void init()
          Initializes necessary variables
static void main(java.lang.String[] args)
          For testing
 int parseOpts(java.lang.String[] args)
          Parses the commandline arguments
 void processGroupSegment(com.stc.otd.fog.provider.FogOrderImpl fogOrder, NodeDesc n, com.stc.otd.fog.FogComposite main, java.util.Hashtable nodes, NodeDescList eventList, boolean top, java.util.Hashtable extNodes, RefDesc refDesc)
          Processes group segment
 void setOtdBuilderSpec(com.stc.otd.builder.OtdBuilderSpec spec)
          Setter for HL7OTDBuilderSpec attribute of the OtdBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mBaseDir

public java.lang.String mBaseDir
Location of .otd output directory


mDatabasePath

public java.lang.String mDatabasePath
The fully qualified path to the HL7 MS Access database


mBuildAll

boolean mBuildAll
Build all versions in the HL7 Access Database


mBuildGeneric

boolean mBuildGeneric
Build the Generic OTDS - event and ACK

Constructor Detail

HL7OTDBuilder

public HL7OTDBuilder()
Constructs an HL7OTDBuilder


HL7OTDBuilder

public HL7OTDBuilder(java.lang.String baseDir,
                     java.lang.String databasePath,
                     java.util.ArrayList hl7VerList)
Constructs an HL7OTDBuilder with the given OTDBuilderSpec

Parameters:
baseDir - Location of .otd output directory
databasePath - The fully qualified path to the HL7 MS Access database
hl7VerList - The list of HL7 versions
Method Detail

init

public void init()
          throws java.lang.Exception
Initializes necessary variables

Throws:
java.lang.Exception - upon error.

setOtdBuilderSpec

public void setOtdBuilderSpec(com.stc.otd.builder.OtdBuilderSpec spec)
Setter for HL7OTDBuilderSpec attribute of the OtdBuilder

Specified by:
setOtdBuilderSpec in interface com.stc.otd.builder.OtdBuilder
Parameters:
spec - builder spec

getOtdBuilderSpec

public com.stc.otd.builder.OtdBuilderSpec getOtdBuilderSpec()
Getter for HL7OTDBuilderSpec attribute of the OtdBuilder

Specified by:
getOtdBuilderSpec in interface com.stc.otd.builder.OtdBuilder
Returns:
HL7OTDBuilderSpec builder spec

main

public static void main(java.lang.String[] args)
For testing

Parameters:
args - The command line arguments

buildOtd

public void buildOtd()
              throws java.lang.Exception
Sets up to build the .fog file

Throws:
java.lang.Exception - Failure to run

buildExternalOTDs

public void buildExternalOTDs(java.util.ArrayList nodes,
                              NodeDescList segList,
                              NodeDescList compList,
                              HL7Version hl7Version,
                              java.util.Hashtable segs)
                       throws java.lang.Exception
Builds .fog files for segments and composites as external templates

Parameters:
nodes - list of segment names
segList - list of all segments for a particular version of HL7
compList - list of all composites for a particular version of HL7
hl7Version - the HL7 Version
segs - Map of all external templates for segments
Throws:
exception - upon error
java.lang.Exception

processGroupSegment

public void processGroupSegment(com.stc.otd.fog.provider.FogOrderImpl fogOrder,
                                NodeDesc n,
                                com.stc.otd.fog.FogComposite main,
                                java.util.Hashtable nodes,
                                NodeDescList eventList,
                                boolean top,
                                java.util.Hashtable extNodes,
                                RefDesc refDesc)
                         throws java.lang.Exception
Processes group segment

Parameters:
fogOrder - FogOrder object
n - Node Description
main - fogOrder object's main node
nodes - table with segmentname as the key and fogOrder as the value
eventList - event nodes description list
top - indicates whether node is top node or not
extNodes - table with segmentname as the key and fogOrder object as the value
refDesc - RefDesc object
Throws:
java.lang.Exception - exception upon error

createExtRefNode

public com.stc.otd.fog.FogComposite createExtRefNode(com.stc.otd.fog.provider.FogOrderImpl fogOrder,
                                                     java.lang.String nodeName,
                                                     java.util.Hashtable nodes,
                                                     com.stc.otd.fog.FogComposite main)
                                              throws java.lang.Exception
Creates external template for segment

Parameters:
fogOrder - FogOrder object
nodeName - segment name
nodes - table with segmentname as the key and fogOrder as the value
main - fogOrder object's main node
Throws:
java.lang.Exception - exception upon error

buildGenericOtds

public void buildGenericOtds(HL7DBConnection hl7db)
                      throws java.lang.Exception
Builds the Generic HL7 Event and the Generic Acknowledgement

Throws:
java.lang.Exception - exception upon error

buildOtd

public void buildOtd(com.stc.otd.forest.OtdMetaContainer otdMetaContainer)
              throws com.stc.otd.builder.OtdBuilderException
Populates the empty OtdMetaContainer obtained from the OtdContext.createOtd method. Dummy method in this implementation of the OtdBuilder interface.

Specified by:
buildOtd in interface com.stc.otd.builder.OtdBuilder
Parameters:
otdMetaContainer - OtdMetaContainer object
Throws:
com.stc.otd.builder.OtdBuilderException - OtdBuilderException

generateCode

public void generateCode(com.stc.otd.forest.OtdMetaContainer otdMetaContainer)
                  throws com.stc.otd.builder.OtdBuilderException
generateCode method will invoke the otd type specific code generator to generate the java otd code.

Specified by:
generateCode in interface com.stc.otd.builder.OtdBuilder
Parameters:
otdMetaContainer - OtdMetaContainer object
Throws:
com.stc.otd.builder.OtdBuilderException - OtdBuilderException

parseOpts

public int parseOpts(java.lang.String[] args)
              throws java.lang.Exception
Parses the commandline arguments

Parameters:
args - an array of commandline arguments
Returns:
Return code 0 if successful, -1 if failed
Throws:
java.lang.Exception - exception upon error

Sun Message Library for HL7