/** * Returns a singleton instance of CodeMapper. This is currently * a FileCodeMapper by default. */ public synchronized static CodeMapper getInstance() throws HL7Exception { if (codeMapper == null) { //create new file code mapper codeMapper = new FileCodeMapper(); } return codeMapper; }
/** * Returns the interface code for the given local code, for use in the context * of the given interface. */ public String getInterfaceCode(String interfaceName, int hl7Table, String localCode) throws HL7Exception { String interfaceCode = null; try { Map<String, Map<String, String>> interfaceMap = localToInterface.get(interfaceName); interfaceCode = getCode(interfaceMap, hl7Table, localCode); } catch (NullPointerException npe) { if (this.throwIfNoMatch) throw new HL7Exception( "No interface mapping for the local code " + localCode + " for HL7 table " + hl7Table + " for the interface '" + interfaceName + "'", ErrorCode.TABLE_VALUE_NOT_FOUND); } return interfaceCode; }
/** * Creates a new instance of FileCodeMapper. You should probably not * construct a FileCodeMapper directly. Use CodeMapper.getInstance() * instead ... this will ensure that only a single instance is created, * which is important for performance because code maps are loaded from * disk every time this constructor is called. */ public FileCodeMapper() throws HL7Exception { baseDir = new File(Home.getHomeDirectory().getAbsolutePath() + "/codemap"); refreshCache(); }
/** * Returns the local code for the given interface code as it appears in * the given interface. */ public String getLocalCode(String interfaceName, int hl7Table, String interfaceCode) throws HL7Exception { String localCode = null; try { Map<String, Map<String, String>> interfaceMap = interfaceToLocal.get(interfaceName); localCode = getCode(interfaceMap, hl7Table, interfaceCode); } catch (NullPointerException npe) { if (this.throwIfNoMatch) throw new HL7Exception( "No local mapping for the interface code " + interfaceCode + " for HL7 table " + hl7Table + " for the interface '" + interfaceName + "'", ErrorCode.TABLE_VALUE_NOT_FOUND); } return localCode; }
/** * Creates a new instance of FileCodeMapper. You should probably not * construct a FileCodeMapper directly. Use CodeMapper.getInstance() * instead ... this will ensure that only a single instance is created, * which is important for performance because code maps are loaded from * disk every time this constructor is called. */ public FileCodeMapper() throws HL7Exception { baseDir = new File(Home.getHomeDirectory().getAbsolutePath() + "/codemap"); refreshCache(); }
/** * Returns the local code for the given interface code as it appears in * the given interface. */ public String getLocalCode(String interfaceName, int hl7Table, String interfaceCode) throws HL7Exception { String localCode = null; try { Map<String, Map<String, String>> interfaceMap = interfaceToLocal.get(interfaceName); localCode = getCode(interfaceMap, hl7Table, interfaceCode); } catch (NullPointerException npe) { if (this.throwIfNoMatch) throw new HL7Exception( "No local mapping for the interface code " + interfaceCode + " for HL7 table " + hl7Table + " for the interface '" + interfaceName + "'", ErrorCode.TABLE_VALUE_NOT_FOUND); } return localCode; }
/** * Returns a singleton instance of CodeMapper. This is currently * a FileCodeMapper by default. */ public synchronized static CodeMapper getInstance() throws HL7Exception { if (codeMapper == null) { //create new file code mapper codeMapper = new FileCodeMapper(); } return codeMapper; }
/** * Returns the interface code for the given local code, for use in the context * of the given interface. */ public String getInterfaceCode(String interfaceName, int hl7Table, String localCode) throws HL7Exception { String interfaceCode = null; try { Map<String, Map<String, String>> interfaceMap = localToInterface.get(interfaceName); interfaceCode = getCode(interfaceMap, hl7Table, localCode); } catch (NullPointerException npe) { if (this.throwIfNoMatch) throw new HL7Exception( "No interface mapping for the local code " + localCode + " for HL7 table " + hl7Table + " for the interface '" + interfaceName + "'", ErrorCode.TABLE_VALUE_NOT_FOUND); } return interfaceCode; }