ca.uhn.hl7v2
Class HL7Exception

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by ca.uhn.hl7v2.HL7Exception
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DataTypeException, EncodingNotSupportedException, ProfileNotFollowedException, ProfileNotHL7CompliantException, TransportException, UnknownValueException

public class HL7Exception
extends java.lang.Exception

Represents an exception encountered while processing an HL7 message.

Author:
Bryan Tripp (bryan_tripp@sourceforge.net)
See Also:
Serialized Form

Field Summary
static int ACK_AA
          Original mode: Application Accept - Enhanced mode: Application acknowledgment: Accept
static int ACK_AE
          Original mode: Application Error - Enhanced mode: Application acknowledgment: Error
static int ACK_AR
          Original mode: Application Reject - Enhanced mode: Application acknowledgment: Reject
static int ACK_CA
          Enhanced mode: Accept acknowledgment: Commit Accept
static int ACK_CE
          Enhanced mode: Accept acknowledgment: Commit Error
static int ACK_CR
          Enhanced mode: Accept acknowledgment: Commit Reject
static int APPLICATION_INTERNAL_ERROR
           
static int APPLICATION_RECORD_LOCKED
           
static int DATA_TYPE_ERROR
           
static int DUPLICATE_KEY_IDENTIFIER
           
static int MESSAGE_ACCEPTED
           
static int REQUIRED_FIELD_MISSING
           
static int SEGMENT_SEQUENCE_ERROR
           
static int TABLE_VALUE_NOT_FOUND
           
static int UNKNOWN_KEY_IDENTIFIER
           
static int UNSUPPORTED_EVENT_CODE
           
static int UNSUPPORTED_MESSAGE_TYPE
           
static int UNSUPPORTED_PROCESSING_ID
           
static int UNSUPPORTED_VERSION_ID
           
 
Constructor Summary
HL7Exception(java.lang.String message)
          Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR
HL7Exception(java.lang.String message, int errorCondition)
          Creates an HL7Exception.
HL7Exception(java.lang.String message, int errorCondition, java.lang.Throwable cause)
          Creates an HL7Exception.
HL7Exception(java.lang.String message, java.lang.Throwable cause)
          Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR
HL7Exception(java.lang.Throwable cause)
          Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR
 
Method Summary
 int getErrorCode()
           
 int getFieldPosition()
          Returns the field number within the segment where the error occured if it has been set, -1 otherwise; numbering starts at 1.
 java.lang.String getMessage()
          Overrides Throwable.getMessage() to add the field location of the problem if available.
 java.lang.String getSegmentName()
          Returns the name of the segment where the error occured, if this has been set (null otherwise).
 int getSegmentRepetition()
          Returns the sequence number of the segment where the error occured (if there are multiple segments with the same name) if this has been set, -1 otherwise - numbering starts at 1.
 void populate(Segment errorSegment, java.lang.String theJdbcUrl)
          Populates the given error segment with information from this Exception.
 void setFieldPosition(int fieldNum)
          Sets the field number (within a segment) where the error occured; numbering starts at 1.
 void setSegmentName(java.lang.String segmentName)
          Sets the name of the segment where the error occured.
 void setSegmentRepetition(int sequenceNum)
          Sets the sequence number of the segment where the error occured if there are multiplt segments with the same name (ie the sequenceNum'th segment with the name specified in setSegmentName).
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACK_AA

public static final int ACK_AA
Original mode: Application Accept - Enhanced mode: Application acknowledgment: Accept

See Also:
Constant Field Values

ACK_AE

public static final int ACK_AE
Original mode: Application Error - Enhanced mode: Application acknowledgment: Error

See Also:
Constant Field Values

ACK_AR

public static final int ACK_AR
Original mode: Application Reject - Enhanced mode: Application acknowledgment: Reject

See Also:
Constant Field Values

ACK_CA

public static final int ACK_CA
Enhanced mode: Accept acknowledgment: Commit Accept

See Also:
Constant Field Values

ACK_CE

public static final int ACK_CE
Enhanced mode: Accept acknowledgment: Commit Error

See Also:
Constant Field Values

ACK_CR

public static final int ACK_CR
Enhanced mode: Accept acknowledgment: Commit Reject

See Also:
Constant Field Values

MESSAGE_ACCEPTED

public static final int MESSAGE_ACCEPTED
See Also:
Constant Field Values

SEGMENT_SEQUENCE_ERROR

public static final int SEGMENT_SEQUENCE_ERROR
See Also:
Constant Field Values

REQUIRED_FIELD_MISSING

public static final int REQUIRED_FIELD_MISSING
See Also:
Constant Field Values

DATA_TYPE_ERROR

public static final int DATA_TYPE_ERROR
See Also:
Constant Field Values

TABLE_VALUE_NOT_FOUND

public static final int TABLE_VALUE_NOT_FOUND
See Also:
Constant Field Values

UNSUPPORTED_MESSAGE_TYPE

public static final int UNSUPPORTED_MESSAGE_TYPE
See Also:
Constant Field Values

UNSUPPORTED_EVENT_CODE

public static final int UNSUPPORTED_EVENT_CODE
See Also:
Constant Field Values

UNSUPPORTED_PROCESSING_ID

public static final int UNSUPPORTED_PROCESSING_ID
See Also:
Constant Field Values

UNSUPPORTED_VERSION_ID

public static final int UNSUPPORTED_VERSION_ID
See Also:
Constant Field Values

UNKNOWN_KEY_IDENTIFIER

public static final int UNKNOWN_KEY_IDENTIFIER
See Also:
Constant Field Values

DUPLICATE_KEY_IDENTIFIER

public static final int DUPLICATE_KEY_IDENTIFIER
See Also:
Constant Field Values

APPLICATION_RECORD_LOCKED

public static final int APPLICATION_RECORD_LOCKED
See Also:
Constant Field Values

APPLICATION_INTERNAL_ERROR

public static final int APPLICATION_INTERNAL_ERROR
See Also:
Constant Field Values
Constructor Detail

HL7Exception

public HL7Exception(java.lang.String message,
                    int errorCondition,
                    java.lang.Throwable cause)
Creates an HL7Exception.

Parameters:
errorCondition - a code describing the the error condition, from HL7 table 0357 (see section 2.16.8 of standard v 2.4) - HL7Exception defines these codes as integer constants that can be used here (e.g. HL7Exception.UNSUPPORTED_MESSAGE_TYPE)
cause - The excption that caused this exception tobe thrown.

HL7Exception

public HL7Exception(java.lang.String message,
                    int errorCondition)
Creates an HL7Exception.

Parameters:
errorCondition - a code describing the the error condition, from HL7 table 0357 (see section 2.16.8 of standard v 2.4) - HL7Exception defines these codes as integer constants that can be used here (e.g. HL7Exception.UNSUPPORTED_MESSAGE_TYPE)

HL7Exception

public HL7Exception(java.lang.String message,
                    java.lang.Throwable cause)
Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR

Parameters:
cause - The excption that caused this exception tobe thrown.

HL7Exception

public HL7Exception(java.lang.Throwable cause)
Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR

Parameters:
cause - The excption that caused this exception tobe thrown.

HL7Exception

public HL7Exception(java.lang.String message)
Creates an HL7Exception with the code APPLICATION_INTERNAL_ERROR

Method Detail

setSegmentName

public void setSegmentName(java.lang.String segmentName)
Sets the name of the segment where the error occured.


getSegmentName

public java.lang.String getSegmentName()
Returns the name of the segment where the error occured, if this has been set (null otherwise).


setSegmentRepetition

public void setSegmentRepetition(int sequenceNum)
Sets the sequence number of the segment where the error occured if there are multiplt segments with the same name (ie the sequenceNum'th segment with the name specified in setSegmentName). Numbering starts at 1.


getSegmentRepetition

public int getSegmentRepetition()
Returns the sequence number of the segment where the error occured (if there are multiple segments with the same name) if this has been set, -1 otherwise - numbering starts at 1.


setFieldPosition

public void setFieldPosition(int fieldNum)
Sets the field number (within a segment) where the error occured; numbering starts at 1.


getFieldPosition

public int getFieldPosition()
Returns the field number within the segment where the error occured if it has been set, -1 otherwise; numbering starts at 1.


getErrorCode

public int getErrorCode()
Returns:
Returns the error code associated with this exception, or -1 if none

getMessage

public java.lang.String getMessage()
Overrides Throwable.getMessage() to add the field location of the problem if available.

Overrides:
getMessage in class java.lang.Throwable

populate

public void populate(Segment errorSegment,
                     java.lang.String theJdbcUrl)
              throws HL7Exception
Populates the given error segment with information from this Exception.

Throws:
HL7Exception


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