Package com.ibm.fhir.server.rest
Class FHIRRestInteractionVisitorOffload
- java.lang.Object
-
- com.ibm.fhir.server.rest.FHIRRestInteractionVisitorBase
-
- com.ibm.fhir.server.rest.FHIRRestInteractionVisitorOffload
-
- All Implemented Interfaces:
FHIRRestInteractionVisitor
public class FHIRRestInteractionVisitorOffload extends FHIRRestInteractionVisitorBase
Visitor used to initiate payload offloading when supported by the persistence layer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
transaction
-
Fields inherited from class com.ibm.fhir.server.rest.FHIRRestInteractionVisitorBase
helpers, localRefMap, SC_ACCEPTED_STRING, SC_BAD_REQUEST_STRING, SC_GONE_STRING, SC_NOT_FOUND_STRING, SC_OK_STRING, SC_PRECONDITION_FAILED_STRING
-
-
Constructor Summary
Constructors Constructor Description FHIRRestInteractionVisitorOffload(boolean transaction, FHIRResourceHelpers helpers, java.util.Map<java.lang.String,java.lang.String> localRefMap, Bundle.Entry[] responseBundleEntries)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FHIRRestOperationResponse
doCreate(int entryIndex, FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, Resource resource, java.lang.String ifNoneExist, java.lang.String localIdentifier, PayloadPersistenceResponse offloadResponse)
Performs the heavy lifting associated with a 'create' interaction.FHIRRestOperationResponse
doDelete(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, java.lang.String searchQueryString)
Performs a 'delete' operation on the specified resource.FHIRRestOperationResponse
doHistory(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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.FHIRRestOperationResponse
doInvoke(java.lang.String method, int entryIndex, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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(int entryIndex, FHIRPersistenceEvent event, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, Resource resource, Resource prevResource, FHIRPatch patch, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, java.util.List<OperationOutcome.Issue> warnings, java.lang.String localIdentifier, PayloadPersistenceResponse offloadResponse)
Performs a patch operation (a new version of the Resource will be stored).FHIRRestOperationResponse
doRead(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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, boolean checkInteractionAllowed)
Performs a 'read' operation to retrieve a Resource.FHIRRestOperationResponse
doSearch(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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)
Performs heavy lifting associated with a 'search' operation.FHIRRestOperationResponse
doUpdate(int entryIndex, FHIRPersistenceEvent event, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, Resource resource, Resource prevResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, java.lang.String localIdentifier, java.util.List<OperationOutcome.Issue> warnings, boolean isDeleted, java.lang.Integer ifNoneMatch, PayloadPersistenceResponse offloadResponse)
Performs an update operation (a new version of the Resource will be stored).FHIRRestOperationResponse
doVRead(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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 with no query parametersFHIRRestOperationResponse
issue(int entryIndex, java.lang.String requestDescription, long accumulatedTime, javax.ws.rs.core.Response.Status status, Bundle.Entry responseEntry)
Add the issue to the result bundleprotected PayloadPersistenceResponse
storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey)
If payload offloading is supported by the persistence layer, store the given resource.FHIRRestOperationResponse
validationResponse(int entryIndex, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, long accumulatedTime)
Add the given validationResponseEntry to the result bundle-
Methods inherited from class com.ibm.fhir.server.rest.FHIRRestInteractionVisitorBase
addLocalRefMapping, buildResponseBundleEntry, getResponseEntry, setEntryComplete, updateIssuesWithEntryIndexAndThrow
-
-
-
-
Constructor Detail
-
FHIRRestInteractionVisitorOffload
public FHIRRestInteractionVisitorOffload(boolean transaction, FHIRResourceHelpers helpers, java.util.Map<java.lang.String,java.lang.String> localRefMap, Bundle.Entry[] responseBundleEntries)
Public constructor- Parameters:
helpers
-
-
-
Method Detail
-
doSearch
public FHIRRestOperationResponse doSearch(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs heavy lifting associated with a 'search' operation.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 FHIRRestOperationResponse containing the search result bundle
- Throws:
java.lang.Exception
-
doVRead
public FHIRRestOperationResponse doVRead(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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:FHIRRestInteractionVisitor
Performs a 'vread' operation by retrieving the specified version of a Resource with no query parameterstype
- 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 retrieved- Returns:
- the Resource
- Throws:
java.lang.Exception
-
doRead
public FHIRRestOperationResponse doRead(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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, boolean checkInteractionAllowed) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs a 'read' operation to retrieve a Resource.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
-
doHistory
public FHIRRestOperationResponse doHistory(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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:FHIRRestInteractionVisitor
Performs the work of retrieving versions of a Resource.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
-
doCreate
public FHIRRestOperationResponse doCreate(int entryIndex, FHIRPersistenceEvent event, java.util.List<OperationOutcome.Issue> warnings, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, Resource resource, java.lang.String ifNoneExist, java.lang.String localIdentifier, PayloadPersistenceResponse offloadResponse) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs the heavy lifting associated with a 'create' interaction.warnings
- the list of warning issues accumulated for this entrytype
- the resource type specified as part of the request URLresource
- the Resource to be stored.ifNoneExist
- whether to create the resource if none existsoffloadResponse
- the response from payload persistence when offloading- Returns:
- a FHIRRestOperationResponse object containing the results of the operation
- Throws:
java.lang.Exception
-
doUpdate
public FHIRRestOperationResponse doUpdate(int entryIndex, FHIRPersistenceEvent event, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, Resource resource, Resource prevResource, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, java.lang.String localIdentifier, java.util.List<OperationOutcome.Issue> warnings, boolean isDeleted, java.lang.Integer ifNoneMatch, PayloadPersistenceResponse offloadResponse) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs an update operation (a new version of the Resource will be stored).event
- the persistence event used for this resource interactionid
- the id of the Resource being updatedresource
- the new resource to be storedprevResource
- the old resource value if we have itifMatchValue
- 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 updatelocalIdentifier
- if not null, represents the local identifier within the bundle used to support local referenceswarnings
- the accumulated list of warnings gathered while processing the interactionisDeleted
- flag to indicate if the resource is currently deletedifNoneMatch
- conditional create-on-updateoffloadResponse
- the response from payload persistence when offloading- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
java.lang.Exception
-
doPatch
public FHIRRestOperationResponse doPatch(int entryIndex, FHIRPersistenceEvent event, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, Resource resource, Resource prevResource, FHIRPatch patch, java.lang.String ifMatchValue, java.lang.String searchQueryString, boolean skippableUpdate, java.util.List<OperationOutcome.Issue> warnings, java.lang.String localIdentifier, PayloadPersistenceResponse offloadResponse) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs a patch operation (a new version of the Resource will be stored).event
- the persistence event used for this resource interactiontype
- the type of the resource to be updatedid
- the id of the Resource being updatedresource
- the latest value of the resourceprevResource
- the value of the resource before any changespatch
- 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 updateoffloadResponse
- response from payload persistencen when offloading- Returns:
- a FHIRRestOperationResponse that contains the results of the operation
- Throws:
java.lang.Exception
-
doInvoke
public FHIRRestOperationResponse doInvoke(java.lang.String method, int entryIndex, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, 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:FHIRRestInteractionVisitor
Helper method which invokes a custom operation.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
-
doDelete
public FHIRRestOperationResponse doDelete(int entryIndex, java.lang.String requestDescription, FHIRUrlParser requestURL, long accumulatedTime, java.lang.String type, java.lang.String id, java.lang.String searchQueryString) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Performs a 'delete' operation on the specified resource.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:
java.lang.Exception
-
validationResponse
public FHIRRestOperationResponse validationResponse(int entryIndex, Bundle.Entry validationResponseEntry, java.lang.String requestDescription, long accumulatedTime) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Add the given validationResponseEntry to the result bundle- Returns:
- Throws:
java.lang.Exception
-
issue
public FHIRRestOperationResponse issue(int entryIndex, java.lang.String requestDescription, long accumulatedTime, javax.ws.rs.core.Response.Status status, Bundle.Entry responseEntry) throws java.lang.Exception
Description copied from interface:FHIRRestInteractionVisitor
Add the issue to the result bundle- Returns:
- Throws:
java.lang.Exception
-
storePayload
protected PayloadPersistenceResponse storePayload(Resource resource, java.lang.String logicalId, int newVersionNumber, java.lang.String resourcePayloadKey) throws java.lang.Exception
If payload offloading is supported by the persistence layer, store the given resource. This can be an async operation which we resolve at the end just prior to the transaction being committed. If offloading isn't enabled, the operation is a NOP and the persistence layer returns null.- Parameters:
resource
-logicalId
-newVersionNumber
-resourcePayloadKey
-- Returns:
- Throws:
java.lang.Exception
-
-