Class FHIRClientImpl

  • All Implemented Interfaces:
    FHIRClient

    public class FHIRClientImpl
    extends Object
    implements FHIRClient
    Provides an implementation of the FHIRClient interface, which can be used as a high-level API for invoking FHIR REST APIs.
    • Method Detail

      • metadata

        public FHIRResponse metadata​(FHIRRequestHeader... headers)
                              throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'metadata' FHIR REST API operation.
        Specified by:
        metadata in interface FHIRClient
        Parameters:
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains a Conformance object which describes the FHIR Server's capabilities
        Throws:
        Exception
      • create

        public FHIRResponse create​(Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'create' FHIR REST API operation.
        Specified by:
        create in interface FHIRClient
        Parameters:
        resource - the FHIR resource to be created
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'create' operation
        Throws:
        Exception
      • create

        public FHIRResponse create​(jakarta.json.JsonObject resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'create' FHIR REST API operation.
        Specified by:
        create in interface FHIRClient
        Parameters:
        resource - the resource (in the form of a JsonObject) to be created
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'create' operation
        Throws:
        Exception
      • conditionalCreate

        public FHIRResponse conditionalCreate​(Resource resource,
                                              FHIRParameters parameters,
                                              FHIRRequestHeader... headers)
                                       throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'conditional create' FHIR REST API operation.
        Specified by:
        conditionalCreate in interface FHIRClient
        Parameters:
        resource - the FHIR resource to be created
        parameters - search-related query parameters to be included in the request
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'conditional create' operation
        Throws:
        Exception
      • conditionalCreate

        public FHIRResponse conditionalCreate​(jakarta.json.JsonObject resource,
                                              FHIRParameters parameters,
                                              FHIRRequestHeader... headers)
                                       throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'conditional create' FHIR REST API operation.
        Specified by:
        conditionalCreate in interface FHIRClient
        Parameters:
        resource - the resource (in the form of a JsonObject) to be created
        parameters - search-related query parameters to be included in the request
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'conditional create' operation
        Throws:
        Exception
      • update

        public FHIRResponse update​(Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'update' FHIR REST API operation.
        Specified by:
        update in interface FHIRClient
        Parameters:
        resource - the FHIR resource to be updated
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'update' operation
        Throws:
        Exception
      • update

        public FHIRResponse update​(jakarta.json.JsonObject resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'update' FHIR REST API operation.
        Specified by:
        update in interface FHIRClient
        Parameters:
        resource - the resource (in the form of a JsonObject) to be updated
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'update' operation
        Throws:
        Exception
      • conditionalUpdate

        public FHIRResponse conditionalUpdate​(Resource resource,
                                              FHIRParameters parameters,
                                              FHIRRequestHeader... headers)
                                       throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'conditional update' FHIR REST API operation.
        Specified by:
        conditionalUpdate in interface FHIRClient
        Parameters:
        resource - the FHIR resource to be created
        parameters - search-related query parameters to be included in the request
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'conditional update' operation
        Throws:
        Exception
      • conditionalUpdate

        public FHIRResponse conditionalUpdate​(jakarta.json.JsonObject resource,
                                              FHIRParameters parameters,
                                              FHIRRequestHeader... headers)
                                       throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'conditional update' FHIR REST API operation.
        Specified by:
        conditionalUpdate in interface FHIRClient
        Parameters:
        resource - the resource (in the form of a JsonObject) to be updated
        parameters - search-related query parameters to be included in the request
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'conditional update' operation
        Throws:
        Exception
      • delete

        public FHIRResponse delete​(String resourceType,
                                   String resourceId,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'delete' FHIR REST API operation.
        Specified by:
        delete in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to be deleted (e.g. "Patient")
        resourceId - the id of the resource to be deleted
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'delete' operation
        Throws:
        Exception
      • conditionalDelete

        public FHIRResponse conditionalDelete​(String resourceType,
                                              FHIRParameters parameters,
                                              FHIRRequestHeader... headers)
                                       throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'conditional delete' FHIR REST API operation.
        Specified by:
        conditionalDelete in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to be deleted (e.g. "Patient")
        parameters - search-related query parameters to be included in the request
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'delete' operation
        Throws:
        Exception
      • read

        public FHIRResponse read​(String resourceType,
                                 String resourceId,
                                 FHIRRequestHeader... headers)
                          throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'read' FHIR REST API operation.
        Specified by:
        read in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to be retrieved (e.g. "Patient")
        resourceId - the id of the resource to be retrieved
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'read' operation
        Throws:
        Exception
      • vread

        public FHIRResponse vread​(String resourceType,
                                  String resourceId,
                                  String versionId,
                                  FHIRRequestHeader... headers)
                           throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'vread' FHIR REST API operation.
        Specified by:
        vread in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to be retrieved (e.g. "Patient")
        resourceId - the id of the resource to be retrieved
        versionId - the version id of the resource to be retrieved
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'read' operation
        Throws:
        Exception
      • history

        public FHIRResponse history​(String resourceType,
                                    String resourceId,
                                    FHIRParameters parameters,
                                    FHIRRequestHeader... headers)
                             throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'history' FHIR REST API operation.
        Specified by:
        history in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to be retrieved (e.g. "Patient")
        resourceId - the id of the resource to be retrieved
        parameters - an optional collection of request parameters for the 'history' operation; may be specified as null if no parameters need to be passed to the 'history' operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'history' operation
        Throws:
        Exception
      • history

        public FHIRResponse history​(FHIRParameters parameters,
                                    FHIRRequestHeader... headers)
                             throws Exception
        Description copied from interface: FHIRClient
        Invokes system level history FHIR REST API operation
        Specified by:
        history in interface FHIRClient
        Parameters:
        parameters - an optional collection of request parameters for the 'history' operation; may be specified as null if no parameters need to be passed to the 'history' operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'history' operation
        Throws:
        Exception
      • search

        public FHIRResponse search​(String resourceType,
                                   FHIRParameters parameters,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'search' FHIR REST API operation.
        Specified by:
        search in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to search for (e.g. "Patient")
        parameters - an optional collection of request parameters for the 'search' operation; may be specified as null if no parameters need to be passed to the 'search' operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'search' operation
        Throws:
        Exception
      • _search

        public FHIRResponse _search​(String resourceType,
                                    FHIRParameters parameters,
                                    FHIRRequestHeader... headers)
                             throws Exception
        Description copied from interface: FHIRClient
        Invokes the '_search' FHIR REST API operation.
        Specified by:
        _search in interface FHIRClient
        Parameters:
        resourceType - a string representing the name of the resource type to search for (e.g. "Patient")
        parameters - an optional collection of request parameters for the '_search' operation; may be specified as null if no parameters need to be passed to the '_search' operation; search parameters for this operation will go in the request body
        Returns:
        a FHIRResponse that contains the results of the '_search' operation
        Throws:
        Exception
      • searchAll

        public FHIRResponse searchAll​(FHIRParameters parameters,
                                      boolean isPost,
                                      FHIRRequestHeader... headers)
                               throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'search-all' FHIR REST API operation with HTTP POST.
        Specified by:
        searchAll in interface FHIRClient
        Parameters:
        parameters - an optional collection of request parameters for the 'search-all' operation; may be specified as null if no parameters need to be passed to the 'search' operation; for Post, search parameters for this operation will go in the request body as FORM parameters for Get, search parameters for this operation will go in the request url as parameters
        Returns:
        a FHIRResponse that contains the results of the 'search-all' operation
        Throws:
        Exception
      • validate

        public FHIRResponse validate​(Resource resource,
                                     FHIRRequestHeader... headers)
                              throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'validate' FHIR REST API operation.
        Specified by:
        validate in interface FHIRClient
        Parameters:
        resource - the resource to be validated
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'validate' operation
        Throws:
        Exception
      • validate

        public FHIRResponse validate​(jakarta.json.JsonObject resource,
                                     FHIRRequestHeader... headers)
                              throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'validate' FHIR REST API operation.
        Specified by:
        validate in interface FHIRClient
        Parameters:
        resource - the resource (in the form of a JsonObject) to be validated
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'validate' operation
        Throws:
        Exception
      • batch

        public FHIRResponse batch​(Bundle bundle,
                                  FHIRRequestHeader... headers)
                           throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'batch/transaction' FHIR REST API operation for a request bundle of type 'batch'.
        Specified by:
        batch in interface FHIRClient
        Parameters:
        bundle - the Bundle containing the individual requests
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'batch/transaction' operation
        Throws:
        Exception
      • transaction

        public FHIRResponse transaction​(Bundle bundle,
                                        FHIRRequestHeader... headers)
                                 throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'batch/transaction' FHIR REST API operation for a request bundle of type 'transaction'.
        Specified by:
        transaction in interface FHIRClient
        Parameters:
        bundle - the Bundle containing the individual requests
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'batch/transaction' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String operationName,
                                   FHIRParameters parameters,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        operationName - name of the operation to be performed
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String operationName,
                                   Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        operationName - name of the operation to be performed
        resource - the FHIR resource used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   FHIRParameters parameters,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        resource - the FHIR resource used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   String resourceId,
                                   FHIRParameters parameters,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        resourceId - the FHIR resource instance used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   String resourceId,
                                   Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        resourceId - the FHIR resource instance used in context for the operation
        resource - the FHIR resource used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   String resourceId,
                                   String versionId,
                                   FHIRParameters parameters,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        resourceId - the FHIR resource instance used in context for the operation
        versionId - version of the FHIR resource instance used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • invoke

        public FHIRResponse invoke​(String resourceType,
                                   String operationName,
                                   String resourceId,
                                   String versionId,
                                   Resource resource,
                                   FHIRRequestHeader... headers)
                            throws Exception
        Description copied from interface: FHIRClient
        Invokes the 'invoke' FHIR REST API operation.
        Specified by:
        invoke in interface FHIRClient
        Parameters:
        resourceType - the FHIR resource type used in context for the operation
        operationName - name of the operation to be performed
        resourceId - the FHIR resource instance used in context for the operation
        versionId - version of the FHIR resource instance used in context for the operation
        resource - the FHIR resource used in context for the operation
        headers - an optional list of request headers to be added to the request
        Returns:
        a FHIRResponse that contains the results of the 'invoke' operation
        Throws:
        Exception
      • getWebTarget

        public javax.ws.rs.client.WebTarget getWebTarget()
                                                  throws Exception
        Description copied from interface: FHIRClient
        Returns a JAX-RS 2.0 WebTarget object associated with the REST API endpoint.
        Specified by:
        getWebTarget in interface FHIRClient
        Returns:
        a WebTarget instance that can be used to invoke REST APIs.
        Throws:
        Exception
      • getWebTarget

        public javax.ws.rs.client.WebTarget getWebTarget​(String baseURL)
                                                  throws Exception
        Description copied from interface: FHIRClient
        Returns a JAX-RS 2.0 WebTarget object associated with a given REST API endpoint.
        Specified by:
        getWebTarget in interface FHIRClient
        Returns:
        a WebTarget instance that can be used to invoke REST APIs.
        Throws:
        Exception
      • setDefaultMimeType

        public void setDefaultMimeType​(String mimeType)
                                throws Exception
        Description copied from interface: FHIRClient
        Sets the default mime-type to be used by the FHIRClient interface when invoking REST API operations.
        Specified by:
        setDefaultMimeType in interface FHIRClient
        Parameters:
        mimeType - a string containing the mime-type (e.g. "application/fhir+json")
        Throws:
        Exception
      • setOAuth2AccessToken

        public void setOAuth2AccessToken​(String accessToken)
                                  throws Exception
        Description copied from interface: FHIRClient
        Sets the OAuth 2.0 access token to be used by the FHIRClient interface for authorization when invoking REST API operations.
        Specified by:
        setOAuth2AccessToken in interface FHIRClient
        Parameters:
        accessToken - a string containing the OAuth 2.0 access token
        Throws:
        Exception
      • getOAuth2AccessToken

        public String getOAuth2AccessToken()
                                    throws Exception
        Description copied from interface: FHIRClient
        Returns a string that represents the OAuth 2.0 access token to be used by the FHIRClient interface for authorization requests.
        Specified by:
        getOAuth2AccessToken in interface FHIRClient
        Throws:
        Exception
      • getTrustStore

        public KeyStore getTrustStore()
        Description copied from interface: FHIRClient
        Allow the client consumer to be able to get and reuse the same TrustStore if necessary.
        Specified by:
        getTrustStore in interface FHIRClient
      • getKeyStoreLocation

        public String getKeyStoreLocation()
      • setKeyStoreLocation

        public void setKeyStoreLocation​(String keyStoreLocation)
      • getKeyStorePassword

        public String getKeyStorePassword()
      • setKeyStorePassword

        public void setKeyStorePassword​(String keyStorePassword)
      • getKeyStoreKeyPassword

        public String getKeyStoreKeyPassword()
      • setKeyStoreKeyPassword

        public void setKeyStoreKeyPassword​(String keyStoreKeyPassword)
      • isLoggingEnabled

        public boolean isLoggingEnabled()
      • setLoggingEnabled

        public void setLoggingEnabled​(boolean loggingEnabled)
      • isHostnameVerificationEnabled

        public boolean isHostnameVerificationEnabled()
      • setHostnameVerificationEnabled

        public void setHostnameVerificationEnabled​(boolean hostnameVerficationEnabled)
      • getHttpTimeout

        public int getHttpTimeout()
      • setHttpTimeout

        public void setHttpTimeout​(int httpTimeout)