Class PlainDerbyParamValueProcessor
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.params.database.PlainParamValueProcessor
-
- org.linuxforhealth.fhir.persistence.params.database.PlainDerbyParamValueProcessor
-
- All Implemented Interfaces:
IParamValueProcessor
public class PlainDerbyParamValueProcessor extends PlainParamValueProcessor
Derby variant of the plain schema param value processor which is needed because Derby needs slightly different syntax for some queries and in particular, we need to be very careful issuing both SQL and DML in a specific order to avoid deadlocks due to compatibility issues with shared (S) and exclusive (X) locks in Derby.
-
-
Field Summary
-
Fields inherited from class org.linuxforhealth.fhir.persistence.params.database.PlainParamValueProcessor
connection, FIXED_SHARD, identityCache, maxCodeSystemsPerStatement, maxCommonCanonicalValuesPerStatement, maxCommonTokenValuesPerStatement, maxLogicalResourcesPerStatement, schemaName, translator
-
-
Constructor Summary
Constructors Constructor Description PlainDerbyParamValueProcessor(java.sql.Connection connection, java.lang.String schemaName, IParameterIdentityCache cache)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addMissingCodeSystems(java.util.List<CodeSystemValue> codeSystems)
These code systems weren't found in the database, so we need to try and add them.protected void
addMissingCommonCanonicalValues(java.util.List<CommonCanonicalValue> missing)
Add the values we think are missing from the database.protected void
addMissingCommonTokenValues(java.util.List<CommonTokenValue> missing)
Add the values we think are missing from the database.protected void
addMissingLogicalResourceIdents(java.util.List<LogicalResourceIdentValue> missing)
These logical_resource_ident values weren't found in the database, so we need to try and add them.protected java.lang.Integer
createParameterName(java.lang.String parameterName)
Create the parameter name using the stored procedure which handles any concurrency issue we may haveprotected java.util.List<CommonCanonicalValue>
fetchCanonicalIds(java.util.List<CommonCanonicalValue> unresolved, java.util.Map<CommonCanonicalValueKey,CommonCanonicalValue> commonCanonicalValueMap)
Fetch the common_canonical_id values for the given list of CommonCanonicalValue objects.protected java.util.List<CodeSystemValue>
fetchCodeSystemIds(java.util.List<CodeSystemValue> unresolved, java.util.Map<java.lang.String,CodeSystemValue> codeSystemValueMap)
Fetch all the code_system_id values for the given list of CodeSystemValue objects.protected java.util.List<CommonTokenValue>
fetchCommonTokenValueIds(java.util.List<CommonTokenValue> unresolved, java.util.Map<CommonTokenValueKey,CommonTokenValue> commonTokenValueMap)
Fetch the common_token_value_id values for the given list of CommonTokenValue objects.protected java.util.List<LogicalResourceIdentValue>
fetchLogicalResourceIdentIds(java.util.List<LogicalResourceIdentValue> unresolved, java.util.Map<LogicalResourceIdentKey,LogicalResourceIdentValue> logicalResourceIdentMap)
Fetch logical_resource_id values for the given list of LogicalResourceIdent objects.protected java.lang.String
onConflict()
-
Methods inherited from class org.linuxforhealth.fhir.persistence.params.database.PlainParamValueProcessor
buildCommonTokenValueSelectStatement, buildLogicalResourceIdentSelectStatement, close, publish, pushBatch, resetBatch, resolveCanonicalValues, resolveCommonTokenValues, resolveLogicalResourceIdents, resolveParameterNames, resolveSystemValues, startBatch
-
-
-
-
Constructor Detail
-
PlainDerbyParamValueProcessor
public PlainDerbyParamValueProcessor(java.sql.Connection connection, java.lang.String schemaName, IParameterIdentityCache cache)
Public constructor- Parameters:
connection
-schemaName
-cache
-
-
-
Method Detail
-
onConflict
protected java.lang.String onConflict()
- Specified by:
onConflict
in classPlainParamValueProcessor
-
createParameterName
protected java.lang.Integer createParameterName(java.lang.String parameterName) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Create the parameter name using the stored procedure which handles any concurrency issue we may have- Overrides:
createParameterName
in classPlainParamValueProcessor
- Returns:
- Throws:
FHIRPersistenceException
-
fetchLogicalResourceIdentIds
protected java.util.List<LogicalResourceIdentValue> fetchLogicalResourceIdentIds(java.util.List<LogicalResourceIdentValue> unresolved, java.util.Map<LogicalResourceIdentKey,LogicalResourceIdentValue> logicalResourceIdentMap) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Fetch logical_resource_id values for the given list of LogicalResourceIdent objects.- Overrides:
fetchLogicalResourceIdentIds
in classPlainParamValueProcessor
- Returns:
- Throws:
FHIRPersistenceException
-
addMissingLogicalResourceIdents
protected void addMissingLogicalResourceIdents(java.util.List<LogicalResourceIdentValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
These logical_resource_ident values weren't found in the database, so we need to try and add them. We have to deal with concurrency here - there's a chance another thread could also be trying to add them. To avoid deadlocks, it's important to do any inserts in a consistent order. At the end, we should be able to read back values for each entry- Overrides:
addMissingLogicalResourceIdents
in classPlainParamValueProcessor
- Throws:
FHIRPersistenceException
-
fetchCodeSystemIds
protected java.util.List<CodeSystemValue> fetchCodeSystemIds(java.util.List<CodeSystemValue> unresolved, java.util.Map<java.lang.String,CodeSystemValue> codeSystemValueMap) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Fetch all the code_system_id values for the given list of CodeSystemValue objects.- Overrides:
fetchCodeSystemIds
in classPlainParamValueProcessor
- Returns:
- Throws:
FHIRPersistenceException
-
addMissingCodeSystems
protected void addMissingCodeSystems(java.util.List<CodeSystemValue> codeSystems)
Description copied from class:PlainParamValueProcessor
These code systems weren't found in the database, so we need to try and add them. We have to deal with concurrency here - there's a chance another thread could also be trying to add them. To avoid deadlocks, it's important to do any inserts in a consistent order. At the end, we should be able to read back values for each entry- Overrides:
addMissingCodeSystems
in classPlainParamValueProcessor
-
fetchCommonTokenValueIds
protected java.util.List<CommonTokenValue> fetchCommonTokenValueIds(java.util.List<CommonTokenValue> unresolved, java.util.Map<CommonTokenValueKey,CommonTokenValue> commonTokenValueMap) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Fetch the common_token_value_id values for the given list of CommonTokenValue objects.- Overrides:
fetchCommonTokenValueIds
in classPlainParamValueProcessor
- Returns:
- Throws:
FHIRPersistenceException
-
addMissingCommonTokenValues
protected void addMissingCommonTokenValues(java.util.List<CommonTokenValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Add the values we think are missing from the database. The given list should be sorted to reduce deadlocks- Overrides:
addMissingCommonTokenValues
in classPlainParamValueProcessor
- Throws:
FHIRPersistenceException
-
fetchCanonicalIds
protected java.util.List<CommonCanonicalValue> fetchCanonicalIds(java.util.List<CommonCanonicalValue> unresolved, java.util.Map<CommonCanonicalValueKey,CommonCanonicalValue> commonCanonicalValueMap) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Fetch the common_canonical_id values for the given list of CommonCanonicalValue objects.- Overrides:
fetchCanonicalIds
in classPlainParamValueProcessor
- Returns:
- Throws:
FHIRPersistenceException
-
addMissingCommonCanonicalValues
protected void addMissingCommonCanonicalValues(java.util.List<CommonCanonicalValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessor
Add the values we think are missing from the database. The given list should be sorted to reduce deadlocks- Overrides:
addMissingCommonCanonicalValues
in classPlainParamValueProcessor
- Throws:
FHIRPersistenceException
-
-