ca.uhn.hl7v2.util
Class CodeMapper

java.lang.Object
  extended by ca.uhn.hl7v2.util.CodeMapper
Direct Known Subclasses:
FileCodeMapper

public abstract class CodeMapper
extends java.lang.Object

Maps local codes to interface codes and vice versa. The default implementation of CodeMapper is FileCodeMapper. An instance of FileCodeMapper can be obtained by calling CodeMapper.getInstance(). See FileCodeMapper for instructions on how to set up code map files.

Please note that this class is not intended for the purpose of enumerating valid codes. If that is what you are looking for please see ca.uhn.hl7v2.TableRepository

Author:
Bryan Tripp

Constructor Summary
CodeMapper()
           
 
Method Summary
static CodeMapper getInstance()
          Returns a singleton instance of CodeMapper.
static java.lang.String getInt(java.lang.String interfaceName, int hl7Table, java.lang.String localCode)
          A convenience method that returns an interface code from an underlying CodeMapper instance by calling CodeMapper.getInstance().getInterfaceCode(...)
abstract  java.lang.String getInterfaceCode(java.lang.String interfaceName, int hl7Table, java.lang.String localCode)
          Returns the interface code for the given local code, for use in the context of the given interface.
static java.lang.String getLocal(java.lang.String interfaceName, int hl7Table, java.lang.String interfaceCode)
          A convenience method that returns a local code from an underlying CodeMapper instance by calling CodeMapper.getInstance().getLocalCode(...)
abstract  java.lang.String getLocalCode(java.lang.String interfaceName, int hl7Table, java.lang.String interfaceCode)
          Returns the local code for the given interface code as it appears in the given interface.
abstract  void refreshCache()
          If values are cached in such a way that they are not guaranteed to be current, a call to this method refreshes the values.
abstract  void throwExceptionIfNoMatch(boolean throwException)
          Determines what happens if no matching code is found during a lookup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeMapper

public CodeMapper()
Method Detail

getInstance

public static CodeMapper getInstance()
                              throws HL7Exception
Returns a singleton instance of CodeMapper. This is currently a FileCodeMapper by default.

Throws:
HL7Exception

getLocal

public static java.lang.String getLocal(java.lang.String interfaceName,
                                        int hl7Table,
                                        java.lang.String interfaceCode)
                                 throws HL7Exception
A convenience method that returns a local code from an underlying CodeMapper instance by calling CodeMapper.getInstance().getLocalCode(...)

Throws:
HL7Exception

getInt

public static java.lang.String getInt(java.lang.String interfaceName,
                                      int hl7Table,
                                      java.lang.String localCode)
                               throws HL7Exception
A convenience method that returns an interface code from an underlying CodeMapper instance by calling CodeMapper.getInstance().getInterfaceCode(...)

Throws:
HL7Exception

getInterfaceCode

public abstract java.lang.String getInterfaceCode(java.lang.String interfaceName,
                                                  int hl7Table,
                                                  java.lang.String localCode)
                                           throws HL7Exception
Returns the interface code for the given local code, for use in the context of the given interface.

Throws:
HL7Exception

getLocalCode

public abstract java.lang.String getLocalCode(java.lang.String interfaceName,
                                              int hl7Table,
                                              java.lang.String interfaceCode)
                                       throws HL7Exception
Returns the local code for the given interface code as it appears in the given interface.

Throws:
HL7Exception

throwExceptionIfNoMatch

public abstract void throwExceptionIfNoMatch(boolean throwException)
Determines what happens if no matching code is found during a lookup. If set to true, an HL7Exception is thrown if there is no match. If false, null is returned. The default is false.


refreshCache

public abstract void refreshCache()
                           throws HL7Exception
If values are cached in such a way that they are not guaranteed to be current, a call to this method refreshes the values.

Throws:
HL7Exception


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