Class FHIRPersistenceJDBCImpl
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.jdbc.impl.FHIRPersistenceJDBCImpl
-
- All Implemented Interfaces:
FHIRPersistence
,IFHIRTransactionAdapterCallback
,SchemaNameSupplier
public class FHIRPersistenceJDBCImpl extends java.lang.Object implements FHIRPersistence, SchemaNameSupplier, IFHIRTransactionAdapterCallback
The JDBC implementation of the FHIRPersistence interface, providing implementations for CRUD APIs and search.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TRX_SYNCH_REG_JNDI_NAME
protected static java.lang.String
TXN_JNDI_NAME
protected java.lang.Boolean
updateCreateEnabled
protected javax.transaction.UserTransaction
userTransaction
-
Constructor Summary
Constructors Constructor Description FHIRPersistenceJDBCImpl(java.util.Properties configProps, IConnectionProvider cp, FHIRConfigProvider configProvider, FHIRPersistenceJDBCCache cache, SearchHelper searchHelper)
Constructor for use when running standalone, outside of any web container.FHIRPersistenceJDBCImpl(java.util.Properties configProps, IConnectionProvider cp, FHIRPersistenceJDBCCache cache)
Constructor for use when running standalone, outside of any web container.FHIRPersistenceJDBCImpl(FHIRPersistenceJDBCCache cache, FHIRPayloadPersistence payloadPersistence, SearchHelper searchHelper)
Constructor for use when running as web application in WLP.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCanonicalCompositeParam(java.util.List<ExtractedParameterValue> allParameters)
Augment the given allParameters list with internal parameters that represent the relationship between the url and version parameters.protected void
addCompartmentParams(java.util.List<ExtractedParameterValue> allParameters, java.lang.String resourceType, java.lang.String resourceId)
Augment the given allParameters list with internal parameters that represent the relationship between the fhirResource and its compartments.void
beforeCommit()
Callback invoked just before the current transaction commitsprotected Action
buildActionChain()
Build a chain of actions we want to apply to new connections.protected java.util.List<Resource>
buildSortedResourceDTOList(ResourceDAO resourceDao, java.lang.Class<? extends Resource> resourceType, java.util.List<java.lang.Long> sortedIdList, boolean includeResourceData)
This method takes the passed list of sorted Resource ids, acquires the ResourceDTO corresponding to each id, and returns those ResourceDTOs in a List, sorted according to the input sorted ids.java.util.List<ResourceChangeLogRecord>
changes(FHIRPersistenceContext context, int resourceCount, java.time.Instant sinceLastModified, java.time.Instant beforeLastModified, java.lang.Long changeIdMarker, java.util.List<java.lang.String> resourceTypeNames, boolean excludeTransactionTimeoutWindow, HistorySortOrder historySortOrder)
Fetch up to resourceCount records from the RESOURCE_CHANGE_LOG table.protected <T extends Resource>
java.util.List<T>convertResourceDTOList(java.util.List<Resource> resourceDTOList, java.lang.Class<T> resourceType)
Converts the passed Resource Data Transfer Object collection to a collection of FHIR Resource objects.protected java.util.List<ResourceResult<? extends Resource>>
convertResourceDTOList(ResourceDAO resourceDao, java.util.List<Resource> resourceDTOList, java.lang.Class<? extends Resource> resourceType, java.util.List<java.lang.String> elements, boolean includeResourceData)
Converts the passed Resource Data Transfer Object collection to a collection of FHIR Resource objects.<T extends Resource>
SingleResourceResult<T>create(FHIRPersistenceContext context, T updatedResource)
Stores a new FHIR Resource in the datastore.<T extends Resource>
voiddelete(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId, int versionId, Instant lastUpdated)
Deletes the FHIR resource from the datastore.void
doCachePrefill(FHIRPersistenceContext context, java.sql.Connection connection)
Prefill the cachesResourceEraseRecord
erase(FHIRPersistenceContext context, EraseDTO eraseDto)
Erases part or a whole of a resource in the data layer.ResourcePayload
fetchResourcePayloads(java.lang.Class<? extends Resource> resourceType, java.time.Instant fromLastModified, java.time.Instant toLastModified, java.util.function.Function<ResourcePayload,java.lang.Boolean> processor)
Special function for high speed export of resource payloads.java.lang.String
generateResourceId()
Generates a resource ID.OperationOutcome
getHealth()
Returns an OperationOutcome indicating the current status of the persistence store / backend.java.lang.String
getSchemaForRequestContext(java.sql.Connection connection)
Get the schema name for the current request contextFHIRPersistenceTransaction
getTransaction()
Returns a FHIRPersistenceTransaction object associated with the persistence layer implementation in use.MultiResourceResult
history(FHIRPersistenceContext context, java.lang.Class<? extends Resource> resourceType, java.lang.String logicalId)
Retrieves all of the versions of the specified FHIR Resource.boolean
isDeleteSupported()
Returns true iff the persistence layer implementation supports the "delete" operation.boolean
isOffloadingSupported()
Returns true iff the persistence layer implementation supports offloading and this has been configured for the tenant/datasource.boolean
isReindexSupported()
Returns true iff the persistence layer implementation supports the "reindex" special operation.boolean
isTransactional()
Returns true iff the persistence layer implementation supports transactions.boolean
isUpdateCreateEnabled()
Returns true iff the persistence layer implementation supports update/create and it has been configured in the persistence config.void
onCommit(java.util.Collection<ResourceTokenValueRec> records, java.util.Collection<ResourceReferenceValueRec> referenceRecords, java.util.Collection<ResourceProfileRec> profileRecs, java.util.Collection<ResourceTokenValueRec> tagRecs, java.util.Collection<ResourceTokenValueRec> securityRecs)
Called just prior to commit so that we can persist all the token value records that have been accumulated during the transaction.<T extends Resource>
SingleResourceResult<T>read(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId)
Retrieves the most recent version of a FHIR Resource from the datastore.java.util.List<Resource>
readResourcesForRecords(java.util.List<ResourceChangeLogRecord> records)
Read the resources for each of the change log records in the list, aligning the entries in the returned list to match the entries in the records list.int
reindex(FHIRPersistenceContext context, OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds, java.lang.String resourceLogicalId, boolean force)
Initiates reindexing for either a specified list of index IDs, or a randomly chosen resource.java.util.List<java.lang.Long>
retrieveIndex(FHIRPersistenceContext context, int count, java.time.Instant notModifiedAfter, java.lang.Long afterIndexId, java.lang.String resourceTypeName)
Retrieves a list of index IDs available for reindexing.protected javax.transaction.UserTransaction
retrieveUserTransaction(java.lang.String jndiName)
Retrieves (via a JNDI lookup) a reference to the UserTransaction.MultiResourceResult
search(FHIRPersistenceContext context, java.lang.Class<? extends Resource> resourceType)
Search query implementation based on the 1385 new query builder.PayloadPersistenceResponse
storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey)
Offload payload storage to another provider.<T extends Resource>
SingleResourceResult<T>update(FHIRPersistenceContext context, T resource)
Updates an existing FHIR Resource by storing a new version in the datastore.<T extends Resource>
voidupdateParameters(ResourceIndexRecord rir, java.lang.Class<T> resourceTypeClass, Resource existingResourceDTO, ReindexResourceDAO reindexDAO, OperationOutcome.Builder operationOutcomeResult, boolean force)
Update the parameters for the resource described by the given DTO<T extends Resource>
SingleResourceResult<T>vread(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId, java.lang.String versionId)
Retrieves a specific version of a FHIR Resource from the datastore.-
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.FHIRPersistence
isChangesSupported
-
-
-
-
Field Detail
-
TXN_JNDI_NAME
protected static final java.lang.String TXN_JNDI_NAME
- See Also:
- Constant Field Values
-
TRX_SYNCH_REG_JNDI_NAME
public static final java.lang.String TRX_SYNCH_REG_JNDI_NAME
- See Also:
- Constant Field Values
-
userTransaction
protected javax.transaction.UserTransaction userTransaction
-
updateCreateEnabled
protected java.lang.Boolean updateCreateEnabled
-
-
Constructor Detail
-
FHIRPersistenceJDBCImpl
public FHIRPersistenceJDBCImpl(FHIRPersistenceJDBCCache cache, FHIRPayloadPersistence payloadPersistence, SearchHelper searchHelper) throws java.lang.Exception
Constructor for use when running as web application in WLP.- Throws:
java.lang.Exception
-
FHIRPersistenceJDBCImpl
public FHIRPersistenceJDBCImpl(java.util.Properties configProps, IConnectionProvider cp, FHIRPersistenceJDBCCache cache) throws java.lang.Exception
Constructor for use when running standalone, outside of any web container. The IConnectionProvider should be a pooling implementation which supports an ITransactionProvider. Uses the default adapter for reading FHIR configurations and a new SearchHelper instance, which works OK for unit-tests.- Parameters:
configProps
-cp
-cache
-- Throws:
java.lang.Exception
-
FHIRPersistenceJDBCImpl
public FHIRPersistenceJDBCImpl(java.util.Properties configProps, IConnectionProvider cp, FHIRConfigProvider configProvider, FHIRPersistenceJDBCCache cache, SearchHelper searchHelper) throws java.lang.Exception
Constructor for use when running standalone, outside of any web container. The IConnectionProvider should be a pooling implementation which supports an ITransactionProvider.- Parameters:
configProps
-cp
-configProvider
- adapter to provide access to FHIR configurationcache
-searchHelper
-- Throws:
java.lang.Exception
-
-
Method Detail
-
buildActionChain
protected Action buildActionChain()
Build a chain of actions we want to apply to new connections. Current the only action we need is setting the tenant if we're in multi-tenant mode.- Returns:
- the chain of actions to be applied
-
create
public <T extends Resource> SingleResourceResult<T> create(FHIRPersistenceContext context, T updatedResource) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Stores a new FHIR Resource in the datastore. The resource is not modified before it is stored. It must therefore already include correct Meta fields.- Specified by:
create
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestupdatedResource
- the FHIR Resource instance to be created in the datastore- Returns:
- a SingleResourceResult with a ResourceResult that holds the unmodified resource and/or an OperationOutcome with hints, warnings, or errors related to the interaction
- Throws:
FHIRPersistenceException
-
update
public <T extends Resource> SingleResourceResult<T> update(FHIRPersistenceContext context, T resource) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Updates an existing FHIR Resource by storing a new version in the datastore. This new method expects the resource being passed in to already be modified with correct meta and id information. It no longer updates the meta itself.- Specified by:
update
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestresource
- the new contents of the FHIR Resource to be stored- Returns:
- a SingleResourceResult with a ResourceResult that holds a copy of the input resource and/or an OperationOutcome with hints, warnings, or errors related to the interaction
- Throws:
FHIRPersistenceException
-
search
public MultiResourceResult search(FHIRPersistenceContext context, java.lang.Class<? extends Resource> resourceType) throws FHIRPersistenceException
Search query implementation based on the 1385 new query builder.- Specified by:
search
in interfaceFHIRPersistence
- Parameters:
context
-resourceType
-- Returns:
- Throws:
FHIRPersistenceException
-
delete
public <T extends Resource> void delete(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId, int versionId, Instant lastUpdated) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Deletes the FHIR resource from the datastore. The delete is a soft-delete, resulting in a new version being created to act as a deletion marker. This version is created without a payload body. The versionId must match the latest version of the resource. This must be checked by theFHIRPersistence
implementation, which should throw a FHIRPersistenceVersionIdMismatchException is there is a mismatch (likely an indication of concurrent changes to the resource).- Specified by:
delete
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestresourceType
- the resource type of the Resource instance to be deletedlogicalId
- the logical id of the Resource instance to be deletedversionId
- the current version of the Resource instance to be deletedlastUpdated
- the modification timestamp to use for the deletion- Throws:
FHIRPersistenceException
-
read
public <T extends Resource> SingleResourceResult<T> read(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Retrieves the most recent version of a FHIR Resource from the datastore.- Specified by:
read
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestresourceType
- the resource type of the Resource instance to be retrievedlogicalId
- the logical id of the Resource instance to be retrieved- Returns:
- a SingleResourceResult with a ResourceResult populated from from the datastore and/or an OperationOutcome with hints, warnings, or errors related to the interaction
- Throws:
FHIRPersistenceException
-
history
public MultiResourceResult history(FHIRPersistenceContext context, java.lang.Class<? extends Resource> resourceType, java.lang.String logicalId) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Retrieves all of the versions of the specified FHIR Resource.- Specified by:
history
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestresourceType
- the resource type of the Resource instances to be retrievedlogicalId
- the logical id of the Resource instances to be retrieved- Returns:
- a MultiResourceResult with a list containing the available versions of the specified FHIR Resource and/or an OperationOutcome with hints, warnings, or errors related to the interaction
- Throws:
FHIRPersistenceException
-
vread
public <T extends Resource> SingleResourceResult<T> vread(FHIRPersistenceContext context, java.lang.Class<T> resourceType, java.lang.String logicalId, java.lang.String versionId) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Retrieves a specific version of a FHIR Resource from the datastore.- Specified by:
vread
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current requestresourceType
- the resource type of the Resource instance to be retrievedlogicalId
- the logical id of the Resource instance to be retrievedversionId
- the version of the Resource instance to be retrieved- Returns:
- a SingleResourceResult with a ResourceResult populated from the datastore and/or an OperationOutcome with hints, warnings, or errors related to the interaction
- Throws:
FHIRPersistenceResourceDeletedException
- if the resource being read is currently in a deleted state and FHIRPersistenceContext.includeDeleted() is set to falseFHIRPersistenceException
-
buildSortedResourceDTOList
protected java.util.List<Resource> buildSortedResourceDTOList(ResourceDAO resourceDao, java.lang.Class<? extends Resource> resourceType, java.util.List<java.lang.Long> sortedIdList, boolean includeResourceData) throws FHIRException, FHIRPersistenceException, java.io.IOException
This method takes the passed list of sorted Resource ids, acquires the ResourceDTO corresponding to each id, and returns those ResourceDTOs in a List, sorted according to the input sorted ids.- Parameters:
resourceDao
- - The resource DAO.resourceType
- - The type of Resource that each id in the passed list represents.sortedIdList
- - A list of Resource ids representing the proper sort order for the list of Resources to be returned.includeResourceData
- include the resource DATA value- Returns:
- List
- A list of ResourcesDTOs of the passed resourceType, sorted according the order of ids in the passed sortedIdList. - Throws:
FHIRPersistenceException
java.io.IOException
FHIRException
-
convertResourceDTOList
protected java.util.List<ResourceResult<? extends Resource>> convertResourceDTOList(ResourceDAO resourceDao, java.util.List<Resource> resourceDTOList, java.lang.Class<? extends Resource> resourceType, java.util.List<java.lang.String> elements, boolean includeResourceData) throws FHIRException, java.io.IOException
Converts the passed Resource Data Transfer Object collection to a collection of FHIR Resource objects. Note that if the resource has been erased or was not fetched on purpose, ResourceResult.resource will be null and the caller will need to take this into account- Parameters:
resourceDao
-resourceDTOList
-resourceType
-elements
-includeResourceData
-- Returns:
- Throws:
FHIRException
java.io.IOException
-
addCompartmentParams
protected void addCompartmentParams(java.util.List<ExtractedParameterValue> allParameters, java.lang.String resourceType, java.lang.String resourceId)
Augment the given allParameters list with internal parameters that represent the relationship between the fhirResource and its compartments. These parameter values are subsequently used to improve the performance of compartment-based FHIR search queries. SeeCompartmentHelper.makeCompartmentParamName(String)
for details on how the parameter name is composed for each relationship.- Parameters:
allParameters
-resourceType
- the resource type of the resource we are extracting parameter values fromresourceId
- the resource id of the resource we are extracting parameter values from
-
addCanonicalCompositeParam
protected void addCanonicalCompositeParam(java.util.List<ExtractedParameterValue> allParameters) throws FHIRSearchException
Augment the given allParameters list with internal parameters that represent the relationship between the url and version parameters. These parameter values are subsequently used in canonical reference searches. SeeCompartmentHelper.makeCompartmentParamName(String)
for details on how the parameter name is composed.- Parameters:
allParameters
-- Throws:
FHIRSearchException
-
getHealth
public OperationOutcome getHealth() throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Returns an OperationOutcome indicating the current status of the persistence store / backend.- Specified by:
getHealth
in interfaceFHIRPersistence
- Returns:
- An OperationOutcome with a list of 0 or more OperationalOutcomeIssue indicating the status of the underlying datastore
- Throws:
FHIRPersistenceException
-
retrieveUserTransaction
protected javax.transaction.UserTransaction retrieveUserTransaction(java.lang.String jndiName)
Retrieves (via a JNDI lookup) a reference to the UserTransaction. If the JNDI lookup fails, we'll assume that we're not running inside the container.
-
convertResourceDTOList
protected <T extends Resource> java.util.List<T> convertResourceDTOList(java.util.List<Resource> resourceDTOList, java.lang.Class<T> resourceType) throws FHIRException, java.io.IOException
Converts the passed Resource Data Transfer Object collection to a collection of FHIR Resource objects.- Parameters:
resourceDTOList
-resourceType
-- Returns:
- Throws:
FHIRException
java.io.IOException
-
isTransactional
public boolean isTransactional()
Description copied from interface:FHIRPersistence
Returns true iff the persistence layer implementation supports transactions.- Specified by:
isTransactional
in interfaceFHIRPersistence
-
getTransaction
public FHIRPersistenceTransaction getTransaction()
Description copied from interface:FHIRPersistence
Returns a FHIRPersistenceTransaction object associated with the persistence layer implementation in use. This can then be used to control transactional boundaries.- Specified by:
getTransaction
in interfaceFHIRPersistence
- Returns:
-
isDeleteSupported
public boolean isDeleteSupported()
Description copied from interface:FHIRPersistence
Returns true iff the persistence layer implementation supports the "delete" operation.- Specified by:
isDeleteSupported
in interfaceFHIRPersistence
- Returns:
-
getSchemaForRequestContext
public java.lang.String getSchemaForRequestContext(java.sql.Connection connection) throws FHIRPersistenceDBConnectException
Description copied from interface:SchemaNameSupplier
Get the schema name for the current request context- Specified by:
getSchemaForRequestContext
in interfaceSchemaNameSupplier
- Parameters:
connection
- the connection for which we want to obtain the schema name- Returns:
- the main schema name to use for the given connection
- Throws:
FHIRPersistenceDBConnectException
-
doCachePrefill
public void doCachePrefill(FHIRPersistenceContext context, java.sql.Connection connection) throws FHIRPersistenceException
Prefill the caches- Throws:
FHIRPersistenceException
-
isReindexSupported
public boolean isReindexSupported()
Description copied from interface:FHIRPersistence
Returns true iff the persistence layer implementation supports the "reindex" special operation.- Specified by:
isReindexSupported
in interfaceFHIRPersistence
- Returns:
-
isOffloadingSupported
public boolean isOffloadingSupported()
Description copied from interface:FHIRPersistence
Returns true iff the persistence layer implementation supports offloading and this has been configured for the tenant/datasource.- Specified by:
isOffloadingSupported
in interfaceFHIRPersistence
- Returns:
-
reindex
public int reindex(FHIRPersistenceContext context, OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds, java.lang.String resourceLogicalId, boolean force) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Initiates reindexing for either a specified list of index IDs, or a randomly chosen resource. The number of resources processed is returned. This can be used by a controller to continue processing until everything is complete.- Specified by:
reindex
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext instance associated with the current request.operationOutcomeResult
- accumulate issues in thisOperationOutcome.Builder
tstamp
- only reindex resources with a reindex_tstamp less than thisindexIds
- list of index IDs of resources to reindex, or nullresourceLogicalId
- resourceType/logicalId value of a specific resource to reindex, or null; this parameter is ignored if the indexIds parameter value is non-nullforce
- if true, always replace the stored parameters- Returns:
- count of the number of resources reindexed by this call
- Throws:
FHIRPersistenceException
-
updateParameters
public <T extends Resource> void updateParameters(ResourceIndexRecord rir, java.lang.Class<T> resourceTypeClass, Resource existingResourceDTO, ReindexResourceDAO reindexDAO, OperationOutcome.Builder operationOutcomeResult, boolean force) throws java.lang.Exception
Update the parameters for the resource described by the given DTO- Type Parameters:
T
-- Parameters:
rir
- the resource index recordresourceTypeClass
- the resource type classexistingResourceDTO
- the existing resource DTOreindexDAO
- the reindex resource DAOoperationOutcomeResult
- the operation outcome resultforce
-- Throws:
java.lang.Exception
-
generateResourceId
public java.lang.String generateResourceId()
Description copied from interface:FHIRPersistence
Generates a resource ID.- Specified by:
generateResourceId
in interfaceFHIRPersistence
- Returns:
- resource ID
-
beforeCommit
public void beforeCommit() throws FHIRPersistenceException
Description copied from interface:IFHIRTransactionAdapterCallback
Callback invoked just before the current transaction commits- Specified by:
beforeCommit
in interfaceIFHIRTransactionAdapterCallback
- Throws:
FHIRPersistenceException
-
onCommit
public void onCommit(java.util.Collection<ResourceTokenValueRec> records, java.util.Collection<ResourceReferenceValueRec> referenceRecords, java.util.Collection<ResourceProfileRec> profileRecs, java.util.Collection<ResourceTokenValueRec> tagRecs, java.util.Collection<ResourceTokenValueRec> securityRecs) throws FHIRPersistenceException
Called just prior to commit so that we can persist all the token value records that have been accumulated during the transaction. This collection therefore contains multiple resource types, which have to be processed separately.- Parameters:
records
-referenceRecords
-profileRecs
-tagRecs
-securityRecs
-- Throws:
FHIRPersistenceException
-
fetchResourcePayloads
public ResourcePayload fetchResourcePayloads(java.lang.Class<? extends Resource> resourceType, java.time.Instant fromLastModified, java.time.Instant toLastModified, java.util.function.Function<ResourcePayload,java.lang.Boolean> processor) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Special function for high speed export of resource payloads. The process function must process the InputStream before returning. Result processing will be stopped if the process function returns Boolean FALSE.- Specified by:
fetchResourcePayloads
in interfaceFHIRPersistence
- Parameters:
resourceType
- the resource type which is the target of the searchfromLastModified
- start reading from this timestamptoLastModified
- do not read beyond this timestampprocessor
- function to process each payload record- Returns:
- the last ResourcePayload processed, or null if no data was found
- Throws:
FHIRPersistenceException
-
changes
public java.util.List<ResourceChangeLogRecord> changes(FHIRPersistenceContext context, int resourceCount, java.time.Instant sinceLastModified, java.time.Instant beforeLastModified, java.lang.Long changeIdMarker, java.util.List<java.lang.String> resourceTypeNames, boolean excludeTransactionTimeoutWindow, HistorySortOrder historySortOrder) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Fetch up to resourceCount records from the RESOURCE_CHANGE_LOG table.- Specified by:
changes
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext associated with the current requestresourceCount
- the max number of resource change records to fetchsinceLastModified
- filter records with record.lastUpdate >= sinceLastModified. Optional.beforeLastModified
- filter records with record.lastUpdate <= beforeLastModified. Optional.resourceTypeNames
- filter records matching any resource type name in the listexcludeTransactionTimeoutWindow
- flag to exclude resources falling inside server's tx timeout windowhistorySortOrder
- the type of sorting to apply- Returns:
- a list containing up to resourceCount elements describing resources which have changed
- Throws:
FHIRPersistenceException
-
erase
public ResourceEraseRecord erase(FHIRPersistenceContext context, EraseDTO eraseDto) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Erases part or a whole of a resource in the data layer.- Specified by:
erase
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext associated with this requesteraseDto
- the details of the user input- Returns:
- a record indicating the success or partial success of the erase
- Throws:
FHIRPersistenceException
-
retrieveIndex
public java.util.List<java.lang.Long> retrieveIndex(FHIRPersistenceContext context, int count, java.time.Instant notModifiedAfter, java.lang.Long afterIndexId, java.lang.String resourceTypeName) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Retrieves a list of index IDs available for reindexing.- Specified by:
retrieveIndex
in interfaceFHIRPersistence
- Parameters:
context
- the FHIRPersistenceContext associated with this requestcount
- the maximum nuber of index IDs to retrievenotModifiedAfter
- only retrieve index IDs for resources not last updated after the specified timestampafterIndexId
- retrieve index IDs starting after this specified index ID, or null to start with first index IDresourceTypeName
- the resource type of index IDs to return, or null- Returns:
- list of index IDs available for reindexing
- Throws:
FHIRPersistenceException
-
isUpdateCreateEnabled
public boolean isUpdateCreateEnabled()
Description copied from interface:FHIRPersistence
Returns true iff the persistence layer implementation supports update/create and it has been configured in the persistence config.- Specified by:
isUpdateCreateEnabled
in interfaceFHIRPersistence
- Returns:
-
storePayload
public PayloadPersistenceResponse storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Offload payload storage to another provider. If result is not null, the returnedFuture
can be used to obtain the status of the operation. If the result is null, then the implementation does not support offloading and the payload must be stored in the traditional manner (e.g. in the RDBMS). AFuture
is used because the offloading storage operation may be asynchronous. This Future must be resolved prior to the transaction commit.- Specified by:
storePayload
in interfaceFHIRPersistence
- Returns:
- Throws:
FHIRPersistenceException
-
readResourcesForRecords
public java.util.List<Resource> readResourcesForRecords(java.util.List<ResourceChangeLogRecord> records) throws FHIRPersistenceException
Description copied from interface:FHIRPersistence
Read the resources for each of the change log records in the list, aligning the entries in the returned list to match the entries in the records list.- Specified by:
readResourcesForRecords
in interfaceFHIRPersistence
- Returns:
- a list of Resources with the same number of entries as the given records list
- Throws:
FHIRPersistenceException
-
-