Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vmdb.hl7
Class HL7Message  view HL7Message download HL7Message.java

java.lang.Object
  extended byorg.vmdb.hl7.HL7Object
      extended byorg.vmdb.hl7.HL7SegmentContainer
          extended byorg.vmdb.hl7.HL7Message
Direct Known Subclasses:
ACKMessage, ORUMessage, QBPMessage, RSPMessage

public class HL7Message
extends HL7SegmentContainer

Generic HL7 Message Structure.

Description: HL7 Network Connectivity For VMDB.

Copyright: Copyright (c) 2002-2003.

Company: M&M Informatics.

This almost virtual base class provides the common structure and functionality for all implemented specific messages. By using this class directly it is possible to build messages of types not yet implemented, but at considerably greater effort than using an implemented specific class. If you do build specific messages, you are encouraged to construct a specific subclass and submit it to VMDB for inclusion in the library. While you are not required to so extend the library, if you do implement such an extension, you are required by the LGPL to submit the extension. And this is the whole spirit of this project. Your application code is yours to keep proprietary. The library is provided as a tool to keep us all building to the same standards and interpretation of the standards. So to ensure interoperability, it is in everyone's interest that you abide by this requirement.

Much of the functionality we would expect to find in this class is actually inherited from the HL7SegmentContainer because parsing a Message is really no different from parsing a "loop."

Version:
1.0

Field Summary
private  java.lang.String sDTD
           
private  java.lang.String sStyleSheet
           
 
Fields inherited from class org.vmdb.hl7.HL7SegmentContainer
slData, stState, vSegments
 
Fields inherited from class org.vmdb.hl7.HL7Object
COMP_SEP, ESC_SEP, FIELD_SEP, REP_SEP, sName, sRule, sSeparators, SUB_SEP
 
Constructor Summary
HL7Message()
           
 
Method Summary
(package private)  boolean addSegment(HL7Segment sSegment)
          Add a segment already instantiated as an object of type HL7Segment or specific subclass
 java.lang.String getDTD()
          Get the URL encoded DTD string.
 java.lang.String getMessageControlId()
          Get the message control id.
 java.lang.String getMessageName()
          Get the message name.
 MSHSegment getMSH()
          Return the existing MSH segment if it exists or create and insert it at the correct location and return it.
 HDElement getReceivingFacility()
          Get the Receiving facility HDElement.
 java.lang.String getReceivingFacilityId()
          Get the Receiving facility VMDB Institution Id.
 java.lang.String getReceivingFacilityName()
          Get the Receiving facility name.
 HDElement getSendingFacility()
           
 java.lang.String getSendingFacilityId()
          Get the Sending facility VMDB Institution Id.
 java.lang.String getSendingFacilityName()
          Get the Sending facility name.
 java.lang.String getStyleSheet()
          Get the URL encoded StyleSheet string
 java.lang.String printRule()
          Output the full rule string for this object.

This method differs from the inherited getRule() in that this method recurses into the rules for all contained loops so that we get the full rule for segment sequence.
This follows generally the HL7 convention of using [] for optionality and {} for repeatablility.
 boolean readHL7(java.lang.String sHL7)
          Parse the supplied HL7 message string into segments based upon the rule string provided by derived class of message or loop.

 void setDTD(java.lang.String sDTD)
          Set the DTD file or URL.

This cannot be automatic because different implementations my locate DTD differently.
 void setMessageControlId(java.lang.String sMessageControlId)
          Set the message control id.
 void setMessageName(java.lang.String sMsgType, java.lang.String sMsgVersion)
          Set the message name and version.

Normally this is called by the constructor using constants defined for this message.
 void setReceivingFacility(HDElement hdIn)
          Set the Receiving facility HDElement
 void setReceivingFacility(java.lang.String sName, java.lang.String sId)
          Set the Receiving facility VMDB Institution Id.
 void setSendingFacility(HDElement hdIn)
          Set the Sending facility VMDB Institution Id.
 void setSendingFacility(java.lang.String sName, java.lang.String sId)
          Set the Sending facility VMDB Institution Id.
 void setStyleSheet(java.lang.String sStyleSheet)
          Set the StyleSheet file or URL.

This cannot be automatic because different implementations my locate StyleSheet differently.
 java.lang.String toXML()
          Output the object as XML.

For HL7Message, this will be a full message.
 java.lang.String toXML(int iDepth)
          Output the object as XML.

For HL7Message, this will be a full message.
 
Methods inherited from class org.vmdb.hl7.HL7SegmentContainer
addSegment, findSegment, iterator, listsSegments, messageComplete, pop, processLoop, processSegment, push, readString, setData, setSeparators, toString
 
Methods inherited from class org.vmdb.hl7.HL7Object
getName, getRule, getSeparator, getSeparators, setName, setRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sDTD

private java.lang.String sDTD

sStyleSheet

private java.lang.String sStyleSheet
Constructor Detail

HL7Message

public HL7Message()
Method Detail

addSegment

boolean addSegment(HL7Segment sSegment)
Add a segment already instantiated as an object of type HL7Segment or specific subclass

Overrides:
addSegment in class HL7SegmentContainer

readHL7

public boolean readHL7(java.lang.String sHL7)
Parse the supplied HL7 message string into segments based upon the rule string provided by derived class of message or loop.


getMSH

public MSHSegment getMSH()
Return the existing MSH segment if it exists or create and insert it at the correct location and return it.


setDTD

public void setDTD(java.lang.String sDTD)
Set the DTD file or URL.

This cannot be automatic because different implementations my locate DTD differently.


getDTD

public java.lang.String getDTD()
Get the URL encoded DTD string.


setStyleSheet

public void setStyleSheet(java.lang.String sStyleSheet)
Set the StyleSheet file or URL.

This cannot be automatic because different implementations my locate StyleSheet differently.


getStyleSheet

public java.lang.String getStyleSheet()
Get the URL encoded StyleSheet string


setMessageName

public void setMessageName(java.lang.String sMsgType,
                           java.lang.String sMsgVersion)
Set the message name and version.

Normally this is called by the constructor using constants defined for this message. May be called directly if building a message of a type not yet implemented in a specific subclass.


getMessageName

public java.lang.String getMessageName()
Get the message name.


setMessageControlId

public void setMessageControlId(java.lang.String sMessageControlId)
Set the message control id.


getMessageControlId

public java.lang.String getMessageControlId()
Get the message control id.


setSendingFacility

public void setSendingFacility(HDElement hdIn)
Set the Sending facility VMDB Institution Id.


setSendingFacility

public void setSendingFacility(java.lang.String sName,
                               java.lang.String sId)
Set the Sending facility VMDB Institution Id.


getSendingFacilityId

public java.lang.String getSendingFacilityId()
Get the Sending facility VMDB Institution Id.


getSendingFacility

public HDElement getSendingFacility()

getSendingFacilityName

public java.lang.String getSendingFacilityName()
Get the Sending facility name.


setReceivingFacility

public void setReceivingFacility(HDElement hdIn)
Set the Receiving facility HDElement


setReceivingFacility

public void setReceivingFacility(java.lang.String sName,
                                 java.lang.String sId)
Set the Receiving facility VMDB Institution Id.


getReceivingFacility

public HDElement getReceivingFacility()
Get the Receiving facility HDElement.


getReceivingFacilityId

public java.lang.String getReceivingFacilityId()
Get the Receiving facility VMDB Institution Id.


getReceivingFacilityName

public java.lang.String getReceivingFacilityName()
Get the Receiving facility name.


printRule

public java.lang.String printRule()
Output the full rule string for this object.

This method differs from the inherited getRule() in that this method recurses into the rules for all contained loops so that we get the full rule for segment sequence.
This follows generally the HL7 convention of using [] for optionality and {} for repeatablility. Whitespace separates sequential non-repeating required elements.


toXML

public java.lang.String toXML()
Output the object as XML.

For HL7Message, this will be a full message. For all other objects it will be the DOM element for that object and all its contained objects.


toXML

public java.lang.String toXML(int iDepth)
Output the object as XML.

For HL7Message, this will be a full message. For all other objects it will be the DOM element for that object and all its contained objects.

Overrides:
toXML in class HL7SegmentContainer