Package org.hl7.fhir.dstu3.utils.client
Class FHIRToolingClient
- java.lang.Object
-
- org.hl7.fhir.dstu3.utils.client.FHIRToolingClient
-
public class FHIRToolingClient extends Object
Very Simple RESTful client. This is purely for use in the standalone tools jar packages. It doesn't support many features, only what the tools need.To use, initialize class and set base service URI as follows:
FHIRSimpleClient fhirClient = new FHIRSimpleClient(); fhirClient.initialize("http://my.fhir.domain/myServiceRoot");Default Accept and Content-Type headers are application/fhir+xml and application/fhir+json.
These can be changed by invoking the following setter functions:
setPreferredResourceFormat() setPreferredFeedFormat()TODO Review all sad paths.
- Author:
- Claude Nanjo
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATE_FORMATstatic StringDATETIME_FORMATstatic StringhostKeystatic StringportKey
-
Constructor Summary
Constructors Constructor Description FHIRToolingClient(String baseServiceUrl, String userAgent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbasicAuthHeaderExists()ValueSetexpandValueset(ValueSet source, ExpansionProfile profile, Map<String,String> params)ValueSetexpandValueset(ValueSet source, Parameters expParams)ValueSetexpandValueset(ValueSet source, Parameters expParams, Map<String,String> params)BundlefetchFeed(String url)org.hl7.fhir.utilities.FhirPublicationgetActualVersion()StringgetAddress()EnumSet<org.hl7.fhir.utilities.FhirPublication>getAllowedVersions()okhttp3.internal.http2.HeadergetAuthorizationHeader()<T extends Resource>
TgetCanonical(Class<T> resourceClass, String canonicalURL)CapabilityStatementgetCapabilitiesStatement()CapabilityStatementgetCapabilitiesStatementQuick()ClientgetClient()org.hl7.fhir.utilities.ToolingClientLoggergetLogger()intgetMaximumRecordCount()StringgetPassword()StringgetPreferredResourceFormat()intgetRetryCount()StringgetServerVersion()ParametersgetTerminologyCapabilities()longgetTimeout()StringgetUserAgent()StringgetUsername()protected voidhandleException(String message, Exception e)Helper method to prevent nesting of previously thrown EFhirClientExceptionsvoidinitialize(String baseServiceUrl)ConceptMapinitializeClosure(String name)protected booleanisJson(String format)Helper method to determine whether desired resource representation is Json or XML.ParameterslookupCode(Map<String,String> params)<T extends Resource>
ParametersoperateType(Class<T> resourceClass, String name, Parameters params)<T extends Resource>
Tread(Class<T> resourceClass, String id)voidsetAllowedVersions(EnumSet<org.hl7.fhir.utilities.FhirPublication> versions)voidsetClient(Client client)voidsetClientHeaders(ArrayList<okhttp3.internal.http2.Header> headers)voidsetLogger(org.hl7.fhir.utilities.ToolingClientLogger logger)voidsetMaximumRecordCount(int maxResultSetSize)voidsetPassword(String password)voidsetPreferredResourceFormat(ResourceFormat resourceFormat)voidsetRetryCount(int retryCount)voidsetTimeout(long timeout)voidsetUserAgent(String userAgent)voidsetUsername(String username)EnumSet<org.hl7.fhir.utilities.FhirPublication>supportableVersions()Bundletransaction(Bundle batch)<T extends Resource>
Tupdate(Class<T> resourceClass, T resource, String id)Resourceupdate(Resource resource)ConceptMapupdateClosure(String name, Coding coding)<T extends Resource>
OperationOutcomevalidate(Class<T> resourceClass, T resource, String id)<T extends Resource>
Tvread(Class<T> resourceClass, String id, String version)
-
-
-
Field Detail
-
DATETIME_FORMAT
public static final String DATETIME_FORMAT
- See Also:
- Constant Field Values
-
DATE_FORMAT
public static final String DATE_FORMAT
- See Also:
- Constant Field Values
-
hostKey
public static final String hostKey
- See Also:
- Constant Field Values
-
portKey
public static final String portKey
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FHIRToolingClient
public FHIRToolingClient(String baseServiceUrl, String userAgent) throws URISyntaxException
- Throws:
URISyntaxException
-
-
Method Detail
-
initialize
public void initialize(String baseServiceUrl) throws URISyntaxException
- Throws:
URISyntaxException
-
supportableVersions
public EnumSet<org.hl7.fhir.utilities.FhirPublication> supportableVersions()
-
setAllowedVersions
public void setAllowedVersions(EnumSet<org.hl7.fhir.utilities.FhirPublication> versions)
-
getAllowedVersions
public EnumSet<org.hl7.fhir.utilities.FhirPublication> getAllowedVersions()
-
getActualVersion
public org.hl7.fhir.utilities.FhirPublication getActualVersion()
-
getPreferredResourceFormat
public String getPreferredResourceFormat()
-
setPreferredResourceFormat
public void setPreferredResourceFormat(ResourceFormat resourceFormat)
-
getMaximumRecordCount
public int getMaximumRecordCount()
-
setMaximumRecordCount
public void setMaximumRecordCount(int maxResultSetSize)
-
getTerminologyCapabilities
public Parameters getTerminologyCapabilities()
-
getCapabilitiesStatement
public CapabilityStatement getCapabilitiesStatement()
-
getCapabilitiesStatementQuick
public CapabilityStatement getCapabilitiesStatementQuick() throws EFhirClientException
- Throws:
EFhirClientException
-
getCanonical
public <T extends Resource> T getCanonical(Class<T> resourceClass, String canonicalURL)
-
operateType
public <T extends Resource> Parameters operateType(Class<T> resourceClass, String name, Parameters params)
-
transaction
public Bundle transaction(Bundle batch)
-
validate
public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id)
-
handleException
protected void handleException(String message, Exception e) throws EFhirClientException
Helper method to prevent nesting of previously thrown EFhirClientExceptions- Parameters:
e-- Throws:
EFhirClientException
-
isJson
protected boolean isJson(String format)
Helper method to determine whether desired resource representation is Json or XML.- Parameters:
format-- Returns:
-
expandValueset
public ValueSet expandValueset(ValueSet source, Parameters expParams)
-
lookupCode
public Parameters lookupCode(Map<String,String> params)
-
expandValueset
public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String,String> params)
-
expandValueset
public ValueSet expandValueset(ValueSet source, Parameters expParams, Map<String,String> params)
-
getAddress
public String getAddress()
-
initializeClosure
public ConceptMap initializeClosure(String name)
-
updateClosure
public ConceptMap updateClosure(String name, Coding coding)
-
getUsername
public String getUsername()
-
setUsername
public void setUsername(String username)
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
-
getTimeout
public long getTimeout()
-
setTimeout
public void setTimeout(long timeout)
-
getLogger
public org.hl7.fhir.utilities.ToolingClientLogger getLogger()
-
setLogger
public void setLogger(org.hl7.fhir.utilities.ToolingClientLogger logger)
-
getRetryCount
public int getRetryCount()
-
setRetryCount
public void setRetryCount(int retryCount)
-
setClientHeaders
public void setClientHeaders(ArrayList<okhttp3.internal.http2.Header> headers)
-
basicAuthHeaderExists
public boolean basicAuthHeaderExists()
-
getAuthorizationHeader
public okhttp3.internal.http2.Header getAuthorizationHeader()
-
getUserAgent
public String getUserAgent()
-
setUserAgent
public void setUserAgent(String userAgent)
-
getServerVersion
public String getServerVersion()
-
-