Package dev.dsf.fhir.dao.jdbc
Class NamingSystemDaoJdbc
java.lang.Object
dev.dsf.fhir.dao.jdbc.NamingSystemDaoJdbc
- All Implemented Interfaces:
NamingSystemDao,ResourceDao<org.hl7.fhir.r4.model.NamingSystem>,org.springframework.beans.factory.InitializingBean
-
Field Summary
Fields inherited from interface dev.dsf.fhir.dao.ResourceDao
FIRST_VERSION, FIRST_VERSION_STRING -
Constructor Summary
ConstructorsConstructorDescriptionNamingSystemDaoJdbc(DataSource dataSource, DataSource permanentDeleteDataSource, ca.uhn.fhir.context.FhirContext fhirContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.hl7.fhir.r4.model.NamingSystemcopy(org.hl7.fhir.r4.model.NamingSystem resource) final org.hl7.fhir.r4.model.NamingSystemcreate(org.hl7.fhir.r4.model.NamingSystem resource) final SearchQuery<org.hl7.fhir.r4.model.NamingSystem>createSearchQuery(Identity identity, int page, int count) SearchQuery<org.hl7.fhir.r4.model.NamingSystem>createSearchQueryWithoutUserFilter(int page, int count) org.hl7.fhir.r4.model.NamingSystemcreateWithId(org.hl7.fhir.r4.model.NamingSystem resource, UUID uuid) org.hl7.fhir.r4.model.NamingSystemcreateWithTransactionAndId(Connection connection, org.hl7.fhir.r4.model.NamingSystem resource, UUID uuid) protected final booleandelete(Connection connection, UUID uuid) final booleanReturnsfalseif a matching resource was already marked as deletedvoiddeletePermanently(UUID uuid) Permanently delete a resource that was previously marked as deleted.voiddeletePermanentlyWithTransaction(Connection connection, UUID uuid) Permanently delete a resource that was previously marked as deleted.booleandeleteWithTransaction(Connection connection, UUID uuid) Returnsfalseif a matching resource was already marked as deletedbooleanexistsNotDeleted(String idString, String versionString) booleanexistsNotDeletedWithTransaction(Connection connection, String idString, String versionString) booleanexistsWithUniqueIdUriEntry(Connection connection, String uniqueIdValue) booleanexistsWithUniqueIdUriEntryResolvable(Connection connection, String uniqueIdValue) protected static <R extends org.hl7.fhir.r4.model.Resource>
SearchQueryParameterFactory<R>factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier) protected static <R extends org.hl7.fhir.r4.model.Resource>
SearchQueryParameterFactory<R>factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier, List<String> nameModifiers) protected static <R extends org.hl7.fhir.r4.model.Resource>
SearchQueryParameterFactory<R>factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier, List<String> nameModifiers, Supplier<SearchQueryIncludeParameter<R>> includeSupplier, List<String> includeParameterValues) protected static SearchQueryRevIncludeParameterFactoryfactory(Supplier<SearchQueryRevIncludeParameter> revIncludeSupplier, List<String> revIncludeParameterValues) protected DataSourceprotected final dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersiongetLatestVersion(UUID uuid, Connection connection) protected final dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersiongetLatestVersion(org.hl7.fhir.r4.model.NamingSystem resource, Connection connection) protected final Optional<dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersion>getLatestVersionIfExists(UUID uuid, Connection connection) protected dev.dsf.fhir.dao.jdbc.PreparedStatementFactory<org.hl7.fhir.r4.model.NamingSystem>protected org.hl7.fhir.r4.model.NamingSystemgetResource(ResultSet result, int index) protected Stringprotected Stringprotected StringClass<org.hl7.fhir.r4.model.NamingSystem>protected voidmodifySearchResultResource(org.hl7.fhir.r4.model.NamingSystem resource, Connection connection) Override this method to modify resources retrieved by search queries before returning to the user.final Optional<org.hl7.fhir.r4.model.NamingSystem>List<org.hl7.fhir.r4.model.NamingSystem>readAll()List<org.hl7.fhir.r4.model.NamingSystem>readAllWithTransaction(Connection connection) Optional<org.hl7.fhir.r4.model.NamingSystem>readByName(String name) Optional<org.hl7.fhir.r4.model.NamingSystem>readByNameWithTransaction(Connection connection, String name) Optional<org.hl7.fhir.r4.model.NamingSystem>readIncludingDeleted(UUID uuid) Optional<org.hl7.fhir.r4.model.NamingSystem>readIncludingDeletedWithTransaction(Connection connection, UUID uuid) final Optional<org.hl7.fhir.r4.model.NamingSystem>readVersion(UUID uuid, long version) Optional<org.hl7.fhir.r4.model.NamingSystem>readVersionWithTransaction(Connection connection, UUID uuid, long version) Optional<org.hl7.fhir.r4.model.NamingSystem>readWithTransaction(Connection connection, UUID uuid) final PartialResult<org.hl7.fhir.r4.model.NamingSystem>search(DbSearchQuery query) PartialResult<org.hl7.fhir.r4.model.NamingSystem>searchWithTransaction(Connection connection, DbSearchQuery query) protected final Longprotected final UUIDfinal org.hl7.fhir.r4.model.NamingSystemSets the version of the stored resource to latest version from DB plus 1.org.hl7.fhir.r4.model.NamingSystemupdateWithTransaction(Connection connection, org.hl7.fhir.r4.model.NamingSystem resource, Long expectedVersion) Sets the version of the stored resource to latest version from DB plus 1.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.dsf.fhir.dao.ResourceDao
create, createSearchQuery, createSearchQueryWithoutUserFilter, createWithId, createWithTransactionAndId, delete, deletePermanently, deletePermanentlyWithTransaction, deleteWithTransaction, existsNotDeleted, existsNotDeletedWithTransaction, getResourceType, getResourceTypeName, newReadWriteTransaction, read, readAll, readAllWithTransaction, readIncludingDeleted, readIncludingDeletedWithTransaction, readVersion, readVersionWithTransaction, readWithTransaction, search, searchWithTransaction, update, update, updateWithTransaction, updateWithTransaction
-
Constructor Details
-
NamingSystemDaoJdbc
public NamingSystemDaoJdbc(DataSource dataSource, DataSource permanentDeleteDataSource, ca.uhn.fhir.context.FhirContext fhirContext)
-
-
Method Details
-
copy
protected org.hl7.fhir.r4.model.NamingSystem copy(org.hl7.fhir.r4.model.NamingSystem resource) -
readByName
- Specified by:
readByNamein interfaceNamingSystemDao- Throws:
SQLException
-
readByNameWithTransaction
public Optional<org.hl7.fhir.r4.model.NamingSystem> readByNameWithTransaction(Connection connection, String name) throws SQLException - Specified by:
readByNameWithTransactionin interfaceNamingSystemDao- Throws:
SQLException
-
existsWithUniqueIdUriEntry
public boolean existsWithUniqueIdUriEntry(Connection connection, String uniqueIdValue) throws SQLException - Specified by:
existsWithUniqueIdUriEntryin interfaceNamingSystemDao- Throws:
SQLException
-
existsWithUniqueIdUriEntryResolvable
public boolean existsWithUniqueIdUriEntryResolvable(Connection connection, String uniqueIdValue) throws SQLException - Specified by:
existsWithUniqueIdUriEntryResolvablein interfaceNamingSystemDao- Throws:
SQLException
-
factory
protected static <R extends org.hl7.fhir.r4.model.Resource> SearchQueryParameterFactory<R> factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier) -
factory
protected static SearchQueryRevIncludeParameterFactory factory(Supplier<SearchQueryRevIncludeParameter> revIncludeSupplier, List<String> revIncludeParameterValues) -
factory
protected static <R extends org.hl7.fhir.r4.model.Resource> SearchQueryParameterFactory<R> factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier, List<String> nameModifiers, Supplier<SearchQueryIncludeParameter<R>> includeSupplier, List<String> includeParameterValues) -
factory
protected static <R extends org.hl7.fhir.r4.model.Resource> SearchQueryParameterFactory<R> factory(String parameterName, Supplier<SearchQueryParameter<R>> supplier, List<String> nameModifiers) -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getDataSource
-
getResourceTable
-
getResourceIdColumn
-
getResourceColumn
-
getPreparedStatementFactory
protected dev.dsf.fhir.dao.jdbc.PreparedStatementFactory<org.hl7.fhir.r4.model.NamingSystem> getPreparedStatementFactory() -
getResourceTypeName
- Specified by:
getResourceTypeNamein interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>
-
getResourceType
- Specified by:
getResourceTypein interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>
-
newReadWriteTransaction
- Specified by:
newReadWriteTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Throws:
SQLException
-
create
public final org.hl7.fhir.r4.model.NamingSystem create(org.hl7.fhir.r4.model.NamingSystem resource) throws SQLException - Specified by:
createin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
resource- notnull- Returns:
- the stored resource, not the same object as the given resource (defensive copy)
- Throws:
SQLException- if database access errors occur
-
createWithId
public org.hl7.fhir.r4.model.NamingSystem createWithId(org.hl7.fhir.r4.model.NamingSystem resource, UUID uuid) throws SQLException - Specified by:
createWithIdin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
resource- notnulluuid- notnull- Returns:
- the stored resource, not the same object as the given resource (defensive copy)
- Throws:
SQLException- if database access errors occur
-
createWithTransactionAndId
public org.hl7.fhir.r4.model.NamingSystem createWithTransactionAndId(Connection connection, org.hl7.fhir.r4.model.NamingSystem resource, UUID uuid) throws SQLException - Specified by:
createWithTransactionAndIdin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnull, notConnection.isReadOnly()resource- notnulluuid- notnull- Returns:
- the stored resource, not the same object as the given resource
- Throws:
SQLException- if database access errors occur
-
getResource
protected org.hl7.fhir.r4.model.NamingSystem getResource(ResultSet result, int index) throws SQLException - Throws:
SQLException
-
read
public final Optional<org.hl7.fhir.r4.model.NamingSystem> read(UUID uuid) throws SQLException, ResourceDeletedException - Specified by:
readin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
uuid- may benull- Returns:
Optional.empty()if the given uuid isnullor no resource could be found for the given uuid- Throws:
SQLException- if database access errors occurResourceDeletedException- if a resource with the given uuid could be found, but is marked as delete
-
readWithTransaction
public Optional<org.hl7.fhir.r4.model.NamingSystem> readWithTransaction(Connection connection, UUID uuid) throws SQLException, ResourceDeletedException - Specified by:
readWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnulluuid- may benull- Returns:
Optional.empty()if the given uuid isnullor no resource could be found for the given uuid- Throws:
SQLException- if database access errors occurResourceDeletedException- if a resource with the given uuid could be found, but is marked as delete
-
readVersion
public final Optional<org.hl7.fhir.r4.model.NamingSystem> readVersion(UUID uuid, long version) throws SQLException, ResourceDeletedException - Specified by:
readVersionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
uuid- may benullversion- may be less then 1- Returns:
Optional.empty()if the given uuid isnull, the given version is less then 1 or no resource could be found for the given uuid and version- Throws:
SQLException- if database access errors occurResourceDeletedException- if a resource with the given uuid and version could be found, but is the delete history entry
-
readVersionWithTransaction
public Optional<org.hl7.fhir.r4.model.NamingSystem> readVersionWithTransaction(Connection connection, UUID uuid, long version) throws SQLException, ResourceDeletedException - Specified by:
readVersionWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnulluuid- may benullversion- may be less then 1- Returns:
Optional.empty()if the given uuid isnull, the given version is less then 1 or no resource could be found for the given uuid and version- Throws:
SQLException- if database access errors occurResourceDeletedException- if a resource with the given uuid and version could be found, but is the delete history entry
-
readIncludingDeleted
public Optional<org.hl7.fhir.r4.model.NamingSystem> readIncludingDeleted(UUID uuid) throws SQLException - Specified by:
readIncludingDeletedin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
uuid- may benull- Returns:
Optional.empty()if the given uuid isnullor no resource could be found for the given uuid- Throws:
SQLException- if database access errors occur
-
readIncludingDeletedWithTransaction
public Optional<org.hl7.fhir.r4.model.NamingSystem> readIncludingDeletedWithTransaction(Connection connection, UUID uuid) throws SQLException - Specified by:
readIncludingDeletedWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnulluuid- may benull- Returns:
Optional.empty()if the given uuid isnullor no resource could be found for the given uuid- Throws:
SQLException- if database access errors occur
-
readAll
- Specified by:
readAllin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Throws:
SQLException
-
readAllWithTransaction
public List<org.hl7.fhir.r4.model.NamingSystem> readAllWithTransaction(Connection connection) throws SQLException - Specified by:
readAllWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnull- Returns:
Listcontaining matching resources- Throws:
SQLException- if database access errors occur
-
existsNotDeleted
- Specified by:
existsNotDeletedin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
idString- notnullversionString- may benull- Returns:
- if the given id is null
false; if the given version isnullor blank and a resource with the given id exists and is not marked as deletedtrue; if the given version is notnulland not blank and a resource with the given id and version exists and is not marked as deletedtrue - Throws:
SQLException- if database access errors occur- See Also:
-
existsNotDeletedWithTransaction
public boolean existsNotDeletedWithTransaction(Connection connection, String idString, String versionString) throws SQLException - Specified by:
existsNotDeletedWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnullidString- notnullversionString- may benull- Returns:
- if the given id is null
false; if the given version isnullor blank and a resource with the given id exists and is not marked as deletedtrue; if the given version is notnulland not blank and a resource with the given id and version exists and is not marked as deletedtrue - Throws:
SQLException- if database access errors occur- See Also:
-
update
public final org.hl7.fhir.r4.model.NamingSystem update(org.hl7.fhir.r4.model.NamingSystem resource, Long expectedVersion) throws SQLException, ResourceNotFoundException, ResourceVersionNoMatchException Description copied from interface:ResourceDaoSets the version of the stored resource to latest version from DB plus 1. If the given expectedVersion is notnull, checks if the given expectedVersion is the latest version in DB before storing the update. Resurrects all old versions (removes deleted flag) if the latest version in DB is marked as deleted.- Specified by:
updatein interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
resource- notnullexpectedVersion- may benull- Returns:
- the stored resource, not the same object as the given resource (defensive copy)
- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given resource could not be foundResourceVersionNoMatchException- if the given expectedVersion is notnulland the latest version does not match the given expectedVersion
-
updateWithTransaction
public org.hl7.fhir.r4.model.NamingSystem updateWithTransaction(Connection connection, org.hl7.fhir.r4.model.NamingSystem resource, Long expectedVersion) throws SQLException, ResourceNotFoundException, ResourceVersionNoMatchException Description copied from interface:ResourceDaoSets the version of the stored resource to latest version from DB plus 1. If the given expectedVersion is notnull, checks if the given expectedVersion is the latest version in DB before storing the update. Resurrects all old versions (removes deleted flag) if the latest version in DB is marked as deleted.- Specified by:
updateWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnull, notConnection.isReadOnly()and notConnection.getAutoCommit()andConnection.getTransactionIsolation()one ofConnection.TRANSACTION_REPEATABLE_READorConnection.TRANSACTION_SERIALIZABLEresource- notnullexpectedVersion- may benull- Returns:
- the stored resource, not the same object as the given resource (defensive copy)
- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given resource could not be foundResourceVersionNoMatchException- if the given expectedVersion is notnulland is not the latest version
-
toUuid
-
toLong
-
getLatestVersion
protected final dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersion getLatestVersion(org.hl7.fhir.r4.model.NamingSystem resource, Connection connection) throws SQLException, ResourceNotFoundException -
getLatestVersion
protected final dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersion getLatestVersion(UUID uuid, Connection connection) throws SQLException, ResourceNotFoundException -
getLatestVersionIfExists
protected final Optional<dev.dsf.fhir.dao.jdbc.AbstractResourceDaoJdbc.LatestVersion> getLatestVersionIfExists(UUID uuid, Connection connection) throws SQLException, ResourceNotFoundException -
delete
Description copied from interface:ResourceDaoReturnsfalseif a matching resource was already marked as deleted- Specified by:
deletein interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
uuid- may benull- Returns:
trueif a resource with the given uuid could be found and marked as deleted,falseif a resource with the given uuid was already marked as deleted- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given uuid isnullor no resource could be found with the given uuid
-
deleteWithTransaction
public boolean deleteWithTransaction(Connection connection, UUID uuid) throws SQLException, ResourceNotFoundException Description copied from interface:ResourceDaoReturnsfalseif a matching resource was already marked as deleted- Specified by:
deleteWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnull, notConnection.isReadOnly()uuid- may benull- Returns:
trueif a resource with the given uuid could be found and marked as deleted,falseif a resource with the given uuid was already marked as deleted- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given uuid isnullor no resource could be found with the given uuid
-
delete
protected final boolean delete(Connection connection, UUID uuid) throws SQLException, ResourceNotFoundException -
search
public final PartialResult<org.hl7.fhir.r4.model.NamingSystem> search(DbSearchQuery query) throws SQLException - Specified by:
searchin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
query- notnull- Returns:
PartialResultthat matched the search query- Throws:
SQLException- if database access errors occur
-
searchWithTransaction
public PartialResult<org.hl7.fhir.r4.model.NamingSystem> searchWithTransaction(Connection connection, DbSearchQuery query) throws SQLException - Specified by:
searchWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnullquery- notnull- Returns:
PartialResultthat matched the search query- Throws:
SQLException- if database access errors occur
-
modifySearchResultResource
protected void modifySearchResultResource(org.hl7.fhir.r4.model.NamingSystem resource, Connection connection) throws SQLException Override this method to modify resources retrieved by search queries before returning to the user. This method can be used, if the resource returned by the search is not complete and additional content needs to be retrieved. For example the content of aBinaryresource might not be stored in the json column.- Parameters:
resource- notnullconnection- notnull- Throws:
SQLException- if database access errors occur
-
createSearchQuery
public final SearchQuery<org.hl7.fhir.r4.model.NamingSystem> createSearchQuery(Identity identity, int page, int count) - Specified by:
createSearchQueryin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>
-
createSearchQueryWithoutUserFilter
public SearchQuery<org.hl7.fhir.r4.model.NamingSystem> createSearchQueryWithoutUserFilter(int page, int count) - Specified by:
createSearchQueryWithoutUserFilterin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>
-
deletePermanently
public void deletePermanently(UUID uuid) throws SQLException, ResourceNotFoundException, ResourceNotMarkedDeletedException Description copied from interface:ResourceDaoPermanently delete a resource that was previously marked as deleted.- Specified by:
deletePermanentlyin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
uuid- may benull- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given uuid isnullor no resource could be found with the given uuidResourceNotMarkedDeletedException- if the resource was not marked as deleted
-
deletePermanentlyWithTransaction
public void deletePermanentlyWithTransaction(Connection connection, UUID uuid) throws SQLException, ResourceNotFoundException, ResourceNotMarkedDeletedException Description copied from interface:ResourceDaoPermanently delete a resource that was previously marked as deleted.- Specified by:
deletePermanentlyWithTransactionin interfaceResourceDao<R extends org.hl7.fhir.r4.model.Resource>- Parameters:
connection- notnull, notConnection.isReadOnly()uuid- may benull- Throws:
SQLException- if database access errors occurResourceNotFoundException- if the given uuid isnullor no resource could be found with the given uuidResourceNotMarkedDeletedException- if the resource was not marked as deleted
-