Class EraseResourceDAO
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.jdbc.dao.impl.FHIRDbDAOImpl
-
- org.linuxforhealth.fhir.persistence.jdbc.dao.impl.ResourceDAOImpl
-
- org.linuxforhealth.fhir.persistence.jdbc.dao.EraseResourceDAO
-
- All Implemented Interfaces:
FHIRDbDAO
,ResourceDAO
public class EraseResourceDAO extends ResourceDAOImpl
EraseDAO is the data access layer of the erase operation which executes directly against the database using SQL statements to:- check the resource exists
- delete all versions from the resource table
- delete all parameters
- delete entries from global table
- delete resource specific logical resource entry
-
-
Field Summary
-
Fields inherited from class org.linuxforhealth.fhir.persistence.jdbc.dao.impl.ResourceDAOImpl
DEFAULT_VALUE_REINDEX_TSTAMP, IDX_DATA, IDX_IS_DELETED, IDX_LAST_UPDATED, IDX_LOGICAL_ID, IDX_LOGICAL_RESOURCE_ID, IDX_RESOURCE_ID, IDX_RESOURCE_PAYLOAD_KEY, IDX_RESOURCE_TYPE_ID, IDX_VERSION_ID
-
-
Constructor Summary
Constructors Constructor Description EraseResourceDAO(java.sql.Connection conn, java.lang.String adminSchemaName, IDatabaseTranslator translator, java.lang.String schemaName, FHIRDbFlavor flavor, FHIRPersistenceJDBCCache cache)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearErasedResourcesInGroup(long erasedResourceGroupId)
Delete all the ERASED_RESOURCE records belonging to the given erasedResourceGroupIdvoid
deleteFromAllParametersTables(java.lang.String tablePrefix, long logicalResourceId)
Deletes from the Parameterslong
erase(ResourceEraseRecord eraseRecord, EraseDTO eraseDto)
processes the erasejava.util.List<ErasedResourceRec>
getErasedResourceRecords(long erasedResourceGroupId)
Fetch all the ERASED_RESOURCE records associated with the given erasedResourceGroupIdResource
insert(Resource resource, java.util.List<ExtractedParameterValue> parameters, java.lang.String parameterHashB64, ParameterDAO parameterDao, java.lang.Integer ifNoneMatch)
Inserts the passed Resource DTO and its associated search parameters to the appropriate FHIR resource tables.void
runInDao(long erasedResourceGroupId)
Executes the SQL logic as part of the dao rather than via a stored procedure/function.-
Methods inherited from class org.linuxforhealth.fhir.persistence.jdbc.dao.impl.ResourceDAOImpl
checkIfNoneMatch, createDTO, getCache, getResourceTypeId, getSearchByIdsNoDataSql, getSearchByIdsSql, getTransactionData, history, historyCount, read, readAllResourceTypeNames, readLogicalResourceId, readLogicalResourceIdList, readResourceTypeId, search, search, searchByIds, searchCount, searchCount, searchForIds, searchWholeSystem, setInt, setPersistenceContext, setString, versionRead
-
Methods inherited from class org.linuxforhealth.fhir.persistence.jdbc.dao.impl.FHIRDbDAOImpl
buildExceptionWithIssue, buildFHIRPersistenceDBConnectException, cleanup, cleanup, createDTOs, getConnection, getFlavor, getSchemaName, getTranslator, runCountQuery, runCountQuery, runQuery, 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 org.linuxforhealth.fhir.persistence.jdbc.dao.api.FHIRDbDAO
getConnection, getFlavor
-
-
-
-
Constructor Detail
-
EraseResourceDAO
public EraseResourceDAO(java.sql.Connection conn, java.lang.String adminSchemaName, IDatabaseTranslator translator, java.lang.String schemaName, FHIRDbFlavor flavor, FHIRPersistenceJDBCCache cache)
Public constructor- Parameters:
conn
-adminSchemaName
-translator
-schemaName
-flavor
-cache
-
-
-
Method Detail
-
runInDao
public void runInDao(long erasedResourceGroupId) throws FHIRPersistenceException
Executes the SQL logic as part of the dao rather than via a stored procedure/function.- Parameters:
erasedResourceGroupId
-- Throws:
java.sql.SQLException
FHIRPersistenceException
-
deleteFromAllParametersTables
public void deleteFromAllParametersTables(java.lang.String tablePrefix, long logicalResourceId) throws java.sql.SQLException
Deletes from the Parameters- Parameters:
tablePrefix
-logicalResourceId
-- Throws:
java.sql.SQLException
-
erase
public long erase(ResourceEraseRecord eraseRecord, EraseDTO eraseDto) throws java.lang.Exception
processes the erase- Parameters:
eraseRecord
- the outputeraseDto
- the input- Throws:
java.lang.Exception
-
getErasedResourceRecords
public java.util.List<ErasedResourceRec> getErasedResourceRecords(long erasedResourceGroupId)
Fetch all the ERASED_RESOURCE records associated with the given erasedResourceGroupId- Parameters:
erasedResourceGroupId
-- Returns:
-
clearErasedResourcesInGroup
public void clearErasedResourcesInGroup(long erasedResourceGroupId)
Delete all the ERASED_RESOURCE records belonging to the given erasedResourceGroupId- Parameters:
erasedResourceGroupId
-
-
insert
public Resource insert(Resource resource, java.util.List<ExtractedParameterValue> parameters, java.lang.String parameterHashB64, ParameterDAO parameterDao, java.lang.Integer ifNoneMatch) throws FHIRPersistenceException
Description copied from interface:ResourceDAO
Inserts the passed Resource DTO and its associated search parameters to the appropriate FHIR resource tables. After insert, the generated primary key is acquired and set in the Resource object.- Parameters:
resource
- A Resource Data Transfer Objectparameters
- A collection of search parameters to be persisted along with the passed ResourceparameterHashB64
- Base64 encoded SHA-256 hash of parametersparameterDao
- The Parameter DAOifNoneMatch
- 0 for conditional create-on-update behavior; otherwise null- Returns:
- Resource The Resource DTO
- Throws:
FHIRPersistenceDataAccessException
FHIRPersistenceDBConnectException
FHIRPersistenceVersionIdMismatchException
FHIRPersistenceException
-
-