Class FHIRRestInteractionVisitorBase
- java.lang.Object
-
- org.linuxforhealth.fhir.server.rest.FHIRRestInteractionVisitorBase
-
- All Implemented Interfaces:
FHIRRestInteractionVisitor
- Direct Known Subclasses:
FHIRRestInteractionVisitorMeta
,FHIRRestInteractionVisitorOffload
,FHIRRestInteractionVisitorPersist
,FHIRRestInteractionVisitorReferenceMapping
public abstract class FHIRRestInteractionVisitorBase extends java.lang.Object implements FHIRRestInteractionVisitor
Abstract base class of theFHIRRestInteractionVisitor
. Manages access to the map managing local references (localRefMap) and the array of response Entry objects (responseBundleEntries).
-
-
Field Summary
Fields Modifier and Type Field Description protected FHIRResourceHelpers
helpers
protected java.util.Map<java.lang.String,java.lang.String>
localRefMap
protected static String
SC_ACCEPTED_STRING
protected static String
SC_BAD_REQUEST_STRING
protected static String
SC_GONE_STRING
protected static String
SC_NOT_FOUND_STRING
protected static String
SC_OK_STRING
protected static String
SC_PRECONDITION_FAILED_STRING
-
Constructor Summary
Constructors Modifier Constructor Description protected
FHIRRestInteractionVisitorBase(FHIRResourceHelpers helpers, java.util.Map<java.lang.String,java.lang.String> localRefMap, Bundle.Entry[] responseBundleEntries)
Protected constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addLocalRefMapping(java.lang.String localIdentifier, Resource resource)
This method will add a mapping to the local-to-external identifier map if the specified localIdentifier is non-null.protected Bundle.Entry
buildResponseBundleEntry(FHIRRestOperationResponse operationResponse, OperationOutcome validationOutcome, java.lang.String requestDescription, long accumulatedTime)
Build an entry for the bundle responseprotected Bundle.Entry
getResponseEntry(int entryIndex)
protected void
setEntryComplete(int entryIndex, Bundle.Entry e, java.lang.String requestDescription, long accumulatedTime)
Set the given entry e in the response bundle and log a bundle entry completion message.protected void
updateIssuesWithEntryIndexAndThrow(java.lang.Integer entryIndex, FHIROperationException cause)
Wrap the cause with a FHIRRestbundledRequestException and update each issue with the entryIndex before throwing.
-
-
-
Field Detail
-
SC_BAD_REQUEST_STRING
protected static final String SC_BAD_REQUEST_STRING
-
SC_GONE_STRING
protected static final String SC_GONE_STRING
-
SC_NOT_FOUND_STRING
protected static final String SC_NOT_FOUND_STRING
-
SC_ACCEPTED_STRING
protected static final String SC_ACCEPTED_STRING
-
SC_OK_STRING
protected static final String SC_OK_STRING
-
SC_PRECONDITION_FAILED_STRING
protected static final String SC_PRECONDITION_FAILED_STRING
-
helpers
protected final FHIRResourceHelpers helpers
-
localRefMap
protected final java.util.Map<java.lang.String,java.lang.String> localRefMap
-
-
Constructor Detail
-
FHIRRestInteractionVisitorBase
protected FHIRRestInteractionVisitorBase(FHIRResourceHelpers helpers, java.util.Map<java.lang.String,java.lang.String> localRefMap, Bundle.Entry[] responseBundleEntries)
Protected constructor- Parameters:
helpers
-localRefMap
-responseBundleEntries
-
-
-
Method Detail
-
setEntryComplete
protected void setEntryComplete(int entryIndex, Bundle.Entry e, java.lang.String requestDescription, long accumulatedTime)
Set the given entry e in the response bundle and log a bundle entry completion message.- Parameters:
entryIndex
-e
-requestDescription
-accumulatedTime
-
-
getResponseEntry
protected Bundle.Entry getResponseEntry(int entryIndex)
-
buildResponseBundleEntry
protected Bundle.Entry buildResponseBundleEntry(FHIRRestOperationResponse operationResponse, OperationOutcome validationOutcome, java.lang.String requestDescription, long accumulatedTime) throws FHIROperationException
Build an entry for the bundle response- Parameters:
operationResponse
-validationOutcome
-requestDescription
-accumulatedTime
-- Returns:
- Throws:
FHIROperationException
-
addLocalRefMapping
protected void addLocalRefMapping(java.lang.String localIdentifier, Resource resource)
This method will add a mapping to the local-to-external identifier map if the specified localIdentifier is non-null.- Parameters:
localIdentifier
- the localIdentifier previously obtained for the resourceresource
- the resource for which an external identifier will be built
-
updateIssuesWithEntryIndexAndThrow
protected void updateIssuesWithEntryIndexAndThrow(java.lang.Integer entryIndex, FHIROperationException cause) throws FHIROperationException
Wrap the cause with a FHIRRestbundledRequestException and update each issue with the entryIndex before throwing.- Parameters:
entryIndex
-cause
-- Throws:
FHIROperationException
-
-