CommcareConfigService

public interface CommcareConfigService

Interface responsible for managing multiple configurations.

Methods

addConfig

Config addConfig(Config configuration)

Creates the given configuration.

Parameters:
  • configuration – the configuration to be saved
Returns:

the saved configuration

create

Config create()

deleteConfig

void deleteConfig(String name)

Deletes the configuration with the given name.

Parameters:
  • name – the name of the configuration

exists

boolean exists(String config)

Checks whether configuration with the given name exists.

Returns:true if config with given name exists, false otherwise

getBaseUrl

String getBaseUrl()

Returns the base URL for CommcareHQ forwarding endpoints.

Returns:the base URL

getByName

Config getByName(String name)

Returns the configuration with the given name.

Parameters:
  • name – the name of the configuration
Returns:

the configuration with the given name

getConfigs

Configs getConfigs()

Returns all the stored configurations.

Returns:the stored configurations

getDefault

Config getDefault()

Returns the default configuration.

Returns:the default configuration

setDefault

void setDefault(String name)

Sets configuration with the given name as default.

Parameters:
  • name – the name of the configuration

syncConfig

void syncConfig(String name)

Refreshes the CommCare application metadata in the given configuration.

Parameters:
  • name – name of the configuration to be synchronized

updateConfig

Config updateConfig(Config configuration, String oldName)

Used for changing configuration names.

Parameters:
  • configuration – the configuration to be saved
  • oldName – name of configuration before the update
Returns:

the saved configuration

verifyConfig

boolean verifyConfig(Config config)

Verifies CommCareHQ connection with the given configuration.

Parameters:
  • config – the configuration to be verified
Throws:
Returns:

true if connection was successful