Batch system config update (#1402)
* Added an endpoint for batch update of system configurations Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * batch db save Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Review changes and added tests Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Evict cache only if transaction is commited - such as @CacheEvict Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * refactoring Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Using AfterTransactionCommitExecutor for cache eviction Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> * Change request body Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com> --------- Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
This commit is contained in:
@@ -34,15 +34,15 @@ public class MgmtSystemTenantConfigurationValueRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the MgmtSystemTenantConfigurationValueRequest
|
||||
* Sets the value of the MgmtSystemTenantConfigurationValueRequest
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
|
||||
public void setValue(final Object value) {
|
||||
if (!(value instanceof Serializable)) {
|
||||
throw new IllegalArgumentException("The value muste be a instance of " + Serializable.class.getName());
|
||||
throw new IllegalArgumentException("The value must be a instance of " + Serializable.class.getName());
|
||||
}
|
||||
this.value = (Serializable) value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||
@@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* REST Resource for handling tenant specific configuration operations.
|
||||
@@ -83,4 +86,20 @@ public interface MgmtTenantManagementRestApi {
|
||||
ResponseEntity<MgmtSystemTenantConfigurationValue> updateTenantConfigurationValue(
|
||||
@PathVariable("keyName") String keyName, MgmtSystemTenantConfigurationValueRequest configurationValueRest);
|
||||
|
||||
/**
|
||||
* Handles the PUT request for updating a batch of tenant specific configurations
|
||||
*
|
||||
* @param configurationValueMap
|
||||
* a Map of name - value pairs for the configurations
|
||||
*
|
||||
* @return if the given configurations values exists and could be get HTTP OK.
|
||||
* In any failure the JsonResponseExceptionHandler is handling the
|
||||
* response.
|
||||
*/
|
||||
@PutMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs", consumes = {
|
||||
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSystemTenantConfigurationValue>> updateTenantConfiguration(
|
||||
@RequestBody Map<String, Serializable> configurationValueMap);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user