From ffa46afc7a54579c38648e7fab2778f41d4b3834 Mon Sep 17 00:00:00 2001 From: Fabian Nonnenmacher Date: Tue, 2 Feb 2016 19:10:59 +0100 Subject: [PATCH] Removed old REST api for changing configuration values Signed-off-by: Nonnenmacher Fabian --- .../model/system/TenantConfigurationRest.java | 55 ------------------- .../resource/SystemManagementResource.java | 34 ------------ 2 files changed, 89 deletions(-) delete mode 100644 hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/system/TenantConfigurationRest.java diff --git a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/system/TenantConfigurationRest.java b/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/system/TenantConfigurationRest.java deleted file mode 100644 index 0c8a8e54d..000000000 --- a/hawkbit-rest-api/src/main/java/org/eclipse/hawkbit/rest/resource/model/system/TenantConfigurationRest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2015 Bosch Software Innovations GmbH and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package org.eclipse.hawkbit.rest.resource.model.system; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - * Response body for tenant configuration requests. - * - */ -@JsonInclude(Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class TenantConfigurationRest { - - private String key; - private Object value; - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @param key - * the key to set - */ - public void setKey(final String key) { - this.key = key; - } - - /** - * @return the value - */ - public Object getValue() { - return value; - } - - /** - * @param value - * the value to set - */ - public void setValue(final Object value) { - this.value = value; - } -} diff --git a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SystemManagementResource.java b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SystemManagementResource.java index ffd669a61..93e1acb3a 100644 --- a/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SystemManagementResource.java +++ b/hawkbit-rest-resource/src/main/java/org/eclipse/hawkbit/rest/resource/SystemManagementResource.java @@ -20,9 +20,7 @@ import org.eclipse.hawkbit.repository.SystemManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.rest.resource.model.system.CacheRest; import org.eclipse.hawkbit.rest.resource.model.system.SystemStatisticsRest; -import org.eclipse.hawkbit.rest.resource.model.system.TenantConfigurationRest; import org.eclipse.hawkbit.rest.resource.model.system.TenantSystemUsageRest; -import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +31,6 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -133,37 +130,6 @@ public class SystemManagementResource { return ResponseEntity.ok(cacheNames); } - /** - * Adds or updates a configuration for a specific tenant to the tenant - * configuration. - * - * @param configuration - * the configuration value to add or update - * @param key - * the key of the configuration to add or update - * @return the response entity with status OK. - */ - @RequestMapping(method = RequestMethod.PUT, value = "/conf/{key}") - @PreAuthorize(SpringEvalExpressions.HAS_AUTH_SYSTEM_ADMIN) - public ResponseEntity addUpdateConfig(@RequestBody final TenantConfigurationRest configuration, - @PathVariable final String key) { - - // TODO Quick and dirty solution to stay compatible, but these rest - // interface won't be necessary in future - - Object value; - if (configuration.getValue().equals(Boolean.TRUE)) { - value = true; - } else if (configuration.getValue().equals(Boolean.FALSE)) { - value = false; - } else { - value = configuration.getValue(); - } - - tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.fromKeyName(key), value); - return ResponseEntity.ok().build(); - } - private CacheRest cacheRest(final Cache cache) { final Object nativeCache = cache.getNativeCache(); if (nativeCache instanceof com.google.common.cache.Cache) {