ca.uhn.hl7v2.model
Interface Message

All Superinterfaces:
Group, java.io.Serializable, Structure
All Known Implementing Classes:
AbstractMessage, GenericMessage, GenericMessage.UnknownVersion, GenericMessage.V21, GenericMessage.V22, GenericMessage.V23, GenericMessage.V231, GenericMessage.V24, GenericMessage.V25, GenericMessage.V251, GenericMessage.V26

public interface Message
extends Group

Represents a complete HL7 message including all structures, segments, and fields.

Author:
Bryan Tripp (bryan_tripp@sourceforge.net)

Method Summary
 java.lang.String encode()
          Encodes this message using the parser returned by getParser()
 Message generateACK()
           Generates and returns an ACK message which would be used to acknowledge this message successfully, with an MSA-1 code of "AA".
 Message generateACK(java.lang.String theAcknowldegementCode, HL7Exception theException)
           Generates and returns an ACK message which would be used to acknowledge this message successfully.
 java.lang.String getEncodingCharactersValue()
          Convenience method which retrieves the encoding characters value from the second field of the first segment.
 java.lang.Character getFieldSeparatorValue()
          Convenience method which retrieves the field separator value from the first field of the first segment.
 Parser getParser()
          Returns the parser to be used when parse/encode methods are called on this Message, as well as its children.
 ValidationContext getValidationContext()
           
 java.lang.String getVersion()
          Returns the version number of the HL7 version in which this message structure is defined (e.g.
 void parse(java.lang.String string)
          Parses the string into this message using the parser returned by getParser()
 void setParser(Parser parser)
          Sets the parser to be used when parse/encode methods are called on this Message, as well as its children.
 void setValidationContext(ValidationContext theContext)
           
 
Methods inherited from interface ca.uhn.hl7v2.model.Group
addNonstandardSegment, addNonstandardSegment, get, get, getAll, getClass, getNames, isRepeating, isRequired
 
Methods inherited from interface ca.uhn.hl7v2.model.Structure
getMessage, getName, getParent
 

Method Detail

getVersion

java.lang.String getVersion()
Returns the version number of the HL7 version in which this message structure is defined (e.g. "2.4")


getValidationContext

ValidationContext getValidationContext()
Returns:
the set of validation rules that applies to this message

setValidationContext

void setValidationContext(ValidationContext theContext)
Parameters:
theContext - the set of validation rules that are to apply to this message

getFieldSeparatorValue

java.lang.Character getFieldSeparatorValue()
                                           throws HL7Exception
Convenience method which retrieves the field separator value from the first field of the first segment. Typically, the first segment is MSH, so this method will retrieve the value of MSH-1.

Returns:
The field separator
Throws:
HL7Exception - If an error occurs
Since:
1.0

getEncodingCharactersValue

java.lang.String getEncodingCharactersValue()
                                            throws HL7Exception
Convenience method which retrieves the encoding characters value from the second field of the first segment. Typically, the first segment is MSH, so this method will retrieve the value of MSH-2.

Returns:
The encoding characters
Throws:
HL7Exception - If an error occurs
Since:
1.0

setParser

void setParser(Parser parser)
Sets the parser to be used when parse/encode methods are called on this Message, as well as its children. It is recommended that if these methods are going to be called, a parser be supplied with the validation context wanted. Where possible, the parser should be reused for best performance, unless thread safety is an issue. Note that not all parsers can be used. As of version 1.0, only PipeParser supports this functionality


getParser

Parser getParser()
Returns the parser to be used when parse/encode methods are called on this Message, as well as its children. The default value is a new PipeParser


parse

void parse(java.lang.String string)
           throws HL7Exception
Parses the string into this message using the parser returned by getParser()

Throws:
HL7Exception

encode

java.lang.String encode()
                        throws HL7Exception
Encodes this message using the parser returned by getParser()

Throws:
HL7Exception

generateACK

Message generateACK()
                    throws HL7Exception,
                           java.io.IOException

Generates and returns an ACK message which would be used to acknowledge this message successfully, with an MSA-1 code of "AA". The ACK generated will be of the same version as the value of MSH-12 in this message (as opposed to the version of the message class instance, if they are different)

Note that this method will fail if it is not possible to generate an ACK for any reason, such as


generateACK

Message generateACK(java.lang.String theAcknowldegementCode,
                    HL7Exception theException)
                    throws HL7Exception,
                           java.io.IOException

Generates and returns an ACK message which would be used to acknowledge this message successfully. The ACK generated will be of the same version as the value of MSH-12 in this message (as opposed to the version of the message class instance, if they are different)

Note that this method will fail if it is not possible to generate an ACK for any reason, such as



Copyright © 2001-2011 University Health Network. All Rights Reserved.