Class AdminJsonRestClient

java.lang.Object
ca.cdr.test.app.clients.AdminJsonRestClient

public class AdminJsonRestClient extends Object
AdminJsonRestClient is a client for the Admin API of the CDR. It currently supports anonymous and http-basic authentication.
  • Method Details

    • build

      public static AdminJsonRestClient build(String theBaseUrl, String theUsername, String thePassword)
    • buildAnonymous

      public static AdminJsonRestClient buildAnonymous(String theBaseUrl)
    • userCreate

      @Nonnull public UserDetailsJson userCreate(String theNode, String theModuleId, UserDetailsJson userDetails)
    • userUpdate

      @Nonnull public UserDetailsJson userUpdate(UserDetailsJson theUserDetails)
    • userFindByUsername

      @Nonnull public com.fasterxml.jackson.databind.JsonNode userFindByUsername(String theNodeId, String theModuleId, String theUsername)
    • userFindByUsernameAsString

      @Nonnull public String userFindByUsernameAsString(String theNodeId, String theModuleId, String theUsername)
      Find users by username and return the result as a String that can be used with ObjectMapper
      Parameters:
      theNodeId - The node ID
      theModuleId - The module ID
      theUsername - The username to search for
      Returns:
      The JSON string representation of the result
    • userFindAll

      @Nonnull public com.fasterxml.jackson.databind.JsonNode userFindAll(String theNodeId, String theModuleId, int thePageSize)
    • userFindAllAsString

      @Nonnull public String userFindAllAsString(String theNodeId, String theModuleId, int thePageSize)
      Find all users and return the result as a String that can be used with ObjectMapper
      Parameters:
      theNodeId - The node ID
      theModuleId - The module ID
      thePageSize - The page size
      Returns:
      The JSON string representation of the result
    • userFetchByPid

      @Nonnull public UserDetailsJson userFetchByPid(String theNodeId, String theModuleId, Long thePid)
    • getModuleConfig

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getModuleConfig(String theNodeId, String theModuleId)
      Get the module configuration for a specific node and module
    • updateModuleConfig

      @Nonnull public com.fasterxml.jackson.databind.JsonNode updateModuleConfig(String theNodeId, String theModuleId, com.fasterxml.jackson.databind.JsonNode theOptions, boolean theRestart, boolean theReload)
      Update the configuration for a specific module
    • stopModule

      @Nonnull public com.fasterxml.jackson.databind.JsonNode stopModule(String theNodeId, String theModuleId)
      Request to stop a module on all processes ModuleProcessesStatusChangeResponseJson
    • restartModule

      @Nonnull public com.fasterxml.jackson.databind.JsonNode restartModule(String theNodeId, String theModuleId)
      Request to restart a module on all processes
    • getRestorePoints

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getRestorePoints(String theNodeId, String theVersion, String theFromDate, String theToDate, int theOffset, int theCount)
      Get a list of restore points for a node
    • getRestorePoint

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getRestorePoint(String theNodeId, Long theId)
      Get a specific restore point
    • restoreSystem

      public void restoreSystem(String theNodeId, Long theRestorePointId)
      Restore the system to a specific restore point
    • getHealthChecks

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getHealthChecks(boolean theOnlyRunning)
      Get health checks for all modules
    • getNodeStatuses

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getNodeStatuses()
      Get node statuses
    • cancelBatchJob

      public void cancelBatchJob(String theModuleId, String theJobId)
      Cancel a batch job
    • processBulkImport

      public String processBulkImport(String theModuleId, String theFilename, String theContent)
      Process a bulk ETL import file
    • getTransactionLogs

      Get transaction logs
    • getTransactionLogEvent

      @Nonnull public TransactionLogEventsJson.TransactionLogEventJson getTransactionLogEvent(Long theEventId, boolean theIncludeBody)
      Get a specific transaction log event with its body
    • createOAuthClient

      @Nonnull public OAuth2ClientDetailsJson createOAuthClient(String theNodeId, String theModuleId, OAuth2WritableClientDetailsJson theClientDetails)
      Create an OAuth client for a specific module
    • updateOAuthClient

      @Nonnull public OAuth2ClientDetailsJson updateOAuthClient(String theNodeId, String theModuleId, String theClientId, OAuth2WritableClientDetailsJson theClientDetails)
      Update an OAuth client for a specific module
    • deleteOAuthClient

      public void deleteOAuthClient(String theNodeId, String theModuleId, String theClientId)
      Delete an OAuth client
    • getOAuthClient

      @Nonnull public OAuth2ClientDetailsJson getOAuthClient(String theNodeId, String theModuleId, String theClientId)
      Get an OAuth client
    • createOidcServer

      @Nonnull public com.fasterxml.jackson.databind.JsonNode createOidcServer(String theNodeId, String theModuleId, com.fasterxml.jackson.databind.JsonNode theServerDetails)
      Create an OIDC server for a specific module
    • getOidcServer

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getOidcServer(String theNodeId, String theModuleId, String theServerId)
      Get an OIDC server
    • updateOidcServer

      @Nonnull public com.fasterxml.jackson.databind.JsonNode updateOidcServer(String theNodeId, String theModuleId, String theServerId, com.fasterxml.jackson.databind.JsonNode theServerDetails)
      Update an OIDC server
    • getMdmLinks

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getMdmLinks(String theModuleId)
      Get MDM links
    • mergeMdmGoldenResources

      @Nonnull public com.fasterxml.jackson.databind.JsonNode mergeMdmGoldenResources(String theModuleId, Object theRequest)
      Merge MDM golden resources
    • updateMdmLink

      @Nonnull public com.fasterxml.jackson.databind.JsonNode updateMdmLink(String theModuleId, Object theRequest)
      Update MDM link
    • getMdmDuplicateGoldenResources

      @Nonnull public com.fasterxml.jackson.databind.JsonNode getMdmDuplicateGoldenResources(String theModuleId)
      Get MDM duplicate golden resources
    • submitMdmOperation

      @Nonnull public String submitMdmOperation(String theModuleId, IBaseParameters theParameters)
      Submit an MDM operation to perform batch matching on all resources
      Parameters:
      theModuleId - The module ID
      theParameters - The parameters for the MDM operation
      Returns:
      The response as a String
    • toJsonString

      public static String toJsonString(IBaseResource theResource)
    • getNodeConfigurations

      Get the node configurations from the admin API.
      Returns:
      The node configurations
    • getPortFromModule

      public int getPortFromModule(String theModuleId)
      Get the port number for a specific module from the node configurations.
      Parameters:
      theModuleId - The ID of the module to get the port for
      Returns:
      The port number, or the default FHIR port (8000) if not found
    • convertJsonNodeToModel

      public <T> T convertJsonNodeToModel(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> modelClass) throws com.fasterxml.jackson.core.JsonProcessingException
      Since many methods currently return JsonNode, if you have a known model you would like to bind to, you can convert a json object to it using this method
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • convertModelToJsonNode

      public <T> com.fasterxml.jackson.databind.JsonNode convertModelToJsonNode(T model) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException