Class ParameterDAOImpl
- java.lang.Object
-
- com.ibm.fhir.persistence.jdbc.dao.impl.FHIRDbDAOImpl
-
- com.ibm.fhir.persistence.jdbc.dao.impl.ParameterDAOImpl
-
- All Implemented Interfaces:
FHIRDbDAO
,ParameterDAO
public class ParameterDAOImpl extends FHIRDbDAOImpl implements ParameterDAO
This Data Access Object implements the ParameterDAO interface for creating, updating, and retrieving rows in the IBM FHIR Server parameter-related tables.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_TOKEN_SYSTEM
-
Constructor Summary
Constructors Constructor Description ParameterDAOImpl(Connection connection, String schemaName, FHIRDbFlavor flavor)
Constructs a DAO using the passed externally managed database connection.ParameterDAOImpl(Connection connection, String schemaName, FHIRDbFlavor flavor, TransactionSynchronizationRegistry trxSynchRegistry)
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 int
acquireCodeSystemId(String codeSystemName)
Acquire and return the id associated with the passed code-system name.int
acquireParameterNameId(String parameterName)
Acquire and return the id associated with the passed parameter name.void
addCodeSystemsCacheCandidate(String codeSystemName, Integer codeSystemId)
Adds a code system name / code system id pair to a candidate collection for population into the CodeSystemsCache.void
addParameterNamesCacheCandidate(String parameterName, Integer parameterId)
Adds a parameter name / parameter id pair to a candidate collection for population into the ParameterNamesCache.protected Integer
getCodeSystemIdFromCaches(String codeSystemName)
protected Integer
getParameterNameIdFromCaches(String parameterName)
Map<String,Integer>
readAllCodeSystems()
Reads all rows in the Code_Systems table and returns the data as a MapMap<String,Integer>
readAllSearchParameterNames()
Reads all rows in the Parameter_Names table and returns the data as a MapInteger
readCodeSystemId(String codeSystemName)
Read the id for the given code system name, but do not create a new record if it doesn't exist.int
readOrAddCodeSystemId(String codeSystemName)
Calls a stored procedure to read the system contained in the passed Parameter in the Code_Systems table.int
readOrAddParameterNameId(String parameterName)
Calls a stored procedure to read the name contained in the passed Parameter in the Parameter_Names table.Integer
readParameterNameId(String parameterName)
Read the id for the given parameter name, but do not create a new record if it doesn't exist.-
Methods inherited from class com.ibm.fhir.persistence.jdbc.dao.impl.FHIRDbDAOImpl
buildExceptionWithIssue, buildFHIRPersistenceDBConnectException, cleanup, cleanup, createDTO, createDTOs, getConnection, getFlavor, getSchemaName, isDb2Database, runCountQuery, runQuery, runQuery_STR_VALUES, severe, severe
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.fhir.persistence.jdbc.dao.api.FHIRDbDAO
getConnection, getFlavor, isDb2Database
-
-
-
-
Field Detail
-
DEFAULT_TOKEN_SYSTEM
public static final String DEFAULT_TOKEN_SYSTEM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParameterDAOImpl
public ParameterDAOImpl(Connection connection, String schemaName, FHIRDbFlavor flavor, TransactionSynchronizationRegistry trxSynchRegistry)
Constructs a DAO instance suitable for acquiring connections from a JDBC Datasource object.- Parameters:
Connection
- - A database connection that will be managed by the caller.schemaName
-flavor
-trxSynchRegistry
-
-
ParameterDAOImpl
public ParameterDAOImpl(Connection connection, String schemaName, FHIRDbFlavor flavor)
Constructs a DAO using the passed externally managed database connection. The connection used by this instance for all DB operations will be the passed connection.- Parameters:
Connection
- - A database connection that will be managed by the caller.schemaName
-flavor
-
-
-
Method Detail
-
readAllSearchParameterNames
public Map<String,Integer> readAllSearchParameterNames() throws FHIRPersistenceDBConnectException, FHIRPersistenceDataAccessException
Description copied from interface:ParameterDAO
Reads all rows in the Parameter_Names table and returns the data as a Map- Specified by:
readAllSearchParameterNames
in interfaceParameterDAO
- Returns:
- Map
- A map containing key=parameter-name, value=parameter-name-id - Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
-
readAllCodeSystems
public Map<String,Integer> readAllCodeSystems() throws FHIRPersistenceDBConnectException, FHIRPersistenceDataAccessException
Description copied from interface:ParameterDAO
Reads all rows in the Code_Systems table and returns the data as a Map- Specified by:
readAllCodeSystems
in interfaceParameterDAO
- Returns:
- Map
- A map containing key=system-name, value=system-id - Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
-
readOrAddParameterNameId
public int readOrAddParameterNameId(String parameterName) throws FHIRPersistenceDBConnectException, FHIRPersistenceDataAccessException
Calls a stored procedure to read the name contained in the passed Parameter in the Parameter_Names table. If it's not in the DB, it will be stored and a unique id will be returned.- Specified by:
readOrAddParameterNameId
in interfaceParameterDAO
- Parameters:
parameter
-- Returns:
- Integer - The generated id of the stored system.
- Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
-
readOrAddCodeSystemId
public int readOrAddCodeSystemId(String codeSystemName) throws FHIRPersistenceDBConnectException, 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:
readOrAddCodeSystemId
in interfaceParameterDAO
- Parameters:
parameter
-- Returns:
- Integer - The generated id of the stored system.
- Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
FHIRPersistenceException
-
addCodeSystemsCacheCandidate
public void addCodeSystemsCacheCandidate(String codeSystemName, Integer codeSystemId) throws FHIRPersistenceException
Adds a code system name / code system id pair to a candidate collection for population into the CodeSystemsCache. This pair must be present as a row in the FHIR DB CODE_SYSTEMS table.- Specified by:
addCodeSystemsCacheCandidate
in interfaceParameterDAO
- Parameters:
codeSystemName
- A valid code system name.codeSystemId
- The id corresponding to the code system name.- Throws:
FHIRPersistenceException
-
addParameterNamesCacheCandidate
public void addParameterNamesCacheCandidate(String parameterName, Integer parameterId) throws FHIRPersistenceException
Adds a parameter name / parameter id pair to a candidate collection for population into the ParameterNamesCache. This pair must be present as a row in the FHIR DB PARAMETER_NAMES table.- Specified by:
addParameterNamesCacheCandidate
in interfaceParameterDAO
- Parameters:
parameterName
- A valid search or sort parameter name.parameterId
- The id corresponding to the parameter name.- Throws:
FHIRPersistenceException
-
acquireParameterNameId
public int acquireParameterNameId(String parameterName) throws FHIRPersistenceException
Acquire and return the id associated with the passed parameter name.- Specified by:
acquireParameterNameId
in interfaceParameterDAO
- Parameters:
parameterName
- The name of a valid FHIR search parameter.- Returns:
- Integer A parameter id.
- Throws:
FHIRPersistenceException
-
acquireCodeSystemId
public int acquireCodeSystemId(String codeSystemName) throws FHIRPersistenceException
Acquire and return the id associated with the passed code-system name.- Specified by:
acquireCodeSystemId
in interfaceParameterDAO
- Parameters:
codeSystemName
- The name of a valid code-system.- Returns:
- Integer A code-system id.
- Throws:
FHIRPersistenceException
-
readParameterNameId
public Integer readParameterNameId(String parameterName) throws FHIRPersistenceDBConnectException, FHIRPersistenceDataAccessException
Description copied from interface:ParameterDAO
Read the id for the given parameter name, but do not create a new record if it doesn't exist.- Specified by:
readParameterNameId
in interfaceParameterDAO
- Returns:
- the id for the parameter name, or null not found
- Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
-
readCodeSystemId
public Integer readCodeSystemId(String codeSystemName) throws FHIRPersistenceDBConnectException, FHIRPersistenceDataAccessException
Description copied from interface:ParameterDAO
Read the id for the given code system name, but do not create a new record if it doesn't exist.- Specified by:
readCodeSystemId
in interfaceParameterDAO
- Returns:
- Integer - The id associated with the passed code system name, or null if it doesn't exist
- Throws:
FHIRPersistenceDBConnectException
FHIRPersistenceDataAccessException
-
-