org.vmdb.hl7
Class HL7Message

java.lang.Object
  |
  +--org.vmdb.hl7.HL7Object
        |
        +--org.vmdb.hl7.HL7SegmentContainer
              |
              +--org.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: Veterinary Medical Database (VMDB).

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."


Constructor Summary
HL7Message()
           
 
Method Summary
 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.
 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.
 void setMessageControlId(java.lang.String sMessageControlId)
          Set the message control id.
 void setMessageName(java.lang.String sMsgType, java.lang.String sEventType)
          Set the message name and event.
 void setMessageName(java.lang.String sMsgType, java.lang.String sEventType, java.lang.String sMsgStructure)
          Set the message name, event, and structure.
 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.
 java.lang.String toXML()
          Output the object as XML.
 java.lang.String toXML(int iDepth)
          Output the object as XML.
 
Methods inherited from class org.vmdb.hl7.HL7SegmentContainer
findSegment, listsSegments, setSeparators, toString
 
Methods inherited from class org.vmdb.hl7.HL7Object
getRule
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HL7Message

public HL7Message()
Method Detail

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.

Parameters:
sHL7 - String with HL7 message or fragement starting with this 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.

Returns:
MSHSegment reference existing or new.

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.

Parameters:
sDTD - fully qualified file or URL

getDTD

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

Returns:
String with fully qualified DTD URL

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.

Parameters:
sStyleSheet - fully qualified file or URL

getStyleSheet

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

Returns:
String with fully qualified Stylesheet URL

setMessageName

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

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.

Parameters:
sMsgType - String with message type abbreviation such as "ORU"
sEventType - String with message event such as "R01"

setMessageName

public void setMessageName(java.lang.String sMsgType,
                           java.lang.String sEventType,
                           java.lang.String sMsgStructure)
Set the message name, event, and structure.

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.
Message structure is often but not always name_event. Where messages for various events share structure, they use the first event.

Parameters:
sMsgType - String with message type abbreviation such as "ORU"
sEventType - String with message event such as "R01"
sMsgStructure - String with message event such as "ORU_R01"

getMessageName

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

Returns:
String with message name string in form type_version

setMessageControlId

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


getMessageControlId

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

Returns:
String with unique identifier

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.

Parameters:
sName - String with VMDB facility name
sId - String with VMDB facility id

getSendingFacilityId

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

Returns:
String with VMDB facility id

getSendingFacility

public HDElement getSendingFacility()

getSendingFacilityName

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

Returns:
String with VMDB facility name

setReceivingFacility

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

Parameters:
hdIn - HDElement with full facility

setReceivingFacility

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

Parameters:
sName - String with VMDB facility name
sId - String with VMDB facility id

getReceivingFacility

public HDElement getReceivingFacility()
Get the Receiving facility HDElement.

Returns:
HDElement for receiving facility

getReceivingFacilityId

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

Returns:
String with VMDB facility id

getReceivingFacilityName

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

Returns:
String with VMDB 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.

Returns:
Rule as a string.

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.

Returns:
foratted XML text.

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
Parameters:
iDepth - int value for the number of spaces to indent this object. Used just to make the XML easier to read as unformatted text.
Returns:
foratted XML text.

SourceForge.net Logo