Class CodeSystemDAOImpl
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.jdbc.dao.impl.CodeSystemDAOImpl
-
- All Implemented Interfaces:
CodeSystemDAO
- Direct Known Subclasses:
DerbyCodeSystemDAO
,PostgresCodeSystemDAO
public class CodeSystemDAOImpl extends java.lang.Object implements CodeSystemDAO
This DAO uses a connection provided to its constructor. It's therefore assumed to be a short-lived object, created on-the-fly. Caching etc is handled elsewhere...we're just doing JDBC stuff here.
-
-
Constructor Summary
Constructors Constructor Description CodeSystemDAOImpl(java.sql.Connection c, java.lang.String schemaName)
Constructs a DAO instance suitable for acquiring connections from a JDBC Datasource object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.sql.Connection
getConnection()
Provide subclasses with access to theConnection
protected java.lang.String
getSchemaName()
Getter for the FHIR data schemajava.util.Map<java.lang.String,java.lang.Integer>
readAllCodeSystems()
Reads all rows in the code_systems table and returns the data as a Mapjava.lang.Integer
readCodeSystemId(java.lang.String codeSystem)
Read the code_system_id for the given code system nameint
readOrAddCodeSystem(java.lang.String systemName)
Calls a stored procedure to read the system contained in the passed Parameter in the Code_Systems table.
-
-
-
Method Detail
-
getConnection
protected java.sql.Connection getConnection()
Provide subclasses with access to theConnection
- Returns:
-
getSchemaName
protected java.lang.String getSchemaName()
Getter for the FHIR data schema- Returns:
-
readAllCodeSystems
public java.util.Map<java.lang.String,java.lang.Integer> readAllCodeSystems() throws FHIRPersistenceDataAccessException
Description copied from interface:CodeSystemDAO
Reads all rows in the code_systems table and returns the data as a Map- Specified by:
readAllCodeSystems
in interfaceCodeSystemDAO
- Returns:
- A map containing key=system-name, value=system-id
- Throws:
FHIRPersistenceDataAccessException
-
readOrAddCodeSystem
public int readOrAddCodeSystem(java.lang.String systemName) throws FHIRPersistenceDataAccessException
Calls a stored procedure to read the system contained in the passed Parameter in the Code_Systems table. If it's not in the DB, it will be stored and a unique id will be returned.- Specified by:
readOrAddCodeSystem
in interfaceCodeSystemDAO
- Parameters:
systemName
-- Returns:
- The generated id of the stored system.
- Throws:
FHIRPersistenceDataAccessException
-
readCodeSystemId
public java.lang.Integer readCodeSystemId(java.lang.String codeSystem) throws FHIRPersistenceDataAccessException
Description copied from interface:CodeSystemDAO
Read the code_system_id for the given code system name- Specified by:
readCodeSystemId
in interfaceCodeSystemDAO
- Returns:
- the parameter_name_id for for parameter, or null if it doesn't exist
- Throws:
FHIRPersistenceDataAccessException
-
-