Interface RequestConsumer
- All Superinterfaces:
Predicate<RequestDetails>
- All Known Implementing Classes:
FhirConsumer
Consumer interface of FHIR requests. Plain providers or resource providers forward the
request data received to an instance of this interface to be processed. This decouples
request reception from request handling, so you can e.g. use the IHE resource providers
outside of Apache Camel.
The request parameters may contain the following parameters entries indicating a "lazy-loading" mode on searches.
Constants.FHIR_REQUEST_SIZE_ONLY
: if this entry is present, the requester expects only the result size to be returned in an parameter entry with the same name and callshandleSizeRequest(Object, Map)
to do so. If possible, implementations should only request the result size from the backend rather than a complete result set.Constants.FHIR_FROM_INDEX
andConstants.FHIR_TO_INDEX
: if these entries are present, the requester expects only the specified subset of the result. If possible, implementations should only request this result set from the backend rather than a complete result set.
- Since:
- 3.1
- Author:
- Christian Ohr
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
getName()
handleAction
(Object payload, Map<String, Object> headers) Handles a Create / Update / Validate / Delete action request.handleBundleProviderRequest
(Object payload, Map<String, Object> headers) Handles the request for a bundle provider, effectively constructing a list of resources.<R extends IBaseResource>
List<R>handleBundleRequest
(Object payload, Map<String, Object> headers) Handles the (search) request for a bundle, effectively being a list of resources.<R extends IBaseResource>
RHandles the request for a resourceint
handleSizeRequest
(Object payload, Map<String, Object> headers) Optional method that request the result size of a bundle request.<T extends IBaseBundle>
THandles transaction requestsboolean
default boolean
test
(RequestDetails requestDetails) Returns true if this RequestConsumer can handle the provided FHIR payload
-
Method Details
-
getFhirContext
FhirContext getFhirContext()- Returns:
- the FhirContext used by this consumer
-
test
Returns true if this RequestConsumer can handle the provided FHIR payload- Specified by:
test
in interfacePredicate<RequestDetails>
- Parameters:
requestDetails
- FHIR requestDetails- Returns:
- true if this RequestConsumer can handle the provided FHIR request, false otherwise
-
handleAction
Handles a Create / Update / Validate / Delete action request.- Parameters:
payload
- request payloadheaders
- request parameters, e.g. search parameters- Returns:
- result of the action execution
-
handleResourceRequest
<R extends IBaseResource> R handleResourceRequest(Object payload, Map<String, Object> headers, Class<R> resultType) Handles the request for a resource- Type Parameters:
R
- type of the returned resource- Parameters:
payload
- request payloadheaders
- request parameters, e.g. search parametersresultType
- type of the returned resource- Returns:
- resource to be returned
-
handleBundleRequest
Handles the (search) request for a bundle, effectively being a list of resources.If
supportsLazyLoading()
returns true, the headers may containConstants.FHIR_FROM_INDEX
andConstants.FHIR_TO_INDEX
entries, indicating that only a part of the result is requested. Implementations must return only the requested entries.- Type Parameters:
R
- type of the returned resources contained in the bundle- Parameters:
payload
- request payloadheaders
- request parameters, e.g. search parameters or- Returns:
- list of resources to be returned
-
handleBundleProviderRequest
Handles the request for a bundle provider, effectively constructing a list of resources. The returned IBundleProvider takes over the responsibility to fetch the required subset of the result, usually by indirectly callinghandleBundleRequest(Object, Map)
as required.- Parameters:
payload
- request payloadheaders
- request parameters, e.g. search parameters- Returns:
- a bundle provider
-
handleTransactionRequest
<T extends IBaseBundle> T handleTransactionRequest(Object payload, Map<String, Object> headers, Class<T> bundleClass) Handles transaction requests- Parameters:
payload
- request payloadheaders
- request parameters- Returns:
- transaction response bundle
-
handleSizeRequest
Optional method that request the result size of a bundle request. Only used for lazy bundle providers. The headers contain aConstants.FHIR_REQUEST_SIZE_ONLY
entry flag. This method only needs to be implemented issupportsLazyLoading()
returns true.- Parameters:
payload
- request payloadheaders
- request parameters- Returns:
- transaction response bundle
-
supportsLazyLoading
boolean supportsLazyLoading()- Returns:
- returns true indicating that lazy loading of search results is supported, false otherwise.
-
getName
-