Package com.ibm.fhir.server.util
Class FHIRRestHelper
- java.lang.Object
-
- com.ibm.fhir.server.util.FHIRRestHelper
-
- All Implemented Interfaces:
FHIRResourceHelpers
public class FHIRRestHelper extends java.lang.Object implements FHIRResourceHelpers
Helper methods for performing the "heavy lifting" with respect to implementing FHIR interactions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.ibm.fhir.server.spi.operation.FHIRResourceHelpers
FHIRResourceHelpers.Interaction
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.format.DateTimeFormatter
PARSER_FORMATTER
-
Fields inherited from interface com.ibm.fhir.server.spi.operation.FHIRResourceHelpers
DO_VALIDATION, IF_NOT_MATCH_NULL, SKIPPABLE_UPDATE
-
-
Constructor Summary
Constructors Constructor Description FHIRRestHelper(FHIRPersistence persistence, SearchHelper searchHelper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>
buildPersistenceEventProperties(java.lang.String type, java.lang.String id, java.lang.String version, FHIRSearchContext searchContext, FHIRSystemHistoryContext systemHistoryContext)
Builds a collection of properties that will be passed to the persistence interceptors.(package private) Bundle
createSearchResponseBundle(java.util.List<ResourceResult<? extends Resource>> resourceResults, FHIRSearchContext searchContext, java.lang.String type)
Creates a bundle that will hold results for a search operation.Bundle
doBundle(Bundle inputBundle, boolean skippableUpdates)
Processes a bundled request (batch or transaction type).FHIRRestOperationResponse
doCreate(java.lang.String type, Resource resource, java.lang.String ifNoneExist, boolean doValidation)
Performs the heavy lifting associated with a 'create' interaction.FHIRRestOperationResponse
doCreateMeta(FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, java.lang.String type, Resource resource, java.lang.String ifNoneExist)
1st phase of CREATE.FHIRRestOperationResponse
doCreatePersist(FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, Resource resource, PayloadPersistenceResponse offloadResponse)
3rd phase of resource create.FHIRRestOperationResponse
doDelete(java.lang.String type, java.lang.String id, java.lang.String searchQueryString)
Performs a 'delete' operation on the specified resource.ResourceEraseRecord
doErase(FHIROperationContext operationContext, EraseDTO eraseDto)
Invoke the FHIR Persistence erase operation for a specific instance of the erase.Bundle
doHistory(java.lang.String type, java.lang.String id, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri)
Performs the work of retrieving versions of a Resource.Bundle
doHistory(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, java.lang.String resourceType)
Implement the system level history operation to obtain a list of changes to resources with an optional resourceType which supports for example [base]/Patient/_history requests to return the complete history of changes filtered to a specific resource type.Resource
doInvoke(FHIROperationContext operationContext, java.lang.String resourceTypeName, java.lang.String logicalId, java.lang.String versionId, Resource resource, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters)
Helper method which invokes a custom operation.FHIRRestOperationResponse
doPatch(java.lang.String type, java.lang.String id, FHIRPatch patch, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate)
Performs a patch operation (a new version of the Resource will be stored).FHIRRestOperationResponse
doPatchOrUpdatePersist(FHIRPersistenceEvent event, java.lang.String type, java.lang.String id, boolean isPatch, Resource newResource, Resource prevResource, java.util.List<OperationOutcome.Issue> warnings, boolean isDeleted, java.lang.Integer ifNoneMatch, PayloadPersistenceResponse offloadResponse)
Persist the newResource value for patch or update interactionsSingleResourceResult<? extends Resource>
doRead(java.lang.String type, java.lang.String id, boolean throwExcOnNull, boolean includeDeleted, Resource contextResource)
Performs a 'read' operation to retrieve a Resource.SingleResourceResult<? extends Resource>
doRead(java.lang.String type, java.lang.String id, boolean throwExcOnNull, boolean includeDeleted, Resource contextResource, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters)
Performs a 'read' operation to retrieve a Resource with select query parameters.int
doReindex(FHIROperationContext operationContext, OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds, java.lang.String resourceLogicalId)
Invoke the FHIR persistence reindex operation for either a specified list of indexIds, or a randomly chosen resource, last reindexed before the given timestamp.int
doReindexList(OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds)
encapsulates the logic to process a list with graduated backoff through the full list of indexIdsint
doReindexSingle(OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.lang.String resourceLogicalId)
do a single reindex on a specific resourceLogicalIdjava.util.List<java.lang.Long>
doRetrieveIndex(FHIROperationContext operationContext, java.lang.String resourceTypeName, int count, java.time.Instant notModifiedAfter, java.lang.Long afterIndexId)
Invoke the FHIR persistence retrieve index operation to retrieve a list of indexIds available for reindexing.Bundle
doSearch(java.lang.String type, java.lang.String compartment, java.lang.String compartmentId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, Resource contextResource)
Performs heavy lifting associated with a 'search' operation.Bundle
doSearch(java.lang.String type, java.lang.String compartment, java.lang.String compartmentId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, Resource contextResource, boolean checkInteractionAllowed, boolean alwaysIncludeResources)
Performs heavy lifting associated with a 'search' operation.FHIRRestOperationResponse
doUpdate(java.lang.String type, java.lang.String id, Resource newResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, boolean doValidation, java.lang.Integer ifNoneMatch)
Performs an update operation (a new version of the Resource will be stored).FHIRRestOperationResponse
doUpdateMeta(FHIRPersistenceEvent event, java.lang.String type, java.lang.String id, FHIRPatch patch, Resource newResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, boolean doValidation, java.util.List<OperationOutcome.Issue> warnings)
1st phase of update interaction.Resource
doVRead(java.lang.String type, java.lang.String id, java.lang.String versionId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters)
Performs a 'vread' operation by retrieving the specified version of a Resource.java.lang.String
generateResourceId()
Generate a new resource id.protected Instant
getCurrentInstant()
Get the current time which can be used for the lastUpdated fieldstatic java.lang.String
getRequestBaseUri(java.lang.String type)
This method returns the "base URI" associated with the current request.FHIRPersistenceTransaction
getTransaction()
PayloadPersistenceResponse
storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey)
If the underlying persistence layer supports offloading payload storage, initiate the request here.void
updateOperationContext(FHIROperationContext operationContext, java.lang.String method)
common update to the operationContextvoid
validateInteraction(FHIRResourceHelpers.Interaction interaction, java.lang.String resourceType)
Validate an interaction for a specified resource type.java.util.List<OperationOutcome.Issue>
validateResource(Resource resource)
Validate a resource.-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.fhir.server.spi.operation.FHIRResourceHelpers
doCreate, doHistory, doUpdate, doVRead
-
-
-
-
Constructor Detail
-
FHIRRestHelper
public FHIRRestHelper(FHIRPersistence persistence, SearchHelper searchHelper)
-
-
Method Detail
-
doCreate
public FHIRRestOperationResponse doCreate(java.lang.String type, Resource resource, java.lang.String ifNoneExist, boolean doValidation) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs the heavy lifting associated with a 'create' interaction.- Specified by:
doCreate
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type specified as part of the request URLresource
- the Resource to be stored.ifNoneExist
- whether to create the resource if none existsdoValidation
- if true, validate the resource; if false, assume the resource has already been validated- Returns:
- a FHIRRestOperationResponse object containing the results of the operation
- Throws:
java.lang.Exception
-
doCreateMeta
public FHIRRestOperationResponse doCreateMeta(FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, java.lang.String type, Resource resource, java.lang.String ifNoneExist) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
1st phase of CREATE. Perform the search for conditional create (ifNoneExist) interactions. Any validation (if required) should be performed before this call.- Specified by:
doCreateMeta
in interfaceFHIRResourceHelpers
- Returns:
- Throws:
java.lang.Exception
-
doCreatePersist
public FHIRRestOperationResponse doCreatePersist(FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, Resource resource, PayloadPersistenceResponse offloadResponse) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
3rd phase of resource create. Persist the resource using the configured persistence layer. Does not modify the resource.- Specified by:
doCreatePersist
in interfaceFHIRResourceHelpers
- Returns:
- Throws:
java.lang.Exception
-
doPatch
public FHIRRestOperationResponse doPatch(java.lang.String type, java.lang.String id, FHIRPatch patch, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs a patch operation (a new version of the Resource will be stored).- Specified by:
doPatch
in interfaceFHIRResourceHelpers
- Parameters:
type
- the type of the resource to be updatedid
- the id of the Resource being updatedpatch
- the patch to applyifMatchValue
- an optional "If-Match" header value to request a version-aware updatesearchQueryString
- an optional search query string to request a conditional updateskippableUpdate
- if true, and the result of the patch matches the existing resource on the server, then skip the update; if false, then always attempt the update- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
java.lang.Exception
-
doUpdate
public FHIRRestOperationResponse doUpdate(java.lang.String type, java.lang.String id, Resource newResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, boolean doValidation, java.lang.Integer ifNoneMatch) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs an update operation (a new version of the Resource will be stored).- Specified by:
doUpdate
in interfaceFHIRResourceHelpers
- Parameters:
type
- the type of the resource to be updatedid
- the id of the Resource being updatednewResource
- the new resource to be storedifMatchValue
- an optional "If-Match" header value to request a version-aware updatesearchQueryString
- an optional search query string to request a conditional updateskippableUpdate
- if true, and the resource content in the update matches the existing resource on the server, then skip the update; if false, then always attempt the updatedoValidation
- if true, validate the resource; if false, assume the resource has already been validatedifNoneMatch
- conditional create-on-update- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
java.lang.Exception
-
doUpdateMeta
public FHIRRestOperationResponse doUpdateMeta(FHIRPersistenceEvent event, java.lang.String type, java.lang.String id, FHIRPatch patch, Resource newResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, boolean doValidation, java.util.List<OperationOutcome.Issue> warnings) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
1st phase of update interaction.- Specified by:
doUpdateMeta
in interfaceFHIRResourceHelpers
- Returns:
- Throws:
java.lang.Exception
-
doPatchOrUpdatePersist
public FHIRRestOperationResponse doPatchOrUpdatePersist(FHIRPersistenceEvent event, java.lang.String type, java.lang.String id, boolean isPatch, Resource newResource, Resource prevResource, java.util.List<OperationOutcome.Issue> warnings, boolean isDeleted, java.lang.Integer ifNoneMatch, PayloadPersistenceResponse offloadResponse) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Persist the newResource value for patch or update interactions- Specified by:
doPatchOrUpdatePersist
in interfaceFHIRResourceHelpers
- Returns:
- Throws:
java.lang.Exception
-
doDelete
public FHIRRestOperationResponse doDelete(java.lang.String type, java.lang.String id, java.lang.String searchQueryString) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs a 'delete' operation on the specified resource.- Specified by:
doDelete
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the Resource to be deletedid
- the id of the Resource to be deletedsearchQueryString
- a search query associated with a conditional delete request (mutually exclusive with id)- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
java.lang.Exception
-
doRead
public SingleResourceResult<? extends Resource> doRead(java.lang.String type, java.lang.String id, boolean throwExcOnNull, boolean includeDeleted, Resource contextResource) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs a 'read' operation to retrieve a Resource.- Specified by:
doRead
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrievedthrowExcOnNull
- whether to throw an exception on nullincludeDeleted
- allow the read, even if the resource has been deletedcontextResource
- the resource- Returns:
- a SingleResourceResult wrapping the resource and including its deletion status
- Throws:
java.lang.Exception
-
doRead
public SingleResourceResult<? extends Resource> doRead(java.lang.String type, java.lang.String id, boolean throwExcOnNull, boolean includeDeleted, Resource contextResource, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs a 'read' operation to retrieve a Resource with select query parameters.- Specified by:
doRead
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrievedthrowExcOnNull
- whether to throw an exception on nullincludeDeleted
- allow the read, even if the resource has been deletedcontextResource
- the resourcequeryParameters
- for supporting _elements and _summary for resource read- Returns:
- a SingleResourceResult wrapping the resource and including its deletion status
- Throws:
java.lang.Exception
-
doVRead
public Resource doVRead(java.lang.String type, java.lang.String id, java.lang.String versionId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs a 'vread' operation by retrieving the specified version of a Resource.- Specified by:
doVRead
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrievedversionId
- the version id of the Resource to be retrievedqueryParameters
- for supporting _elements and _summary for resource vread- Returns:
- the Resource
- Throws:
java.lang.Exception
-
doHistory
public Bundle doHistory(java.lang.String type, java.lang.String id, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs the work of retrieving versions of a Resource.- Specified by:
doHistory
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrievedqueryParameters
- a Map containing the query parameters from the request URL- Returns:
- a Bundle containing the history of the specified Resource
- Throws:
java.lang.Exception
-
doSearch
public Bundle doSearch(java.lang.String type, java.lang.String compartment, java.lang.String compartmentId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, Resource contextResource) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs heavy lifting associated with a 'search' operation.- Specified by:
doSearch
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the searchcompartment
- the compartment type to search in, or null if not a compartment searchcompartmentId
- the specific compartment to search in, or null if not a compartment searchqueryParameters
- a Map containing the query parameters from the request URLrequestUri
- the request URIcontextResource
- the resource context- Returns:
- a Bundle containing the search result set
- Throws:
java.lang.Exception
-
doSearch
public Bundle doSearch(java.lang.String type, java.lang.String compartment, java.lang.String compartmentId, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, Resource contextResource, boolean checkInteractionAllowed, boolean alwaysIncludeResources) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Performs heavy lifting associated with a 'search' operation.- Specified by:
doSearch
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource type associated with the searchcompartment
- the compartment type to search in, or null if not a compartment searchcompartmentId
- the specific compartment to search in, or null if not a compartment searchqueryParameters
- a Map containing the query parameters from the request URLrequestUri
- the request URIcontextResource
- the resource contextcheckInteractionAllowed
- if true, check that the search interaction is permittedalwaysIncludeResources
- if true, ignore any return preference and always include the resource in the search result bundle- Returns:
- a Bundle containing the search result set
- Throws:
java.lang.Exception
-
doInvoke
public Resource doInvoke(FHIROperationContext operationContext, java.lang.String resourceTypeName, java.lang.String logicalId, java.lang.String versionId, Resource resource, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Helper method which invokes a custom operation.- Specified by:
doInvoke
in interfaceFHIRResourceHelpers
- Parameters:
operationContext
- the FHIROperationContext associated with the requestresourceTypeName
- the resource type associated with the requestlogicalId
- the resource logical id associated with the requestversionId
- the resource version id associated with the requestresource
- the input resource associated with the custom operation to be invokedqueryParameters
- query parameters may be passed instead of a Parameters resource for certain custom operations invoked via GET- Returns:
- a Resource that represents the response to the custom operation
- Throws:
java.lang.Exception
-
doBundle
public Bundle doBundle(Bundle inputBundle, boolean skippableUpdates) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Processes a bundled request (batch or transaction type).- Specified by:
doBundle
in interfaceFHIRResourceHelpers
- Parameters:
inputBundle
- the request BundleskippableUpdates
- if true, and the bundle contains an update for which the resource content in the update matches the existing resource on the server, then skip the update; if false, then always attempt the updates specified in the bundle- Returns:
- the response Bundle
- Throws:
java.lang.Exception
-
getTransaction
public FHIRPersistenceTransaction getTransaction() throws java.lang.Exception
- Specified by:
getTransaction
in interfaceFHIRResourceHelpers
- Throws:
java.lang.Exception
-
updateOperationContext
public void updateOperationContext(FHIROperationContext operationContext, java.lang.String method)
common update to the operationContext- Parameters:
operationContext
-method
-
-
createSearchResponseBundle
Bundle createSearchResponseBundle(java.util.List<ResourceResult<? extends Resource>> resourceResults, FHIRSearchContext searchContext, java.lang.String type) throws java.lang.Exception
Creates a bundle that will hold results for a search operation.- Parameters:
resourceResults
- the list of resource results to include in the bundlesearchContext
- the FHIRSearchContext object associated with the searchtype
- the name of the resource type being searched- Returns:
- the bundle
- Throws:
java.lang.Exception
-
getRequestBaseUri
public static java.lang.String getRequestBaseUri(java.lang.String type) throws java.lang.Exception
This method returns the "base URI" associated with the current request. For example, if a client invoked POST https://myhost:9443/fhir-server/api/v4/Patient to create a Patient resource, this method would return "https://myhost:9443/fhir-server/api/v4".- Parameters:
type
- The resource type associated with the request URI (e.g. "Patient" in the case of https://myhost:9443/fhir-server/api/v4/Patient), or null if there is no such resource type- Returns:
- The base endpoint URI associated with the current request.
- Throws:
java.lang.Exception
- if an error occurs while reading the config
-
buildPersistenceEventProperties
public java.util.Map<java.lang.String,java.lang.Object> buildPersistenceEventProperties(java.lang.String type, java.lang.String id, java.lang.String version, FHIRSearchContext searchContext, FHIRSystemHistoryContext systemHistoryContext) throws FHIRPersistenceException
Description copied from interface:FHIRResourceHelpers
Builds a collection of properties that will be passed to the persistence interceptors.- Specified by:
buildPersistenceEventProperties
in interfaceFHIRResourceHelpers
- Parameters:
type
- the resource typeid
- the resource logical IDversion
- the resource versionsearchContext
- the request search contextsystemHistoryContext
- the request system history context- Returns:
- a map of persistence event properties
- Throws:
FHIRPersistenceException
-
doReindex
public int doReindex(FHIROperationContext operationContext, OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds, java.lang.String resourceLogicalId) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Invoke the FHIR persistence reindex operation for either a specified list of indexIds, or a randomly chosen resource, last reindexed before the given timestamp.- Specified by:
doReindex
in interfaceFHIRResourceHelpers
- Parameters:
operationContext
- the operation contextoperationOutcomeResult
- 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 (e.g. "Patient"), or resourceType/logicalId a specific resource (e.g. "Patient/abc123"), to reindex, or null; this parameter is ignored if the indexIds parameter value is non-null- Returns:
- count of the number of resources reindexed by this call
- Throws:
java.lang.Exception
-
doReindexList
public int doReindexList(OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.util.List<java.lang.Long> indexIds) throws java.lang.Exception
encapsulates the logic to process a list with graduated backoff through the full list of indexIds- Parameters:
operationOutcomeResult
-tstamp
-indexIds
-- Returns:
- Throws:
java.lang.Exception
-
doReindexSingle
public int doReindexSingle(OperationOutcome.Builder operationOutcomeResult, java.time.Instant tstamp, java.lang.String resourceLogicalId) throws java.lang.Exception
do a single reindex on a specific resourceLogicalId- Parameters:
operationOutcomeResult
-tstamp
-resourceLogicalId
-- Returns:
- Throws:
java.lang.Exception
-
validateResource
public java.util.List<OperationOutcome.Issue> validateResource(Resource resource) throws FHIROperationException
Description copied from interface:FHIRResourceHelpers
Validate a resource. First validate profile assertions for the resource if configured to do so, then validate the resource itself.- Specified by:
validateResource
in interfaceFHIRResourceHelpers
- Parameters:
resource
- the resource to be validated- Returns:
- A list of validation errors and warnings
- Throws:
FHIROperationException
-
validateInteraction
public void validateInteraction(FHIRResourceHelpers.Interaction interaction, java.lang.String resourceType) throws FHIROperationException
Description copied from interface:FHIRResourceHelpers
Validate an interaction for a specified resource type.- Specified by:
validateInteraction
in interfaceFHIRResourceHelpers
- Parameters:
interaction
- the interaction to be performedresourceType
- the resource type against which the interaction is to be performed- Throws:
FHIROperationException
-
doHistory
public Bundle doHistory(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> queryParameters, java.lang.String requestUri, java.lang.String resourceType) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Implement the system level history operation to obtain a list of changes to resources with an optional resourceType which supports for example [base]/Patient/_history requests to return the complete history of changes filtered to a specific resource type. Because the resource type is included in the path, this variant allows only a single resource type to be specified. To obtain history for more than one resource type, the [base]/_history whole system history endpoint should be used instead with a list of resource types specified using the _type query parameter.- Specified by:
doHistory
in interfaceFHIRResourceHelpers
- Parameters:
queryParameters
- a Map containing the query parameters from the request URLrequestUri
- the request URIresourceType
- optional resourceType to filter the history- Returns:
- a Bundle containing the history of the specified Resource
- Throws:
java.lang.Exception
-
doErase
public ResourceEraseRecord doErase(FHIROperationContext operationContext, EraseDTO eraseDto) throws FHIROperationException
Description copied from interface:FHIRResourceHelpers
Invoke the FHIR Persistence erase operation for a specific instance of the erase.- Specified by:
doErase
in interfaceFHIRResourceHelpers
- Returns:
- Throws:
FHIROperationException
-
doRetrieveIndex
public java.util.List<java.lang.Long> doRetrieveIndex(FHIROperationContext operationContext, java.lang.String resourceTypeName, int count, java.time.Instant notModifiedAfter, java.lang.Long afterIndexId) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
Invoke the FHIR persistence retrieve index operation to retrieve a list of indexIds available for reindexing.- Specified by:
doRetrieveIndex
in interfaceFHIRResourceHelpers
- Parameters:
operationContext
- the operation contextresourceTypeName
- the resource type of index IDs to return, or nullcount
- 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 ID, or null to start with first ID- Returns:
- list of index IDs available for reindexing
- Throws:
java.lang.Exception
-
generateResourceId
public java.lang.String generateResourceId()
Description copied from interface:FHIRResourceHelpers
Generate a new resource id. This is typically delegated to the persistence layer, which may want to create FHIR-compliant ids optimized for a certain type of storage.- Specified by:
generateResourceId
in interfaceFHIRResourceHelpers
- Returns:
-
getCurrentInstant
protected Instant getCurrentInstant()
Get the current time which can be used for the lastUpdated field- Returns:
- current time in UTC
-
storePayload
public PayloadPersistenceResponse storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey) throws java.lang.Exception
Description copied from interface:FHIRResourceHelpers
If the underlying persistence layer supports offloading payload storage, initiate the request here.- Specified by:
storePayload
in interfaceFHIRResourceHelpers
- Parameters:
resource
- the resource to store (with correct Meta fields)logicalId
- the logical id of the resourcenewVersionNumber
- the version number to useresourcePayloadKey
- the key used to tie the RDBMS record with the offload record- Returns:
- a response to the payload store operation, or null if it is not supported
- Throws:
java.lang.Exception
-
-