Class CodeSystemDAOImpl
- java.lang.Object
-
- com.ibm.fhir.persistence.jdbc.dao.impl.CodeSystemDAOImpl
-
- All Implemented Interfaces:
CodeSystemDAO
- Direct Known Subclasses:
DerbyCodeSystemDAO
,PostgresCodeSystemDAO
public class CodeSystemDAOImpl extends 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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_TOKEN_SYSTEM
-
Constructor Summary
Constructors Constructor Description CodeSystemDAOImpl(Connection c, 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 Connection
getConnection()
Provide subclasses with access to theConnection
protected String
getSchemaName()
Getter for the FHIR data schemaMap<String,Integer>
readAllCodeSystems()
Reads all rows in the code_systems table and returns the data as a MapInteger
readCodeSystemId(String codeSystem)
Read the code_system_id for the given code system nameint
readOrAddCodeSystem(String systemName)
Calls a stored procedure to read the system contained in the passed Parameter in the Code_Systems table.
-
-
-
Field Detail
-
DEFAULT_TOKEN_SYSTEM
public static final String DEFAULT_TOKEN_SYSTEM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CodeSystemDAOImpl
public CodeSystemDAOImpl(Connection c, String schemaName)
Constructs a DAO instance suitable for acquiring connections from a JDBC Datasource object.
-
-
Method Detail
-
getConnection
protected Connection getConnection()
Provide subclasses with access to theConnection
- Returns:
-
getSchemaName
protected String getSchemaName()
Getter for the FHIR data schema- Returns:
-
readAllCodeSystems
public Map<String,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(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 Integer readCodeSystemId(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
-
-