Package com.ibm.fhir.persistence.payload
Interface FHIRPayloadPersistence
-
public interface FHIRPayloadPersistence
Used for storing and retrieving payload data. Implementations are expected to be locked to a particular tenant on instantiation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deletePayload(int resourceTypeId, String logicalId, int version)
Delete the payload item.<T extends Resource>
TreadResource(Class<T> resourceType, int resourceTypeId, String logicalId, int version, List<String> elements)
Retrieve the payload data for the given resourceTypeId, logicalId and version.<T extends Resource>
Future<T>readResource(Class<T> resourceType, PayloadKey payloadKey)
Fetch the resource directly using the payload key.Future<PayloadKey>
storePayload(String resourceTypeName, int resourceTypeId, String logicalId, int version, Resource resource)
Store the payload.
-
-
-
Method Detail
-
storePayload
Future<PayloadKey> storePayload(String resourceTypeName, int resourceTypeId, String logicalId, int version, Resource resource) throws FHIRPersistenceException
Store the payload. The business key is the tuple {resourceTypeId, logicalId, version} This data is stored directly, and should ideally be compressed.- Parameters:
resourceTypeName
- the type name of the resourceresourceTypeId
- the database id assigned to this resource typelogicalId
- the logical id of the resourceversion
- the version of the resourceresource
- the resource to store- Returns:
- a
Future
holding the payload key and status. - Throws:
FHIRPersistenceException
-
readResource
<T extends Resource> T readResource(Class<T> resourceType, int resourceTypeId, String logicalId, int version, List<String> elements) throws FHIRPersistenceException
Retrieve the payload data for the given resourceTypeId, logicalId and version. Synchronous.- Parameters:
resourceType
- the expected resource type classresourceTypeId
- the unique int idenfifier for the resource typelogicalId
- the logical identifier of the desired resourceversion
- the specific version of the desired resourceelements
- to filter elements within the resource - can be null- Returns:
- the fhirResourcePayload exactly as it was provided to
#storePayload(String, int, String, int, byte[])
- Throws:
FHIRPersistenceException
-
readResource
<T extends Resource> Future<T> readResource(Class<T> resourceType, PayloadKey payloadKey) throws FHIRPersistenceException
Fetch the resource directly using the payload key. This is faster thanreadResource(Class, int, String, int, List)
because the payload persistence implementation can use thePayloadKey
to directly address the location where the payload is stored. Allows async implementations.- Type Parameters:
T
-- Parameters:
resourceType
-payloadKey
-- Returns:
- a Future that will hold the resource after it has been read
- Throws:
FHIRPersistenceException
-
deletePayload
void deletePayload(int resourceTypeId, String logicalId, int version) throws FHIRPersistenceException
Delete the payload item. This may be called to clean up after a failed transaction- Parameters:
resourceTypeId
-logicalId
-version
-- Throws:
FHIRPersistenceException
-
-