Interface FHIRResourceHelpers
-
- All Known Implementing Classes:
FHIRRestHelper
public interface FHIRResourceHelpers
This interface describes the set of helper methods from the FHIR REST layer that are used by custom operation implementations.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DO_VALIDATION
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Bundle
doBundle(Bundle bundle, Map<String,String> requestProperties)
Processes a bundled request (batch or transaction type).default FHIRRestOperationResponse
doCreate(String type, Resource resource, String ifNoneExist, Map<String,String> requestProperties)
Performs the heavy lifting associated with a 'create' interaction.FHIRRestOperationResponse
doCreate(String type, Resource resource, String ifNoneExist, Map<String,String> requestProperties, boolean doValidation)
Performs the heavy lifting associated with a 'create' interaction.FHIRRestOperationResponse
doDelete(String type, String id, String searchQueryString, Map<String,String> requestProperties)
Performs a 'delete' operation on the specified resource.Bundle
doHistory(String type, String id, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties)
Performs the work of retrieving versions of a Resource.Bundle
doHistory(javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties)
Implement the system level history operation to obtain a list of changes to resourcesResource
doInvoke(FHIROperationContext operationContext, String resourceTypeName, String logicalId, String versionId, String operationName, Resource resource, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, Map<String,String> requestProperties)
Helper method which invokes a custom operation.FHIRRestOperationResponse
doPatch(String type, String id, FHIRPatch patch, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties)
Performs a patch operation (a new version of the Resource will be stored).Resource
doRead(String type, String id, boolean throwExcOnNull, boolean includeDeleted, Map<String,String> requestProperties, Resource contextResource)
Performs a 'read' operation to retrieve a Resource.Resource
doRead(String type, String id, boolean throwExcOnNull, boolean includeDeleted, Map<String,String> requestProperties, Resource contextResource, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters)
Performs a 'read' operation to retrieve a Resource.int
doReindex(FHIROperationContext operationContext, OperationOutcome.Builder operationOutcomeResult, Instant tstamp, String resourceLogicalId)
Invoke the FHIR persistence reindex operation for a randomly chosen resource which was last reindexed before the given dateBundle
doSearch(String type, String compartment, String compartmentId, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties, Resource contextResource)
Performs heavy lifting associated with a 'search' operation.default FHIRRestOperationResponse
doUpdate(String type, String id, Resource newResource, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties)
Performs an update operation (a new version of the Resource will be stored).FHIRRestOperationResponse
doUpdate(String type, String id, Resource newResource, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties, boolean doValidation)
Performs an update operation (a new version of the Resource will be stored).Resource
doVRead(String type, String id, String versionId, Map<String,String> requestProperties)
Performs a 'vread' operation by retrieving the specified version of a Resource.Resource
doVRead(String type, String id, String versionId, Map<String,String> requestProperties, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters)
Performs a 'vread' operation by retrieving the specified version of a Resource.FHIRPersistenceTransaction
getTransaction()
-
-
-
Field Detail
-
DO_VALIDATION
static final boolean DO_VALIDATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
doCreate
default FHIRRestOperationResponse doCreate(String type, Resource resource, String ifNoneExist, Map<String,String> requestProperties) throws Exception
Performs the heavy lifting associated with a 'create' interaction. Validates the resource.- 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 existsrequestProperties
- additional request properties which supplement the HTTP headers associated with this request- Returns:
- a FHIRRestOperationResponse object containing the results of the operation
- Throws:
Exception
-
doCreate
FHIRRestOperationResponse doCreate(String type, Resource resource, String ifNoneExist, Map<String,String> requestProperties, boolean doValidation) throws Exception
Performs the heavy lifting associated with a 'create' interaction.- 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 existsrequestProperties
- additional request properties which supplement the HTTP headers associated with this requestdoValidation
- 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:
Exception
-
doUpdate
default FHIRRestOperationResponse doUpdate(String type, String id, Resource newResource, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties) throws Exception
Performs an update operation (a new version of the Resource will be stored). Validates the resource.- 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 update- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
Exception
-
doUpdate
FHIRRestOperationResponse doUpdate(String type, String id, Resource newResource, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties, boolean doValidation) throws Exception
Performs an update operation (a new version of the Resource will be stored).- 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 updatedoValidation
- if true, validate the resource; if false, assume the resource has already been validated- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
Exception
-
doPatch
FHIRRestOperationResponse doPatch(String type, String id, FHIRPatch patch, String ifMatchValue, String searchQueryString, Map<String,String> requestProperties) throws Exception
Performs a patch operation (a new version of the Resource will be stored).- 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 update- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
Exception
-
doDelete
FHIRRestOperationResponse doDelete(String type, String id, String searchQueryString, Map<String,String> requestProperties) throws Exception
Performs a 'delete' operation on the specified resource.- Parameters:
type
- the resource type associated with the Resource to be deletedid
- the id of the Resource to be deleted- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
Exception
-
doRead
Resource doRead(String type, String id, boolean throwExcOnNull, boolean includeDeleted, Map<String,String> requestProperties, Resource contextResource, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters) throws Exception
Performs a 'read' operation to retrieve a Resource.- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrievedqueryParameters
- for supporting _elements and _summary for resource read- Returns:
- the Resource
- Throws:
Exception
-
doRead
Resource doRead(String type, String id, boolean throwExcOnNull, boolean includeDeleted, Map<String,String> requestProperties, Resource contextResource) throws Exception
Performs a 'read' operation to retrieve a Resource.- Parameters:
type
- the resource type associated with the Resource to be retrievedid
- the id of the Resource to be retrieved- Returns:
- the Resource
- Throws:
Exception
-
doVRead
Resource doVRead(String type, String id, String versionId, Map<String,String> requestProperties, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters) throws Exception
Performs a 'vread' operation by retrieving the specified version of a Resource.- 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 retrievedrequestProperties
- additional request properties which supplement the HTTP headers associated with this requestqueryParameters
- for supporting _elements and _summary for resource vread- Returns:
- the Resource
- Throws:
Exception
-
doVRead
Resource doVRead(String type, String id, String versionId, Map<String,String> requestProperties) throws Exception
Performs a 'vread' operation by retrieving the specified version of a Resource.- 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 retrievedrequestProperties
- additional request properties which supplement the HTTP headers associated with this request- Returns:
- the Resource
- Throws:
Exception
-
doHistory
Bundle doHistory(String type, String id, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties) throws Exception
Performs the work of retrieving versions of a Resource.- 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 URLrequestUri
-requestProperties
-- Returns:
- a Bundle containing the history of the specified Resource
- Throws:
Exception
-
doHistory
Bundle doHistory(javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties) throws Exception
Implement the system level history operation to obtain a list of changes to resources- Parameters:
queryParameters
- a Map containing the query parameters from the request URLrequestUri
-requestProperties
-- Returns:
- a Bundle containing the history of the specified Resource
- Throws:
Exception
-
doSearch
Bundle doSearch(String type, String compartment, String compartmentId, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, String requestUri, Map<String,String> requestProperties, Resource contextResource) throws Exception
Performs heavy lifting associated with a 'search' operation.- Parameters:
type
- the resource type associated with the searchqueryParameters
- a Map containing the query parameters from the request URL- Returns:
- a Bundle containing the search result set
- Throws:
Exception
-
doInvoke
Resource doInvoke(FHIROperationContext operationContext, String resourceTypeName, String logicalId, String versionId, String operationName, Resource resource, javax.ws.rs.core.MultivaluedMap<String,String> queryParameters, Map<String,String> requestProperties) throws Exception
Helper method which invokes a custom operation.- 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 requestoperationName
- the name of the custom operation to be invokedresource
- 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 GETrequestProperties
- additional request properties which supplement the HTTP headers associated with this request- Returns:
- a Resource that represents the response to the custom operation
- Throws:
Exception
-
doBundle
Bundle doBundle(Bundle bundle, Map<String,String> requestProperties) throws Exception
Processes a bundled request (batch or transaction type).- Parameters:
bundle
- the request Bundle- Returns:
- the response Bundle
- Throws:
Exception
-
getTransaction
FHIRPersistenceTransaction getTransaction() throws Exception
- Throws:
Exception
-
doReindex
int doReindex(FHIROperationContext operationContext, OperationOutcome.Builder operationOutcomeResult, Instant tstamp, String resourceLogicalId) throws Exception
Invoke the FHIR persistence reindex operation for a randomly chosen resource which was last reindexed before the given date- Parameters:
operationContext
-operationOutcomeResult
-tstamp
-resourceLogicalId
- a reference to a resource e.g. "Patient/abc123". Can be null- Returns:
- number of resources reindexed (0 if no resources were found to reindex)
- Throws:
Exception
-
-