Feature Reset Target Attributes (#664)
* Enhance DDI putConfigData REST entry point with update mode Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * ControllerManagement unit tests for new target attribute update modes Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Added DdiRootControllerRestApi test for new update mode Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Enhance DMF UPDATE_ATTRIBUTES message with update mode Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Enhance DMF integration tests Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Enhance DMF integration tests Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Fix DMF integration tests * Fix failing tests Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Fix failing tests Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Fix Sonar findings Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Javadoc improvements Signed-off-by: stefbehl <stefan.behl@bosch-si.com> * Fix codacy findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com> * Fix PR review findings Signed-off-by: Stefan Behl <stefan.behl@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
e700acc312
commit
607cf92a9e
@@ -319,12 +319,15 @@ public interface ControllerManagement {
|
||||
Action registerRetrieved(long actionId, String message);
|
||||
|
||||
/**
|
||||
* Updates attributes of the controller.
|
||||
* Updates attributes of the controller according to the given
|
||||
* {@link UpdateMode}.
|
||||
*
|
||||
* @param controllerId
|
||||
* to update
|
||||
* @param attributes
|
||||
* to insert
|
||||
* @param mode
|
||||
* the update mode or <code>null</code>
|
||||
*
|
||||
* @return updated {@link Target}
|
||||
*
|
||||
@@ -334,7 +337,8 @@ public interface ControllerManagement {
|
||||
* if maximum number of attribzes per target is exceeded
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes);
|
||||
Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes,
|
||||
UpdateMode mode);
|
||||
|
||||
/**
|
||||
* Finds {@link Target} based on given controller ID returns found Target
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2018 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.repository;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Enumerates the supported update modes. Each mode represents an attribute
|
||||
* update strategy.
|
||||
*
|
||||
* @see ControllerManagement
|
||||
*/
|
||||
public enum UpdateMode {
|
||||
|
||||
/**
|
||||
* Merge update strategy
|
||||
*/
|
||||
MERGE,
|
||||
|
||||
/**
|
||||
* Replacement update strategy
|
||||
*/
|
||||
REPLACE,
|
||||
|
||||
/**
|
||||
* Removal update strategy
|
||||
*/
|
||||
REMOVE;
|
||||
|
||||
public static Optional<UpdateMode> valueOfIgnoreCase(final String name) {
|
||||
return Arrays.stream(values()).filter(mode -> mode.name().equalsIgnoreCase(name)).findAny();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user