FhirResource
Reads and writes FHIR R4 resources under the configured FHIR path.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.24+fa54770
public final class FhirResourceReads and writes FHIR R4 resources under the configured FHIR path. Get it from Ovok.fhir().
Methods
read
public JsonNode read(String resourceType, String id) throws IOException, InterruptedExceptionReads one resource (GET /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource type, such asPatientid: the resource id
Returns: the resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public JsonNode read(
String resourceType,
String id,
RequestOptions options) throws IOException, InterruptedExceptionReads one resource (GET /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource type, such asPatientid: the resource idoptions: per-request options, such as the timeout
Returns: the resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
search
public Page<JsonNode> search(
String resourceType,
Map<String, ?> parameters) throws IOException, InterruptedExceptionSearches resources of one type (GET /fhir/{resourceType}?...); iterating the page follows the bundle's next links.
Parameters:
resourceType: the FHIR resource type, such asObservationparameters: FHIR search parameters
Returns: the matching resources, without included or outcome entries
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public Page<JsonNode> search(String resourceType) throws IOException, InterruptedExceptionSearches all resources of one type (GET /fhir/{resourceType}).
Parameters:
resourceType: the FHIR resource type, such asObservation
Returns: the matching resources, without included or outcome entries
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public Page<JsonNode> search(
String resourceType,
Map<String, ?> parameters,
RequestOptions options) throws IOException, InterruptedExceptionSearches resources of one type (GET /fhir/{resourceType}?...); iterating the page follows the bundle's next links.
Parameters:
resourceType: the FHIR resource type, such asObservationparameters: FHIR search parametersoptions: per-request options, such as the timeout
Returns: the matching resources, without included or outcome entries
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
searchOne
public JsonNode searchOne(
String resourceType,
Map<String, ?> parameters) throws IOException, InterruptedExceptionReturns the first resource matching a search, requested with _count=1.
Parameters:
resourceType: the FHIR resource type, such asPatientparameters: FHIR search parameters
Returns: the first match, or null when nothing matches
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public JsonNode searchOne(String resourceType) throws IOException, InterruptedExceptionReturns the first resource of one type, requested with _count=1.
Parameters:
resourceType: the FHIR resource type, such asPatient
Returns: the first match, or null when there is none
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public JsonNode searchOne(
String resourceType,
Map<String, ?> parameters,
RequestOptions options) throws IOException, InterruptedExceptionReturns the first resource matching a search, requested with _count=1.
Parameters:
resourceType: the FHIR resource type, such asPatientparameters: FHIR search parametersoptions: per-request options, such as the timeout
Returns: the first match, or null when nothing matches
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
create
public JsonNode create(JsonNode resource) throws IOException, InterruptedExceptionCreates a resource (POST /fhir/{resourceType}).
Parameters:
resource: the resource to create; it must haveresourceType
Returns: the created resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokValidationException: if the resource has noresourceType
public JsonNode create(
JsonNode resource,
String ifNoneExist) throws IOException, InterruptedExceptionCreates a resource unless one matches the If-None-Exist search (POST /fhir/{resourceType}).
Parameters:
resource: the resource to create; it must haveresourceTypeifNoneExist: the conditional-create search, such asidentifier=x|y, ornull
Returns: the created or matching resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokValidationException: if the resource has noresourceType
public JsonNode create(
JsonNode resource,
String ifNoneExist,
RequestOptions options) throws IOException, InterruptedExceptionCreates a resource unless one matches the If-None-Exist search (POST /fhir/{resourceType}).
Parameters:
resource: the resource to create; it must haveresourceTypeifNoneExist: the conditional-create search, such asidentifier=x|y, ornulloptions: per-request options, such as the timeout
Returns: the created or matching resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokValidationException: if the resource has noresourceType
update
public JsonNode update(JsonNode resource) throws IOException, InterruptedExceptionReplaces a resource (PUT /fhir/{resourceType}/{id}).
Parameters:
resource: the full resource; it must haveresourceTypeandid
Returns: the updated resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokValidationException: if the resource has noresourceTypeorid
public JsonNode update(
JsonNode resource,
RequestOptions options) throws IOException, InterruptedExceptionReplaces a resource (PUT /fhir/{resourceType}/{id}).
Parameters:
resource: the full resource; it must haveresourceTypeandidoptions: per-request options, such as the timeout
Returns: the updated resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the responseOvokValidationException: if the resource has noresourceTypeorid
patch
public JsonNode patch(
String resourceType,
String id,
List<? extends Map<String, ?>> operations,
RequestOptions options) throws IOException, InterruptedExceptionApplies a JSON Patch to a resource (PATCH /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource typeid: the resource idoperations: the JSON Patch operations, such as{op: replace, path: /status, value: final}options: per-request options, such as the timeout
Returns: the patched resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public JsonNode patch(
String resourceType,
String id,
List<? extends Map<String, ?>> operations) throws IOException, InterruptedExceptionApplies a JSON Patch to a resource (PATCH /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource typeid: the resource idoperations: the JSON Patch operations
Returns: the patched resource
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
delete
public void delete(String resourceType, String id) throws IOException, InterruptedExceptionDeletes a resource (DELETE /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource typeid: the resource id
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public void delete(
String resourceType,
String id,
RequestOptions options) throws IOException, InterruptedExceptionDeletes a resource (DELETE /fhir/{resourceType}/{id}).
Parameters:
resourceType: the FHIR resource typeid: the resource idoptions: per-request options, such as the timeout
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
batch
public JsonNode batch(JsonNode bundle) throws IOException, InterruptedExceptionRuns a batch or transaction bundle (POST /fhir).
Parameters:
bundle: aBundleof typebatchortransaction
Returns: the response bundle
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
public JsonNode batch(
JsonNode bundle,
RequestOptions options) throws IOException, InterruptedExceptionRuns a batch or transaction bundle (POST /fhir).
Parameters:
bundle: aBundleof typebatchortransactionoptions: per-request options, such as the timeout
Returns: the response bundle
Throws:
IOException: if the request cannot be sent or the response cannot be readInterruptedException: if the thread is interrupted while waiting for the response
Last updated on