Removed old REST api for changing configuration values

Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
Fabian Nonnenmacher
2016-02-02 19:10:59 +01:00
committed by Nonnenmacher Fabian
parent 08d4509249
commit ffa46afc7a
2 changed files with 0 additions and 89 deletions

View File

@@ -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;
}
}

View File

@@ -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<Void> 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) {