ConfigService¶
-
public interface
ConfigService
¶ Config service, manages SMS Configs. A config represents the way a particular user connects to an SMS provider. See
org.motechproject.sms.configs.Config
Methods¶
getConfig¶
-
Config
getConfig
(String name)¶ Returns the confguration with the given name.
Parameters: - name – the name of the configuration
Throws: - IllegalArgumentException – if a config with the given name does not exist
Returns: the config with the given name, never null
getConfigList¶
getConfigOrDefault¶
-
Config
getConfigOrDefault
(String name)¶ Returns the config with the given name, or the default config if the provided name is null or empty.
Parameters: - name – the name of the desired configuration, or null/empty string for the default configuration
Throws: - IllegalArgumentException – if a configuration with the given name does not exist
- IllegalStateException – if a blank string is provided and there is no default configuration
Returns: the matching configuration
getConfigs¶
getDefaultConfig¶
-
Config
getDefaultConfig
()¶ Returns the default configuration for sending SMS message. Only one of the configurations can be marked as the default by the user.
Throws: - IllegalStateException – if no default configuration exists
Returns: the default configuration, never null
getServerUrl¶
hasConfig¶
hasConfigs¶
-
boolean
hasConfigs
()¶ Checks whether there are no configurations available.
Returns: true if there are no configurations, false otherwise
updateConfigs¶
-
void
updateConfigs
(Configs configs)¶ Updates the SMS configs using the provided object. The configuration will be persisted with the Motech config system. Configurations which are no longer part of the provided object will be dropped.
Parameters: - configs – an object containing all the SMS configurations