public class FhirConsumer<AuditDatasetType extends FhirAuditDataset> extends org.apache.camel.impl.DefaultConsumer implements org.apache.camel.SuspendableService, RequestConsumer
RequestConsumer
that handles requests
by sending the request data and parameters into a Camel route and returning the result of
the route processing.Constructor and Description |
---|
FhirConsumer(FhirEndpoint<AuditDatasetType,? extends FhirComponent<AuditDatasetType>> endpoint,
org.apache.camel.Processor processor) |
Modifier and Type | Method and Description |
---|---|
protected void |
doStart() |
protected void |
doStop() |
protected ca.uhn.fhir.rest.api.server.IBundleProvider |
getBundleProvider(Object payload,
Map<String,Object> headers)
Returns the
IBundleProvider , providing the matching bundles. |
FhirEndpoint<AuditDatasetType,FhirComponent<AuditDatasetType>> |
getEndpoint() |
ca.uhn.fhir.context.FhirContext |
getFhirContext() |
String |
getName() |
ca.uhn.fhir.rest.api.MethodOutcome |
handleAction(Object payload,
Map<String,Object> headers)
Handles a Create / Update / Validate / Delete action request.
|
ca.uhn.fhir.rest.api.server.IBundleProvider |
handleBundleProviderRequest(Object payload,
Map<String,Object> headers)
Handles the request for a bundle provider, effectively constructing a list of resources.
|
<R extends org.hl7.fhir.instance.model.api.IBaseResource> |
handleBundleRequest(Object payload,
Map<String,Object> headers)
Handles the (search) request for a bundle, effectively being a list of resources.
|
protected <T> T |
handleInRoute(Object payload,
Map<String,Object> headers,
Class<T> resultClass)
Forwards the request to be handled into a Camel route
|
<R extends org.hl7.fhir.instance.model.api.IBaseResource> |
handleResourceRequest(Object payload,
Map<String,Object> headers,
Class<R> resultClass)
This method can be called by
IResourceProvider objects to send the received
(and potentially handled) request further down a Camel route. |
int |
handleSizeRequest(Object payload,
Map<String,Object> headers)
Optional method that request the result size of a bundle request.
|
<T extends org.hl7.fhir.instance.model.api.IBaseBundle> |
handleTransactionRequest(Object payload,
Map<String,Object> headers,
Class<T> bundleClass)
Handles transaction requests
|
protected org.apache.camel.Exchange |
runRoute(Object payload,
Map<String,Object> headers) |
boolean |
supportsLazyLoading() |
createUoW, doneUoW, getAsyncProcessor, getExceptionHandler, getProcessor, getRoute, handleException, handleException, setExceptionHandler, setRoute, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public FhirConsumer(FhirEndpoint<AuditDatasetType,? extends FhirComponent<AuditDatasetType>> endpoint, org.apache.camel.Processor processor)
public String getName()
getName
in interface RequestConsumer
public ca.uhn.fhir.context.FhirContext getFhirContext()
getFhirContext
in interface RequestConsumer
protected void doStart() throws Exception
doStart
in class org.apache.camel.impl.DefaultConsumer
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.impl.DefaultConsumer
Exception
public FhirEndpoint<AuditDatasetType,FhirComponent<AuditDatasetType>> getEndpoint()
getEndpoint
in interface org.apache.camel.EndpointAware
getEndpoint
in class org.apache.camel.impl.DefaultConsumer
public final <R extends org.hl7.fhir.instance.model.api.IBaseResource> R handleResourceRequest(Object payload, Map<String,Object> headers, Class<R> resultClass)
IResourceProvider
objects to send the received
(and potentially handled) request further down a Camel route.handleResourceRequest
in interface RequestConsumer
R
- Resource type being returnedpayload
- FHIR request contentheaders
- headersresultClass
- class of the result resourcepublic <R extends org.hl7.fhir.instance.model.api.IBaseResource> List<R> handleBundleRequest(Object payload, Map<String,Object> headers)
RequestConsumer
If RequestConsumer.supportsLazyLoading()
returns true, the headers may contain Constants.FHIR_FROM_INDEX
and Constants.FHIR_TO_INDEX
entries,
indicating that only a part of the result is requested. Implementations must return only the requested entries.
handleBundleRequest
in interface RequestConsumer
R
- resource typepayload
- request payloadheaders
- request parameters, e.g. search parameterspublic ca.uhn.fhir.rest.api.server.IBundleProvider handleBundleProviderRequest(Object payload, Map<String,Object> headers)
RequestConsumer
RequestConsumer.handleBundleRequest(Object, Map)
as required.handleBundleProviderRequest
in interface RequestConsumer
payload
- request payloadheaders
- request parameters, e.g. search parameterspublic <T extends org.hl7.fhir.instance.model.api.IBaseBundle> T handleTransactionRequest(Object payload, Map<String,Object> headers, Class<T> bundleClass)
RequestConsumer
handleTransactionRequest
in interface RequestConsumer
payload
- request payloadheaders
- request parameterspublic ca.uhn.fhir.rest.api.MethodOutcome handleAction(Object payload, Map<String,Object> headers)
RequestConsumer
handleAction
in interface RequestConsumer
payload
- request payloadheaders
- request parameters, e.g. search parameterspublic int handleSizeRequest(Object payload, Map<String,Object> headers)
RequestConsumer
Constants.FHIR_REQUEST_SIZE_ONLY
entry flag.
This method only needs to be implemented is RequestConsumer.supportsLazyLoading()
returns true.handleSizeRequest
in interface RequestConsumer
payload
- request payloadheaders
- request parameterspublic boolean supportsLazyLoading()
supportsLazyLoading
in interface RequestConsumer
protected <T> T handleInRoute(Object payload, Map<String,Object> headers, Class<T> resultClass)
payload
- request payload, will become the Camel message bodyheaders
- request parameters, will be added to the Camel headersresultClass
- expected body type to be returnedprotected ca.uhn.fhir.rest.api.server.IBundleProvider getBundleProvider(Object payload, Map<String,Object> headers)
IBundleProvider
, providing the matching bundles.
Depending on FhirEndpointConfiguration.isLazyLoadBundles()
, the bundle provider either eagerly fetches all
matching bundles or fetches the requested subset on request.payload
- request payloadheaders
- request headersCopyright © 2018 Open eHealth Foundation. All rights reserved.