Package ca.cdr.test.app.clients
Class AdminJsonRestClient
java.lang.Object
ca.cdr.test.app.clients.AdminJsonRestClient
AdminJsonRestClient is a client for the Admin API of the CDR.
It currently supports anonymous and http-basic authentication.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when a forbidden operation is attempted -
Method Summary
Modifier and TypeMethodDescriptionvoidawaitNewTransactionLogEntry(Long theMostRecentTxLogEntryId) static AdminJsonRestClientstatic AdminJsonRestClientbuildAnonymous(String theBaseUrl) voidcancelBatchJob(String theModuleId, String theJobId) Cancel a batch job<T> TconvertJsonNodeToModel(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> modelClass) 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<T> com.fasterxml.jackson.databind.JsonNodeconvertModelToJsonNode(T model) createOAuthClient(String theNodeId, String theModuleId, OAuth2WritableClientDetailsJson theClientDetails) Create an OAuth client for a specific modulecom.fasterxml.jackson.databind.JsonNodecreateOidcServer(String theNodeId, String theModuleId, com.fasterxml.jackson.databind.JsonNode theServerDetails) Create an OIDC server for a specific modulevoiddeleteOAuthClient(String theNodeId, String theModuleId, String theClientId) Delete an OAuth clientcom.fasterxml.jackson.databind.JsonNodePerform a generic GET request to the specified path and return the response as JsonNodeString[]Get all module IDs that support batch jobscom.fasterxml.jackson.databind.JsonNodegetBatchJobInstance(String theModuleId, String theJobId) Get a specific batch job instance by IDcom.fasterxml.jackson.databind.JsonNodegetHealthChecks(boolean theOnlyRunning) Get health checks for all modulescom.fasterxml.jackson.databind.JsonNodegetMdmDuplicateGoldenResources(String theModuleId) Get MDM duplicate golden resourcescom.fasterxml.jackson.databind.JsonNodegetMdmLinks(String theModuleId) Get MDM linkscom.fasterxml.jackson.databind.JsonNodegetModuleConfig(String theNodeId, String theModuleId) Get the module configuration for a specific node and modulecom.fasterxml.jackson.databind.JsonNodegetModuleInterceptors(String theNodeId, String theModuleId) Get the node configurations from the admin API.com.fasterxml.jackson.databind.JsonNodeGet node statusesgetOAuthClient(String theNodeId, String theModuleId, String theClientId) Get an OAuth clientcom.fasterxml.jackson.databind.JsonNodegetOidcServer(String theNodeId, String theModuleId, String theServerId) Get an OIDC serverintgetPortFromModule(String theModuleId) Get the port number for a specific module from the node configurations.com.fasterxml.jackson.databind.JsonNodegetRestorePoint(String theNodeId, Long theId) Get a specific restore pointcom.fasterxml.jackson.databind.JsonNodegetRestorePoints(String theNodeId, String theVersion, String theFromDate, String theToDate, int theOffset, int theCount) Get a list of restore points for a nodegetTransactionLogEntryById(Long theId) Fetch a transaction log entry by ID and return all details (includes the body)getTransactionLogEvent(Long theEventId, boolean theIncludeBody) Get a specific transaction log event with its bodyGet transaction logscom.fasterxml.jackson.databind.JsonNodemergeMdmGoldenResources(String theModuleId, Object theRequest) Merge MDM golden resourcesprocessBulkImport(String theModuleId, String theFilename, String theContent) Process a bulk ETL import fileprocessBulkImport(String theModuleId, String theFilename, String theUserJobType, String theContent) Process a bulk ETL import filecom.fasterxml.jackson.databind.JsonNoderestartModule(String theNodeId, String theModuleId) Request to restart a module on all processesvoidrestoreSystem(String theNodeId, Long theRestorePointId) Restore the system to a specific restore pointcom.fasterxml.jackson.databind.JsonNodestopModule(String theNodeId, String theModuleId) Request to stop a module on all processes ModuleProcessesStatusChangeResponseJsonsubmitMdmOperation(String theModuleId, IBaseParameters theParameters) Submit an MDM operation to perform batch matching on all resourcesstatic StringtoJsonString(IBaseResource theResource) com.fasterxml.jackson.databind.JsonNodeupdateMdmLink(String theModuleId, Object theRequest) Update MDM linkcom.fasterxml.jackson.databind.JsonNodeupdateModuleConfig(String theNodeId, String theModuleId, com.fasterxml.jackson.databind.JsonNode theOptions, boolean theRestart, boolean theReload) Update the configuration for a specific moduleupdateOAuthClient(String theNodeId, String theModuleId, String theClientId, OAuth2WritableClientDetailsJson theClientDetails) Update an OAuth client for a specific modulecom.fasterxml.jackson.databind.JsonNodeupdateOidcServer(String theNodeId, String theModuleId, String theServerId, com.fasterxml.jackson.databind.JsonNode theServerDetails) Update an OIDC serveruserCreate(String theNode, String theModuleId, UserDetailsJson userDetails) userFetchByPid(String theNodeId, String theModuleId, Long thePid) com.fasterxml.jackson.databind.JsonNodeuserFindAll(String theNodeId, String theModuleId, int thePageSize) userFindAllAsString(String theNodeId, String theModuleId, int thePageSize) Find all users and return the result as a String that can be used with ObjectMappercom.fasterxml.jackson.databind.JsonNodeuserFindByUsername(String theNodeId, String theModuleId, String theUsername) userFindByUsernameAsString(String theNodeId, String theModuleId, String theUsername) Find users by username and return the result as a String that can be used with ObjectMapperuserUpdate(UserDetailsJson theUserDetails)
-
Method Details
-
build
-
buildAnonymous
-
userCreate
@Nonnull public UserDetailsJson userCreate(String theNode, String theModuleId, UserDetailsJson userDetails) -
userUpdate
-
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 IDtheModuleId- The module IDtheUsername- 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
Find all users and return the result as a String that can be used with ObjectMapper- Parameters:
theNodeId- The node IDtheModuleId- The module IDthePageSize- The page size- Returns:
- The JSON string representation of the result
-
userFetchByPid
-
getModuleConfig
@Nonnull public com.fasterxml.jackson.databind.JsonNode getModuleConfig(String theNodeId, String theModuleId) Get the module configuration for a specific node and module -
getModuleInterceptors
public com.fasterxml.jackson.databind.JsonNode getModuleInterceptors(String theNodeId, String theModuleId) -
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, @Nullable String theVersion, @Nullable String theFromDate, @Nullable 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
Restore the system to a specific restore point -
getHealthChecks
Get health checks for all modules -
getNodeStatuses
Get node statuses -
cancelBatchJob
Cancel a batch job -
getAllBatchJobModuleIds
Get all module IDs that support batch jobs -
getBatchJobInstance
@Nonnull public com.fasterxml.jackson.databind.JsonNode getBatchJobInstance(String theModuleId, String theJobId) Get a specific batch job instance by ID -
processBulkImport
public String processBulkImport(@Nonnull String theModuleId, @Nullable String theFilename, @Nonnull String theContent) Process a bulk ETL import file- Parameters:
theModuleId- the id of the etl module to targettheFilename- the optional filename as a hint for the import processtheContent- the body of the csv file to import- Returns:
- a json response
-
processBulkImport
public String processBulkImport(@Nonnull String theModuleId, @Nullable String theFilename, @Nullable String theUserJobType, @Nonnull String theContent) Process a bulk ETL import file- Parameters:
theModuleId- the id of the etl module to targettheFilename- the optional filename as a hint for the import processtheUserJobType- the optional job type to use for the import processtheContent- the body of the csv file to import- Returns:
- a json response
-
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
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
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
Submit an MDM operation to perform batch matching on all resources- Parameters:
theModuleId- The module IDtheParameters- The parameters for the MDM operation- Returns:
- The response as a String
-
toJsonString
-
getNodeConfigurations
Get the node configurations from the admin API.- Returns:
- The node configurations
-
getPortFromModule
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
-
getMostRecentTransactionLogEntry
@Nullable public TransactionLogEventsJson.TransactionLogEventJson getMostRecentTransactionLogEntry() -
getMostRecentTransactionLogEntryId
-
awaitNewTransactionLogEntry
-
getTransactionLogEntryById
Fetch a transaction log entry by ID and return all details (includes the body) -
get
Perform a generic GET request to the specified path and return the response as JsonNode- Parameters:
thePath- The path to perform the GET request on- Returns:
- The response as JsonNode
-