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 voidaddMissingCodeSystems(java.util.List<CodeSystemValue> codeSystems)These code systems weren't found in the database, so we need to try and add them.protected voidaddMissingCommonCanonicalValues(java.util.List<CommonCanonicalValue> missing)Add the values we think are missing from the database.protected voidaddMissingCommonTokenValues(java.util.List<CommonTokenValue> missing)Add the values we think are missing from the database.protected voidaddMissingLogicalResourceIdents(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.IntegercreateParameterName(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.StringonConflict()- 
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:
 onConflictin classPlainParamValueProcessor
 
- 
createParameterName
protected java.lang.Integer createParameterName(java.lang.String parameterName) throws FHIRPersistenceExceptionDescription copied from class:PlainParamValueProcessorCreate the parameter name using the stored procedure which handles any concurrency issue we may have- Overrides:
 createParameterNamein 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:PlainParamValueProcessorFetch logical_resource_id values for the given list of LogicalResourceIdent objects.- Overrides:
 fetchLogicalResourceIdentIdsin classPlainParamValueProcessor- Returns:
 - Throws:
 FHIRPersistenceException
 
- 
addMissingLogicalResourceIdents
protected void addMissingLogicalResourceIdents(java.util.List<LogicalResourceIdentValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessorThese 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:
 addMissingLogicalResourceIdentsin 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:PlainParamValueProcessorFetch all the code_system_id values for the given list of CodeSystemValue objects.- Overrides:
 fetchCodeSystemIdsin classPlainParamValueProcessor- Returns:
 - Throws:
 FHIRPersistenceException
 
- 
addMissingCodeSystems
protected void addMissingCodeSystems(java.util.List<CodeSystemValue> codeSystems)
Description copied from class:PlainParamValueProcessorThese 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:
 addMissingCodeSystemsin 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:PlainParamValueProcessorFetch the common_token_value_id values for the given list of CommonTokenValue objects.- Overrides:
 fetchCommonTokenValueIdsin classPlainParamValueProcessor- Returns:
 - Throws:
 FHIRPersistenceException
 
- 
addMissingCommonTokenValues
protected void addMissingCommonTokenValues(java.util.List<CommonTokenValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessorAdd the values we think are missing from the database. The given list should be sorted to reduce deadlocks- Overrides:
 addMissingCommonTokenValuesin 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:PlainParamValueProcessorFetch the common_canonical_id values for the given list of CommonCanonicalValue objects.- Overrides:
 fetchCanonicalIdsin classPlainParamValueProcessor- Returns:
 - Throws:
 FHIRPersistenceException
 
- 
addMissingCommonCanonicalValues
protected void addMissingCommonCanonicalValues(java.util.List<CommonCanonicalValue> missing) throws FHIRPersistenceException
Description copied from class:PlainParamValueProcessorAdd the values we think are missing from the database. The given list should be sorted to reduce deadlocks- Overrides:
 addMissingCommonCanonicalValuesin classPlainParamValueProcessor- Throws:
 FHIRPersistenceException
 
 - 
 
 -