public class GenericClient extends BaseClient implements IGenericClient
BaseClient.ResourceResponseHandler<T extends IBaseResource>| Constructor and Description |
|---|
GenericClient(FhirContext theContext,
org.apache.http.client.HttpClient theHttpClient,
String theServerBase,
RestfulClientFactory theFactory)
For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
|
| Modifier and Type | Method and Description |
|---|---|
BaseConformance |
conformance()
Retrieves and returns the server conformance statement
|
ICreate |
create()
Fluent method for the "create" operation, which creates a new resource instance on the server
|
MethodOutcome |
create(IBaseResource theResource)
Implementation of the "type create" method.
|
IDelete |
delete()
Fluent method for the "delete" operation, which performs a logical delete on a server resource
|
MethodOutcome |
delete(Class<? extends IBaseResource> theType,
IdDt theId)
Implementation of the "delete instance" method.
|
MethodOutcome |
delete(Class<? extends IBaseResource> theType,
String theId)
Implementation of the "delete instance" method.
|
IFetchConformanceUntyped |
fetchConformance()
Retrieves the server's conformance statement
|
void |
forceConformanceCheck()
Force the client to fetch the server's conformance statement and validate that it is appropriate for this client.
|
FhirContext |
getFhirContext()
Returns the FHIR context associated with this client
|
org.apache.http.client.methods.HttpRequestBase |
getLastRequest() |
protected String |
getPreferredId(IBaseResource theResource,
String theId) |
IGetTags |
getTags()
Fluent method for the "get tags" operation
|
IHistory |
history()
Implementation of the "history" method
|
<T extends IBaseResource> |
history(Class<T> theType,
IdDt theIdDt,
DateTimeDt theSince,
Integer theLimit)
Implementation of the "history instance" method.
|
<T extends IBaseResource> |
history(Class<T> theType,
String theId,
DateTimeDt theSince,
Integer theLimit)
Implementation of the "history instance" method.
|
boolean |
isLogRequestAndResponse() |
IGetPage |
loadPage()
Loads the previous/next bundle of resources from a paged set, using the link specified in the "link type=next" tag within the atom bundle.
|
IMeta |
meta()
Fluent method for the "meta" operations, which can be used to get, add and remove tags and other
Meta elements from a resource or across the server.
|
IOperation |
operation()
Implementation of the FHIR "extended operations" action
|
IRead |
read()
Fluent method for "read" and "vread" methods.
|
<T extends IBaseResource> |
read(Class<T> theType,
String theId)
Implementation of the "instance read" method.
|
<T extends IBaseResource> |
read(Class<T> theType,
UriDt theUrl)
Perform the "read" operation (retrieve the latest version of a resource instance by ID) using an absolute URL.
|
IBaseResource |
read(UriDt theUrl)
Perform the "read" operation (retrieve the latest version of a resource instance by ID) using an absolute URL.
|
IUntypedQuery |
search()
Search for resources matching a given set of criteria.
|
<T extends IBaseResource> |
search(Class<T> theType,
Map<String,List<IQueryParameterType>> theParams)
Implementation of the "instance search" method.
|
<T extends IBaseResource> |
search(Class<T> theType,
UriDt theUrl)
Perform the "search" operation using an absolute URL.
|
Bundle |
search(UriDt theUrl) |
void |
setLastRequest(org.apache.http.client.methods.HttpRequestBase theLastRequest)
For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
|
void |
setLogRequestAndResponse(boolean theLogRequestAndResponse)
If set to
true, the client will log all requests and all responses. |
ITransaction |
transaction()
Send a transaction (collection of resources) to the server to be executed as a single unit
|
List<IBaseResource> |
transaction(List<IBaseResource> theResources)
Implementation of the "transaction" method.
|
IUpdate |
update()
Fluent method for the "update" operation, which performs a logical delete on a server resource
|
MethodOutcome |
update(IdDt theIdDt,
IBaseResource theResource)
Implementation of the "instance update" method.
|
MethodOutcome |
update(String theId,
IBaseResource theResource)
Implementation of the "instance update" method.
|
IValidate |
validate()
Validate a resource
|
MethodOutcome |
validate(IBaseResource theResource)
Implementation of the "type validate" method.
|
<T extends IBaseResource> |
vread(Class<T> theType,
IdDt theId)
Implementation of the "instance vread" method.
|
<T extends IBaseResource> |
vread(Class<T> theType,
IdDt theId,
IdDt theVersionId)
Deprecated.
|
<T extends IBaseResource> |
vread(Class<T> theType,
String theId,
String theVersionId)
Implementation of the "instance vread" method.
|
createExtraParams, createReaderFromResponse, fetchResourceFromUrl, getEncoding, getHttpClient, getInterceptors, getLastResponse, getLastResponseBody, getPrettyPrint, getServerBase, getSummary, getUrlBase, isKeepResponses, isPrettyPrint, registerInterceptor, setDontValidateConformance, setEncoding, setKeepResponses, setLastResponse, setLastResponseBody, setPrettyPrint, setSummary, unregisterInterceptorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitregisterInterceptor, unregisterInterceptorfetchResourceFromUrl, getHttpClient, getServerBase, setEncoding, setPrettyPrint, setSummarypublic GenericClient(FhirContext theContext, org.apache.http.client.HttpClient theHttpClient, String theServerBase, RestfulClientFactory theFactory)
public BaseConformance conformance()
IGenericClientconformance in interface IGenericClientpublic ICreate create()
IGenericClientcreate in interface IGenericClientpublic MethodOutcome create(IBaseResource theResource)
IGenericClientcreate in interface IGenericClienttheResource - The resource to createpublic IDelete delete()
IGenericClientdelete in interface IGenericClientpublic MethodOutcome delete(Class<? extends IBaseResource> theType, IdDt theId)
IGenericClientdelete in interface IGenericClienttheType - The type of resource to deletetheId - the ID of the resource to deletepublic MethodOutcome delete(Class<? extends IBaseResource> theType, String theId)
IGenericClientdelete in interface IGenericClienttheType - The type of resource to deletetheId - the ID of the resource to deletepublic IFetchConformanceUntyped fetchConformance()
IGenericClientfetchConformance in interface IGenericClientpublic void forceConformanceCheck()
IGenericClientforceConformanceCheck in interface IGenericClientpublic FhirContext getFhirContext()
IRestfulClientgetFhirContext in interface IRestfulClientpublic org.apache.http.client.methods.HttpRequestBase getLastRequest()
protected String getPreferredId(IBaseResource theResource, String theId)
public IGetTags getTags()
IGenericClientgetTags in interface IGenericClientpublic IHistory history()
IGenericClienthistory in interface IGenericClientpublic <T extends IBaseResource> Bundle history(Class<T> theType, IdDt theIdDt, DateTimeDt theSince, Integer theLimit)
IGenericClienthistory in interface IGenericClienttheType - The type of resource to return the history for, or null to search for history across all resourcestheIdDt - The ID of the resource to return the history for, or null to search for all resource instances. Note that if this param is not null, theType must also not
be nulltheSince - If not null, request that the server only return resources updated since this timetheLimit - If not null, request that the server return no more than this number of resources. Note that the server may return less even if more are available, but should not return more
according to the FHIR specification.public <T extends IBaseResource> Bundle history(Class<T> theType, String theId, DateTimeDt theSince, Integer theLimit)
IGenericClienthistory in interface IGenericClienttheType - The type of resource to return the history for, or null to search for history across all resourcestheId - The ID of the resource to return the history for, or null to search for all resource instances. Note that if this param is not null, theType must also not
be nulltheSince - If not null, request that the server only return resources updated since this timetheLimit - If not null, request that the server return no more than this number of resources. Note that the server may return less even if more are available, but should not return more
according to the FHIR specification.public boolean isLogRequestAndResponse()
public IGetPage loadPage()
IGenericClientloadPage in interface IGenericClientBundle.getLinkNext()public IMeta meta()
IGenericClientmeta in interface IGenericClientpublic IOperation operation()
IGenericClientoperation in interface IGenericClientpublic IRead read()
IGenericClientread in interface IGenericClientpublic <T extends IBaseResource> T read(Class<T> theType, String theId)
IGenericClientread in interface IGenericClienttheType - The type of resource to loadtheId - The ID to loadpublic <T extends IBaseResource> T read(Class<T> theType, UriDt theUrl)
IGenericClientread in interface IGenericClienttheType - The resource type that is being retrievedtheUrl - The absolute URL, e.g. "http://example.com/fhir/Patient/123"public IBaseResource read(UriDt theUrl)
IGenericClientread in interface IGenericClienttheUrl - The absolute URL, e.g. "http://example.com/fhir/Patient/123"public IUntypedQuery search()
IGenericClientsearch in interface IGenericClientpublic <T extends IBaseResource> Bundle search(Class<T> theType, Map<String,List<IQueryParameterType>> theParams)
IGenericClientsearch in interface IGenericClienttheType - The type of resource to loadpublic <T extends IBaseResource> Bundle search(Class<T> theType, UriDt theUrl)
IGenericClientsearch in interface IGenericClienttheType - The primary resource type that is being retrievedtheUrl - The absolute URL, e.g. "http://example.com/fhir/Patient/123"public Bundle search(UriDt theUrl)
search in interface IGenericClientpublic void setLastRequest(org.apache.http.client.methods.HttpRequestBase theLastRequest)
public void setLogRequestAndResponse(boolean theLogRequestAndResponse)
IGenericClienttrue, the client will log all requests and all responses. This is probably not a good production setting since it will result in a lot of extra logging, but it can be
useful for troubleshooting.setLogRequestAndResponse in interface IGenericClienttheLogRequestAndResponse - Should requests and responses be loggedpublic ITransaction transaction()
IGenericClienttransaction in interface IGenericClientpublic List<IBaseResource> transaction(List<IBaseResource> theResources)
IGenericClienttransaction in interface IGenericClienttheResources - The resources to create/update in a single transactionmetadatapublic IUpdate update()
IGenericClientupdate in interface IGenericClientpublic MethodOutcome update(IdDt theIdDt, IBaseResource theResource)
IGenericClientupdate in interface IGenericClienttheIdDt - The ID to updatetheResource - The new resource bodypublic MethodOutcome update(String theId, IBaseResource theResource)
IGenericClientupdate in interface IGenericClienttheId - The ID to updatetheResource - The new resource bodypublic IValidate validate()
IGenericClientvalidate in interface IGenericClientpublic MethodOutcome validate(IBaseResource theResource)
IGenericClientvalidate in interface IGenericClienttheResource - The resource to validatepublic <T extends IBaseResource> T vread(Class<T> theType, IdDt theId)
IGenericClienttheId to contain a resource ID as well as a version ID, and will fail if it does not.
Note that if an absolute resource ID is passed in (i.e. a URL containing a protocol and host as well as the resource type and ID) the server base for the client will be ignored, and the URL passed in will be queried.
vread in interface IGenericClienttheType - The type of resource to loadtheId - The ID to load, including the resource ID and the resource version ID. Valid values include "Patient/123/_history/222", or "http://example.com/fhir/Patient/123/_history/222"@Deprecated public <T extends IBaseResource> T vread(Class<T> theType, IdDt theId, IdDt theVersionId)
IGenericClientvread in interface IGenericClienttheType - The type of resource to loadtheId - The ID to loadtheVersionId - The version IDpublic <T extends IBaseResource> T vread(Class<T> theType, String theId, String theVersionId)
IGenericClientvread in interface IGenericClienttheType - The type of resource to loadtheId - The ID to loadtheVersionId - The version IDCopyright © 2014–2016 University Health Network. All rights reserved.