ca.uhn.hl7v2.parser
Class OldPipeParser

java.lang.Object
  extended by ca.uhn.hl7v2.parser.Parser
      extended by ca.uhn.hl7v2.parser.OldPipeParser

Deprecated.

public class OldPipeParser
extends Parser

This is a legacy implementation of the PipeParser and should not be used for new projects. In version 1.0 of HAPI, a behaviour was corrected where unexpected segments would be placed at the tail end of the first segment group encountered. Any legacy code which still depends on previous behaviour can use this implementation.

Author:
Bryan Tripp (bryan_tripp@sourceforge.net)

Constructor Summary
OldPipeParser()
          Deprecated. Creates a new PipeParser
OldPipeParser(ModelClassFactory theFactory)
          Deprecated. Creates a new PipeParser
 
Method Summary
protected  java.lang.String doEncode(Message source)
          Deprecated. Formats a Message object into an HL7 message string using this parser's default encoding ("VB").
protected  java.lang.String doEncode(Message source, java.lang.String encoding)
          Deprecated. Formats a Message object into an HL7 message string using the given encoding.
 java.lang.String doEncode(Segment structure, EncodingCharacters encodingCharacters)
          Deprecated. Encodes a particular segment and returns the encoded structure
 java.lang.String doEncode(Type type, EncodingCharacters encodingCharacters)
          Deprecated. Encodes a particular type and returns the encoded structure
protected  Message doParse(java.lang.String message, java.lang.String version)
          Deprecated. Parses a message string and returns the corresponding Message object.
static java.lang.String encode(Group source, EncodingCharacters encodingChars)
          Deprecated. Returns given group serialized as a pipe-encoded string - this method is called by encode(Message source, String encoding).
static java.lang.String encode(Segment source, EncodingCharacters encodingChars)
          Deprecated.  
static java.lang.String encode(Type source, EncodingCharacters encodingChars)
          Deprecated. Encodes the given Type, using the given encoding characters.
 java.lang.String getAckID(java.lang.String message)
          Deprecated. For response messages, returns the value of MSA-2 (the message ID of the message sent by the sending system).
 Segment getCriticalResponseData(java.lang.String message)
          Deprecated. Returns a minimal amount of data from a message string, including only the data needed to send a response to the remote system.
 java.lang.String getDefaultEncoding()
          Deprecated.  
 java.lang.String getEncoding(java.lang.String message)
          Deprecated. Returns a String representing the encoding of the given message, if the encoding is recognized.
 java.lang.String getMessageStructure(java.lang.String message)
          Deprecated. this method should not be public
 java.lang.String getVersion(java.lang.String message)
          Deprecated. Returns the version ID (MSH-12) from the given message, without fully parsing the message.
 void parse(Message message, java.lang.String string)
          Deprecated. Parses a particular message and returns the encoded structure
 void parse(Segment destination, java.lang.String segment, EncodingCharacters encodingChars)
          Deprecated. Parses a segment string and populates the given Segment object.
 void parse(Type destinationField, java.lang.String data, EncodingCharacters encodingCharacters)
          Deprecated. Fills a field with values from an unparsed string representing the field.
static java.lang.String[] split(java.lang.String composite, java.lang.String delim)
          Deprecated. Splits the given composite string into an array of components using the given delimiter.
static java.lang.String stripLeadingWhitespace(java.lang.String in)
          Deprecated. Removes leading whitespace from the given string.
 boolean supportsEncoding(java.lang.String encoding)
          Deprecated. Returns true if and only if the given encoding is supported by this Parser.
 
Methods inherited from class ca.uhn.hl7v2.parser.Parser
encode, encode, getFactory, getMessageStructureForEvent, getMessageStructures, getValidationContext, getValidVersions, instantiateMessage, makeControlMSH, parse, setValidationContext, validVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OldPipeParser

public OldPipeParser()
Deprecated. 
Creates a new PipeParser


OldPipeParser

public OldPipeParser(ModelClassFactory theFactory)
Deprecated. 
Creates a new PipeParser

Parameters:
theFactory - custom factory to use for model class lookup
Method Detail

getEncoding

public java.lang.String getEncoding(java.lang.String message)
Deprecated. 
Returns a String representing the encoding of the given message, if the encoding is recognized. For example if the given message appears to be encoded using HL7 2.x XML rules then "XML" would be returned. If the encoding is not recognized then null is returned. That this method returns a specific encoding does not guarantee that the message is correctly encoded (e.g. well formed XML) - just that it is not encoded using any other encoding than the one returned.

Specified by:
getEncoding in class Parser

getDefaultEncoding

public java.lang.String getDefaultEncoding()
Deprecated. 
Specified by:
getDefaultEncoding in class Parser
Returns:
the preferred encoding of this Parser

supportsEncoding

public boolean supportsEncoding(java.lang.String encoding)
Deprecated. 
Returns true if and only if the given encoding is supported by this Parser.

Specified by:
supportsEncoding in class Parser

getMessageStructure

public java.lang.String getMessageStructure(java.lang.String message)
                                     throws HL7Exception,
                                            EncodingNotSupportedException
Deprecated. this method should not be public

Parameters:
message -
Returns:
Throws:
HL7Exception
EncodingNotSupportedException

doParse

protected Message doParse(java.lang.String message,
                          java.lang.String version)
                   throws HL7Exception,
                          EncodingNotSupportedException
Deprecated. 
Parses a message string and returns the corresponding Message object. Unexpected segments added at the end of their group.

Specified by:
doParse in class Parser
Parameters:
message - a String that contains an HL7 message
version - the name of the HL7 version to which the message belongs (eg "2.5")
Returns:
a HAPI Message object parsed from the given String
Throws:
HL7Exception - if the message is not correctly formatted.
EncodingNotSupportedException - if the message encoded is not supported by this parser.

parse

public void parse(Segment destination,
                  java.lang.String segment,
                  EncodingCharacters encodingChars)
           throws HL7Exception
Deprecated. 
Parses a segment string and populates the given Segment object. Unexpected fields are added as Varies' at the end of the segment.

Specified by:
parse in class Parser
Parameters:
destination - The segment to encode
segment - The string to parse
encodingChars - The encoding characters
Throws:
HL7Exception - if the given string does not contain the given segment or if the string is not encoded properly

parse

public void parse(Type destinationField,
                  java.lang.String data,
                  EncodingCharacters encodingCharacters)
           throws HL7Exception
Deprecated. 
Fills a field with values from an unparsed string representing the field.

Specified by:
parse in class Parser
Parameters:
destinationField - the field Type
data - the field string (including all components and subcomponents; not including field delimiters)
encodingCharacters - the encoding characters used in the message
Throws:
HL7Exception - If there is a problem encoding

split

public static java.lang.String[] split(java.lang.String composite,
                                       java.lang.String delim)
Deprecated. 
Splits the given composite string into an array of components using the given delimiter.


encode

public static java.lang.String encode(Type source,
                                      EncodingCharacters encodingChars)
Deprecated. 
Encodes the given Type, using the given encoding characters. It is assumed that the Type represents a complete field rather than a component.


doEncode

protected java.lang.String doEncode(Message source,
                                    java.lang.String encoding)
                             throws HL7Exception,
                                    EncodingNotSupportedException
Deprecated. 
Formats a Message object into an HL7 message string using the given encoding.

Specified by:
doEncode in class Parser
Parameters:
source - a Message object from which to construct an encoded message string
encoding - the name of the HL7 encoding to use (eg "XML"; most implementations support only one encoding)
Returns:
the encoded message
Throws:
HL7Exception - if the data fields in the message do not permit encoding (e.g. required fields are null)
EncodingNotSupportedException - if the requested encoding is not supported by this parser.

doEncode

protected java.lang.String doEncode(Message source)
                             throws HL7Exception
Deprecated. 
Formats a Message object into an HL7 message string using this parser's default encoding ("VB").

Specified by:
doEncode in class Parser
Parameters:
source - a Message object from which to construct an encoded message string
Returns:
the encoded message
Throws:
HL7Exception - if the data fields in the message do not permit encoding (e.g. required fields are null)

encode

public static java.lang.String encode(Group source,
                                      EncodingCharacters encodingChars)
                               throws HL7Exception
Deprecated. 
Returns given group serialized as a pipe-encoded string - this method is called by encode(Message source, String encoding).

Throws:
HL7Exception

encode

public static java.lang.String encode(Segment source,
                                      EncodingCharacters encodingChars)
Deprecated. 

stripLeadingWhitespace

public static java.lang.String stripLeadingWhitespace(java.lang.String in)
Deprecated. 
Removes leading whitespace from the given string. This method was created to deal with frequent problems parsing messages that have been hand-written in windows. The intuitive way to delimit segments is to hit at the end of each segment, but this creates both a carriage return and a line feed, so to the parser, the first character of the next segment is the line feed.


getCriticalResponseData

public Segment getCriticalResponseData(java.lang.String message)
                                throws HL7Exception
Deprecated. 

Returns a minimal amount of data from a message string, including only the data needed to send a response to the remote system. This includes the following fields:

This method is intended for use when there is an error parsing a message, (so the Message object is unavailable) but an error message must be sent back to the remote system including some of the information in the inbound message. This method parses only that required information, hopefully avoiding the condition that caused the original error. The other fields in the returned MSH segment are empty.

Specified by:
getCriticalResponseData in class Parser
Returns:
an MSH segment
Throws:
HL7Exception

getAckID

public java.lang.String getAckID(java.lang.String message)
Deprecated. 
For response messages, returns the value of MSA-2 (the message ID of the message sent by the sending system). This value may be needed prior to main message parsing, so that (particularly in a multi-threaded scenario) the message can be routed to the thread that sent the request. We need this information first so that any parse exceptions are thrown to the correct thread. Returns null if MSA-2 can not be found (e.g. if the message is not a response message).

Specified by:
getAckID in class Parser

getVersion

public java.lang.String getVersion(java.lang.String message)
                            throws HL7Exception
Deprecated. 
Returns the version ID (MSH-12) from the given message, without fully parsing the message. The version is needed prior to parsing in order to determine the message class into which the text of the message should be parsed.

Specified by:
getVersion in class Parser
Throws:
HL7Exception - if the version field can not be found.

doEncode

public java.lang.String doEncode(Segment structure,
                                 EncodingCharacters encodingCharacters)
                          throws HL7Exception
Deprecated. 
Encodes a particular segment and returns the encoded structure

Specified by:
doEncode in class Parser
Parameters:
structure - The structure to encode
encodingCharacters - The encoding characters
Returns:
The encoded segment
Throws:
HL7Exception - If there is a problem encoding

doEncode

public java.lang.String doEncode(Type type,
                                 EncodingCharacters encodingCharacters)
                          throws HL7Exception
Deprecated. 
Encodes a particular type and returns the encoded structure

Specified by:
doEncode in class Parser
Parameters:
type - The type to encode
encodingCharacters - The encoding characters
Returns:
The encoded type
Throws:
HL7Exception - If there is a problem encoding

parse

public void parse(Message message,
                  java.lang.String string)
           throws HL7Exception
Deprecated. 
Description copied from class: Parser
Parses a particular message and returns the encoded structure

Specified by:
parse in class Parser
Parameters:
message - The message to encode
string - The string to parse
Throws:
HL7Exception - If there is a problem encoding


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