Interface ConfigurationService
- All Known Implementing Classes:
ConfigurationServiceImpl
Service which provides access to process configurations: key/value pairs which are either global or scoped to a single tenant.
-
Method Summary
Modifier and TypeMethodDescriptioncreateConfiguration(String configKey, String configValue, String tenantId) Creates a new configuration entry.voiddeleteConfiguration(String configurationId) Soft-deletes an active configuration by marking itConfiguration.STATUS_DELETED.getConfiguration(String configurationId) Returns the configuration with the given id.getConfigurations(String tenantId, boolean includeInactive) Returns the configurations applicable to the requested scope.updateConfiguration(String configurationId, String configValue) Updates the value of an active configuration by creating a new version.
-
Method Details
-
createConfiguration
Creates a new configuration entry.
If
tenantIdisnullthe entry is created as a global configuration which applies to all tenants.The version starts at 1, or continues after the highest existing version when a previously deleted key is re-created in the same scope.
- Parameters:
configKey- the configuration key, must not benullconfigValue- the configuration value, must not benullor blanktenantId- the tenant to scope the entry to, ornullfor a global entry- Returns:
- the newly created configuration
- Throws:
NotValidException- ifconfigKeyorconfigValueisnull, orconfigValueis blankBadUserRequestException- if an active configuration with the same key already exists in the same scope
-
getConfiguration
Returns the configuration with the given id.
- Parameters:
configurationId- the id of the configuration, must not benull- Returns:
- the configuration, or
nullif no configuration exists for that id
-
getConfigurations
Returns the configurations applicable to the requested scope.If
tenantIdisnull, the global default configurations are returned. For a tenant, active global configurations are returned with any active tenant entry replacing the global entry of the same key.If
includeInactiveistrue, all entries of every status are returned without merging: the global entries and, whentenantIdis set, the tenant's entries.- Parameters:
tenantId- the tenant scope, ornullfor global defaultsincludeInactive- whether to include inactive configurations- Returns:
- configurations ordered by key, then global before tenant, then version
-
updateConfiguration
Updates the value of an active configuration by creating a new version.
The existing entry is marked
Configuration.STATUS_INACTIVEand a newConfiguration.STATUS_ACTIVEentry with the same key and tenant scope is created. Its version is one greater than the highest existing version for that key and scope.- Parameters:
configurationId- the id of the active configuration to updateconfigValue- the new configuration value, must not be blank- Returns:
- the newly created active configuration version
- Throws:
NotValidException- ifconfigurationIdorconfigValueis missing or blankNotFoundException- if no configuration exists forconfigurationIdBadUserRequestException- if the configuration is not active
-
deleteConfiguration
Soft-deletes an active configuration by marking it
Configuration.STATUS_DELETED. The entry is retained and can still be retrieved by id or withincludeInactive.- Parameters:
configurationId- the id of the active configuration to delete- Throws:
NotValidException- ifconfigurationIdisnullNotFoundException- if no configuration exists forconfigurationIdBadUserRequestException- if the configuration is not active
-