diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java
index b100cb28f..2ae8027ca 100644
--- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java
+++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/SimulationController.java
@@ -93,7 +93,7 @@ public class SimulationController {
gatewayToken));
}
- return ResponseEntity.ok("Updated " + amount + " DMF connected targets!");
+ return ResponseEntity.ok("Updated " + amount + " " + protocol + " connected targets!");
}
private boolean isDmfDisabled() {
diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java
index 6d1806463..192dbe6ca 100644
--- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java
+++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java
@@ -120,39 +120,6 @@ public class GenerateDialog extends Window {
}
- @Override
- public int hashCode() {// NOSONAR - as this is generated
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((formLayout == null) ? 0 : formLayout.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {// NOSONAR - as this is generated
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final GenerateDialog other = (GenerateDialog) obj;
- if (formLayout == null) {
- if (other.formLayout != null) {
- return false;
- }
- } else if (!formLayout.equals(other.formLayout)) {
- return false;
- }
- return true;
- }
-
/**
* Callback interface to retrieve the result from the dialog window.
*
@@ -225,19 +192,20 @@ public class GenerateDialog extends Window {
});
}
- private TextField createRequiredTextfield(final String caption, final String value, final Resource icon,
+ private static TextField createRequiredTextfield(final String caption, final String value, final Resource icon,
final Validator validator) {
final TextField textField = new TextField(caption, value);
return addTextFieldValues(textField, icon, validator);
}
- private TextField createRequiredTextfield(final String caption, final Property> dataSource, final Resource icon,
- final Validator validator) {
+ private static TextField createRequiredTextfield(final String caption, final Property> dataSource,
+ final Resource icon, final Validator validator) {
final TextField textField = new TextField(caption, dataSource);
return addTextFieldValues(textField, icon, validator);
}
- private TextField addTextFieldValues(final TextField textField, final Resource icon, final Validator validator) {
+ private static TextField addTextFieldValues(final TextField textField, final Resource icon,
+ final Validator validator) {
textField.setIcon(icon);
textField.setRequired(true);
if (validator != null) {
diff --git a/examples/hawkbit-example-core-feign-client/pom.xml b/examples/hawkbit-example-core-feign-client/pom.xml
index 5b3df2ef2..c41f7953d 100644
--- a/examples/hawkbit-example-core-feign-client/pom.xml
+++ b/examples/hawkbit-example-core-feign-client/pom.xml
@@ -32,7 +32,14 @@
org.springframework.cloud
spring-cloud-netflix-core
- 1.0.7.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-commons
+
+
+ org.springframework.cloud
+ spring-cloud-context
org.slf4j
diff --git a/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/IgnoreMultipleConsumersProducersSpringMvcContract.java b/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/IgnoreMultipleConsumersProducersSpringMvcContract.java
index b04143cdf..e2ca27077 100644
--- a/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/IgnoreMultipleConsumersProducersSpringMvcContract.java
+++ b/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/IgnoreMultipleConsumersProducersSpringMvcContract.java
@@ -10,12 +10,14 @@ package org.eclipse.hawkbit.feign.core.client;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.util.LinkedHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.feign.support.SpringMvcContract;
import feign.MethodMetadata;
+import feign.Param;
/**
* Own implementation of the {@link SpringMvcContract} which catches the
@@ -38,6 +40,10 @@ public class IgnoreMultipleConsumersProducersSpringMvcContract extends SpringMvc
// multiple consumers and produces, see
// https://github.com/spring-cloud/spring-cloud-netflix/issues/808
LOGGER.trace(e.getMessage(), e);
+
+ // This line from super is mandatory to avoid that access to the
+ // expander causes a nullpointer.
+ data.indexToExpander(new LinkedHashMap());
}
}
}
diff --git a/examples/hawkbit-example-ddi-feign-client/pom.xml b/examples/hawkbit-example-ddi-feign-client/pom.xml
index 5388544db..3797d609b 100644
--- a/examples/hawkbit-example-ddi-feign-client/pom.xml
+++ b/examples/hawkbit-example-ddi-feign-client/pom.xml
@@ -20,18 +20,6 @@
hawkBit-example :: DDI Feign Client
-
-
-
- org.springframework.cloud
- spring-cloud-netflix
- 1.0.7.RELEASE
- pom
- import
-
-
-
-
org.eclipse.hawkbit
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetClientResource.java
index 40eb13b55..b38fc8edc 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetClientResource.java
@@ -9,13 +9,12 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the DistributionSet resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtDistributionSetClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtDistributionSetClientResource extends MgmtDistributionSetRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTagClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTagClientResource.java
index 1070bbd9c..c08894cca 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTagClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTagClientResource.java
@@ -9,12 +9,11 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the DistributionSetTag resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtDistributionSetTagClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtDistributionSetTagClientResource extends MgmtDistributionSetTagRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTypeClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTypeClientResource.java
index 451c53942..d7cb509d8 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTypeClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDistributionSetTypeClientResource.java
@@ -9,14 +9,13 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the DistributionSetType resource of the management API.
*
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtDistributionSetTypeClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtDistributionSetTypeClientResource extends MgmtDistributionSetTypeRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
index 5c93edce5..831b17a5f 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
@@ -9,14 +9,13 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadArtifactRestApi;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* A feign-client interface declaration which allows to build a feign-client
* stub.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtDownloadArtifactClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtDownloadArtifactClientResource extends MgmtDownloadArtifactRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadClientResource.java
index 330d3908f..0a4d1f500 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadClientResource.java
@@ -9,12 +9,11 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadRestApi;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
*
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.DOWNLOAD_ID_V1_REQUEST_MAPPING_BASE)
+@FeignClient(name = "MgmtDownloadClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtDownloadClientResource extends MgmtDownloadRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtRolloutClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtRolloutClientResource.java
index acc00d6fe..0d6856d98 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtRolloutClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtRolloutClientResource.java
@@ -8,13 +8,12 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the Rollout resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtRolloutClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtRolloutClientResource extends MgmtRolloutRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleClientResource.java
index 7a2267e24..c5d019e78 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleClientResource.java
@@ -9,7 +9,6 @@
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
@@ -24,7 +23,7 @@ import feign.Param;
/**
* Client binding for the SoftwareModule resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtSoftwareModuleClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtSoftwareModuleClientResource extends MgmtSoftwareModuleRestApi {
@Override
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
index 603e82f10..582ec1821 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
@@ -8,13 +8,12 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the SoftwareModuleType resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtSoftwareModuleTypeClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtSoftwareModuleTypeClientResource extends MgmtSoftwareModuleTypeRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemClientResource.java
index e1bbd909c..9486bc560 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemClientResource.java
@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
@@ -16,6 +15,6 @@ import org.springframework.cloud.netflix.feign.FeignClient;
* Client binding for the {@link MgmtSystemRestApi}.
*
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtSystemClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtSystemClientResource extends MgmtSystemRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemManagementClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemManagementClientResource.java
index 802194fe8..8cb293ea7 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemManagementClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSystemManagementClientResource.java
@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSystemManagementRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
@@ -16,7 +15,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
* Client binding for the {@link MgmtSystemManagementRestApi}.
*
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.SYSTEM_ADMIN_MAPPING)
+@FeignClient(name = "MgmtSystemManagementClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtSystemManagementClientResource extends MgmtSystemManagementRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetClientResource.java
index c0a0193af..a64509340 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetClientResource.java
@@ -8,13 +8,12 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the Target resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtTargetClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtTargetClientResource extends MgmtTargetRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetTagClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetTagClientResource.java
index 3f9264337..b1d264e78 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetTagClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtTargetTagClientResource.java
@@ -8,13 +8,12 @@
*/
package org.eclipse.hawkbit.mgmt.client.resource;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTagRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the TargetTag resource of the management API.
*/
-@FeignClient(url = "${hawkbit.url:localhost:8080}" + MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING)
+@FeignClient(name = "MgmtTargetTagClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtTargetTagClientResource extends MgmtTargetTagRestApi {
}
diff --git a/examples/hawkbit-example-mgmt-simulator/pom.xml b/examples/hawkbit-example-mgmt-simulator/pom.xml
index 469290dfc..dcf1bc735 100644
--- a/examples/hawkbit-example-mgmt-simulator/pom.xml
+++ b/examples/hawkbit-example-mgmt-simulator/pom.xml
@@ -42,40 +42,12 @@
-
-
-
- org.springframework.cloud
- spring-cloud-netflix
- 1.0.7.RELEASE
- pom
- import
-
-
-
-
org.eclipse.hawkbit
hawkbit-example-mgmt-feign-client
${project.version}
-
- com.netflix.feign
- feign-core
-
-
- com.netflix.feign
- feign-jackson
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
- hibernate-validator
- org.hibernate
-
org.springframework.boot
spring-boot-starter
diff --git a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java
index ac65455b5..d94519df2 100644
--- a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java
+++ b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java
@@ -17,9 +17,8 @@ import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetClientResource;
import org.eclipse.hawkbit.mgmt.client.scenarios.ConfigurableScenario;
import org.eclipse.hawkbit.mgmt.client.scenarios.CreateStartedRolloutExample;
import org.eclipse.hawkbit.mgmt.client.scenarios.upload.FeignMultipartEncoder;
-import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.Banner.Mode;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -49,9 +48,6 @@ import feign.slf4j.Slf4jLogger;
@Import(FeignClientConfiguration.class)
public class Application implements CommandLineRunner {
- @Autowired
- private ClientConfigurationProperties configuration;
-
@Autowired
private ConfigurableScenario configuredScenario;
@@ -59,7 +55,7 @@ public class Application implements CommandLineRunner {
private CreateStartedRolloutExample gettingStartedRolloutScenario;
public static void main(final String[] args) {
- new SpringApplicationBuilder().showBanner(false).sources(Application.class).run(args);
+ new SpringApplicationBuilder().bannerMode(Mode.OFF).sources(Application.class).run(args);
}
@Override
@@ -74,18 +70,18 @@ public class Application implements CommandLineRunner {
}
@Bean
- public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
+ public BasicAuthRequestInterceptor basicAuthRequestInterceptor(final ClientConfigurationProperties configuration) {
return new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword());
}
@Bean
public ConfigurableScenario configurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
- @Qualifier("mgmtSoftwareModuleClientResource") final MgmtSoftwareModuleClientResource softwareModuleResource,
- @Qualifier("uploadSoftwareModule") final MgmtSoftwareModuleClientResource uploadSoftwareModule,
+ final MgmtSoftwareModuleClientResource softwareModuleResource,
final MgmtTargetClientResource targetResource, final MgmtRolloutClientResource rolloutResource,
final ClientConfigurationProperties clientConfigurationProperties) {
- return new ConfigurableScenario(distributionSetResource, softwareModuleResource, uploadSoftwareModule,
- targetResource, rolloutResource, clientConfigurationProperties);
+ return new ConfigurableScenario(distributionSetResource, softwareModuleResource,
+ uploadSoftwareModule(clientConfigurationProperties), targetResource, rolloutResource,
+ clientConfigurationProperties);
}
@Bean
@@ -94,23 +90,21 @@ public class Application implements CommandLineRunner {
}
@Bean
- public Logger.Level feignLoggerLevel() {
- return Logger.Level.FULL;
- }
-
- @Bean
- public MgmtSoftwareModuleClientResource uploadSoftwareModule() {
+ public MgmtSoftwareModuleClientResource uploadSoftwareModule(final ClientConfigurationProperties configuration) {
final ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(new Jackson2HalModule());
-
return Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
.requestInterceptor(
new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword()))
.logger(new Slf4jLogger()).encoder(new FeignMultipartEncoder())
.decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper)))
- .target(MgmtSoftwareModuleClientResource.class,
- configuration.getUrl() + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING);
+ .target(MgmtSoftwareModuleClientResource.class, configuration.getUrl());
+ }
+
+ @Bean
+ public Logger.Level feignLoggerLevel() {
+ return Logger.Level.FULL;
}
private static boolean containsArg(final String containsArg, final String... args) {
diff --git a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/ConfigurableScenario.java b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/ConfigurableScenario.java
index a09459e07..388516897 100644
--- a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/ConfigurableScenario.java
+++ b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/ConfigurableScenario.java
@@ -31,7 +31,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Qualifier;
/**
*
@@ -50,18 +49,18 @@ public class ConfigurableScenario {
private final MgmtSoftwareModuleClientResource softwareModuleResource;
- private final MgmtSoftwareModuleClientResource uploadSoftwareModule;
-
private final MgmtTargetClientResource targetResource;
private final MgmtRolloutClientResource rolloutResource;
private final ClientConfigurationProperties clientConfigurationProperties;
+ private final MgmtSoftwareModuleClientResource uploadSoftwareModule;
+
public ConfigurableScenario(final MgmtDistributionSetClientResource distributionSetResource,
- @Qualifier("mgmtSoftwareModuleClientResource") final MgmtSoftwareModuleClientResource softwareModuleResource,
- @Qualifier("uploadSoftwareModule") final MgmtSoftwareModuleClientResource uploadSoftwareModule,
- final MgmtTargetClientResource targetResource, final MgmtRolloutClientResource rolloutResource,
+ final MgmtSoftwareModuleClientResource softwareModuleResource,
+ final MgmtSoftwareModuleClientResource uploadSoftwareModule, final MgmtTargetClientResource targetResource,
+ final MgmtRolloutClientResource rolloutResource,
final ClientConfigurationProperties clientConfigurationProperties) {
this.distributionSetResource = distributionSetResource;
this.softwareModuleResource = softwareModuleResource;
@@ -191,7 +190,7 @@ public class ConfigurableScenario {
.type("application").buildAsList(scenario.getAppModulesPerDistributionSet()))
.getBody());
- for (int x = 0; x < scenario.getArtifactsPerSM(); x++) {
+ for (int iArtifact = 0; iArtifact < scenario.getArtifactsPerSM(); iArtifact++) {
modules.forEach(module -> {
final ArtifactFile file = new ArtifactFile("dummyfile.dummy", null, "multipart/form-data", artifact);
uploadSoftwareModule.uploadArtifact(module.getModuleId(), file, null, null, null);
@@ -201,21 +200,6 @@ public class ConfigurableScenario {
return modules;
}
- private static byte[] generateArtifact(final Scenario scenario) {
-
- // Exception squid:S2245 - not used for cryptographic function
- @SuppressWarnings("squid:S2245")
- final Random random = new Random();
-
- // create byte array
- final byte[] nbyte = new byte[parseSize(scenario.getArtifactSize())];
-
- // put the next byte in the array
- random.nextBytes(nbyte);
-
- return nbyte;
- }
-
private void createTargets(final Scenario scenario) {
LOGGER.info("Creating {} targets", scenario.getTargets());
@@ -239,4 +223,19 @@ public class ConfigurableScenario {
}
return Integer.valueOf(size);
}
+
+ private static byte[] generateArtifact(final Scenario scenario) {
+
+ // Exception squid:S2245 - not used for cryptographic function
+ @SuppressWarnings("squid:S2245")
+ final Random random = new Random();
+
+ // create byte array
+ final byte[] nbyte = new byte[parseSize(scenario.getArtifactSize())];
+
+ // put the next byte in the array
+ random.nextBytes(nbyte);
+
+ return nbyte;
+ }
}
diff --git a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java
index b450bbde2..913d2eaa4 100644
--- a/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java
+++ b/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/scenarios/CreateStartedRolloutExample.java
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutResponseBody;
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
/**
* Example for creating and starting a Rollout.
@@ -46,7 +45,6 @@ public class CreateStartedRolloutExample {
private MgmtDistributionSetClientResource distributionSetResource;
@Autowired
- @Qualifier("mgmtSoftwareModuleClientResource")
private MgmtSoftwareModuleClientResource softwareModuleResource;
@Autowired
diff --git a/examples/pom.xml b/examples/pom.xml
index fb8ef3fc3..85dd70651 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -8,7 +8,8 @@
http://www.eclipse.org/legal/epl-v10.html
-->
-
+
4.0.0
@@ -28,33 +29,21 @@
hawkbit-example-ddi-feign-client
hawkbit-example-mgmt-feign-client
hawkbit-example-mgmt-simulator
-
-
-
-
- 8.14.2
-
+
- com.netflix.feign
- feign-core
-
-
- ${feign.version}
+ org.springframework.cloud
+ spring-cloud-dependencies
+ Brixton.SR5
+ pom
+ import
com.netflix.feign
feign-jackson
-
-
- ${feign.version}
-
-
- com.netflix.feign
- feign-slf4j
- ${feign.version}
+ 8.16.2
diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
index 53f6492d1..91a271541 100644
--- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
+++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
@@ -19,6 +19,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.stereotype.Component;
import com.google.common.base.Strings;
+import com.google.common.net.UrlEscapers;
/**
* Implementation for ArtifactUrlHandler for creating urls to download resource
@@ -55,8 +56,8 @@ public class PropertyBasedArtifactUrlHandler implements ArtifactUrlHandler {
}
String urlPattern = properties.getPattern();
- final Set> entrySet = getReplaceMap(targetId, softwareModuleId, filename, sha1Hash,
- protocolString, properties).entrySet();
+ final Set> entrySet = getReplaceMap(targetId, softwareModuleId,
+ UrlEscapers.urlFragmentEscaper().escape(filename), sha1Hash, protocolString, properties).entrySet();
for (final Entry entry : entrySet) {
if (entry.getKey().equals(PORT_PLACEHOLDER)) {
urlPattern = urlPattern.replace(":{" + entry.getKey() + "}",
diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java
index 67436c3ca..f4c80c778 100644
--- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java
+++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/rest/api/DdiRootControllerRestApi.java
@@ -25,7 +25,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -150,7 +149,7 @@ public interface DdiRootControllerRestApi {
*/
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
- ResponseEntity postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
+ ResponseEntity postBasedeploymentActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId);
/**
@@ -167,7 +166,7 @@ public interface DdiRootControllerRestApi {
*/
@RequestMapping(value = "/{targetid}/"
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
- ResponseEntity putConfigData(@Valid @RequestBody final DdiConfigData configData,
+ ResponseEntity putConfigData(@Valid final DdiConfigData configData,
@PathVariable("targetid") final String targetid);
/**
@@ -205,7 +204,7 @@ public interface DdiRootControllerRestApi {
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
- ResponseEntity postCancelActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
+ ResponseEntity postCancelActionFeedback(@Valid final DdiActionFeedback feedback,
@PathVariable("targetid") @NotEmpty final String targetid,
@PathVariable("actionId") @NotEmpty final Long actionId);
diff --git a/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java b/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java
index d87de67d0..deda60646 100644
--- a/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java
+++ b/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DataConversionHelper.java
@@ -14,6 +14,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
@@ -29,7 +30,6 @@ import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
import org.eclipse.hawkbit.ddi.json.model.DdiPolling;
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
import org.eclipse.hawkbit.repository.model.Action;
-import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.tenancy.TenantAware;
@@ -108,30 +108,25 @@ public final class DataConversionHelper {
return file;
}
- static DdiControllerBase fromTarget(final Target target, final List actions,
+ static DdiControllerBase fromTarget(final Target target, final Optional action,
final String defaultControllerPollTime, final TenantAware tenantAware) {
final DdiControllerBase result = new DdiControllerBase(
new DdiConfig(new DdiPolling(defaultControllerPollTime)));
- boolean addedUpdate = false;
- boolean addedCancel = false;
- final long countCancelingActions = actions.stream().filter(a -> a.getStatus() == Status.CANCELING).count();
- for (final Action action : actions) {
- if (countCancelingActions <= 0 && !action.isCancelingOrCanceled() && !addedUpdate) {
+ if (action.isPresent()) {
+ if (action.get().isCancelingOrCanceled()) {
+ result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
+ .getControllerCancelAction(target.getControllerId(), action.get().getId()))
+ .withRel(DdiRestConstants.CANCEL_ACTION));
+ } else {
// we need to add the hashcode here of the actionWithStatus
// because the action might
// have changed from 'soft' to 'forced' type and we need to
// change the payload of the
// response because of eTags.
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
- .getControllerBasedeploymentAction(target.getControllerId(), action.getId(),
- calculateEtag(action))).withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
- addedUpdate = true;
- } else if (action.isCancelingOrCanceled() && !addedCancel) {
- result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
- .getControllerCancelAction(target.getControllerId(), action.getId()))
- .withRel(DdiRestConstants.CANCEL_ACTION));
- addedCancel = true;
+ .getControllerBasedeploymentAction(target.getControllerId(), action.get().getId(),
+ calculateEtag(action.get()))).withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
}
}
diff --git a/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java b/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java
index 9dd65d5fc..9456cd63e 100644
--- a/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java
+++ b/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java
@@ -130,7 +130,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
}
return new ResponseEntity<>(
- DataConversionHelper.fromTarget(target, controllerManagement.findActionByTargetAndActive(target),
+ DataConversionHelper.fromTarget(target, controllerManagement.findOldestActiveActionByTarget(target),
controllerManagement.getPollingTime(), tenantAware),
HttpStatus.OK);
}
diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java
index dd152bd5a..d0ae4d87d 100644
--- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java
+++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java
@@ -13,6 +13,7 @@ import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import java.util.UUID;
import org.apache.commons.lang3.ArrayUtils;
@@ -32,6 +33,7 @@ import org.eclipse.hawkbit.dmf.json.model.ArtifactHash;
import org.eclipse.hawkbit.dmf.json.model.DownloadResponse;
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken;
import org.eclipse.hawkbit.dmf.json.model.TenantSecurityToken.FileResource;
+import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
import org.eclipse.hawkbit.repository.ArtifactManagement;
@@ -41,7 +43,7 @@ import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
-import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
+import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -155,7 +157,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
return handleAuthentifiactionMessage(message);
} catch (final IllegalArgumentException ex) {
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
- } catch (final TenantNotExistException | ToManyStatusEntriesException e) {
+ } catch (final TenantNotExistException | TooManyStatusEntriesException e) {
throw new AmqpRejectAndDontRequeueException(e);
} finally {
SecurityContextHolder.setContext(oldContext);
@@ -196,8 +198,8 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
}
} catch (final IllegalArgumentException ex) {
throw new AmqpRejectAndDontRequeueException("Invalid message!", ex);
- } catch (final TenantNotExistException teex) {
- throw new AmqpRejectAndDontRequeueException(teex);
+ } catch (final TenantNotExistException | TooManyStatusEntriesException e) {
+ throw new AmqpRejectAndDontRequeueException(e);
} finally {
SecurityContextHolder.setContext(oldContext);
}
@@ -344,18 +346,24 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
}
private void lookIfUpdateAvailable(final Target target) {
- final List actions = controllerManagement.findActionByTargetAndActive(target);
- if (actions.isEmpty()) {
+ final Optional action = controllerManagement.findOldestActiveActionByTarget(target);
+ if (!action.isPresent()) {
return;
}
- // action are ordered by ASC
- final Action action = actions.get(0);
- final DistributionSet distributionSet = action.getDistributionSet();
+
+ if (action.get().isCancelingOrCanceled()) {
+ amqpMessageDispatcherService.targetCancelAssignmentToDistributionSet(
+ new CancelTargetAssignmentEvent(target.getOptLockRevision(), target.getTenant(),
+ target.getControllerId(), action.get().getId(), target.getTargetInfo().getAddress()));
+ return;
+ }
+
+ final DistributionSet distributionSet = action.get().getDistributionSet();
final List softwareModuleList = controllerManagement
.findSoftwareModulesByDistributionSet(distributionSet);
final String targetSecurityToken = systemSecurityContext.runAsSystem(() -> target.getSecurityToken());
amqpMessageDispatcherService.targetAssignDistributionSet(new TargetAssignDistributionSetEvent(
- target.getOptLockRevision(), target.getTenant(), target.getControllerId(), action.getId(),
+ target.getOptLockRevision(), target.getTenant(), target.getControllerId(), action.get().getId(),
softwareModuleList, target.getTargetInfo().getAddress(), targetSecurityToken));
}
diff --git a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java
index 9ed314ebc..f8dd4f645 100644
--- a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java
+++ b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerServiceTest.java
@@ -23,6 +23,7 @@ import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.eclipse.hawkbit.api.HostnameResolver;
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
@@ -155,6 +156,7 @@ public class AmqpMessageHandlerServiceTest {
final ArgumentCaptor uriCaptor = ArgumentCaptor.forClass(URI.class);
when(controllerManagementMock.findOrRegisterTargetIfItDoesNotexist(targetIdCaptor.capture(),
uriCaptor.capture())).thenReturn(null);
+ when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any())).thenReturn(Optional.empty());
amqpMessageHandlerService.onMessage(message, MessageType.THING_CREATED.name(), TENANT, "vHost");
@@ -362,9 +364,8 @@ public class AmqpMessageHandlerServiceTest {
when(controllerManagementMock.addUpdateActionStatus(Matchers.any())).thenReturn(action);
when(entityFactoryMock.generateActionStatus()).thenReturn(new JpaActionStatus());
// for the test the same action can be used
- final List actionList = new ArrayList<>();
- actionList.add(action);
- when(controllerManagementMock.findActionByTargetAndActive(Matchers.any())).thenReturn(actionList);
+ when(controllerManagementMock.findOldestActiveActionByTarget(Matchers.any()))
+ .thenReturn(Optional.of(action));
final List softwareModuleList = createSoftwareModuleList();
when(controllerManagementMock.findSoftwareModulesByDistributionSet(Matchers.any()))
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java
index c61c9ecd3..d3439adc6 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetRestApi.java
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -88,7 +87,7 @@ public interface MgmtDistributionSetRestApi {
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity> createDistributionSets(
- @RequestBody final List sets);
+ final List sets);
/**
* Handles the DELETE request for a single DistributionSet .
@@ -116,7 +115,7 @@ public interface MgmtDistributionSetRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity updateDistributionSet(
@PathVariable("distributionSetId") final Long distributionSetId,
- @RequestBody final MgmtDistributionSetRequestBodyPut toUpdate);
+ final MgmtDistributionSetRequestBodyPut toUpdate);
/**
* Handles the GET request of retrieving assigned targets to a specific
@@ -198,7 +197,7 @@ public interface MgmtDistributionSetRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity createAssignedTarget(
@PathVariable("distributionSetId") final Long distributionSetId,
- @RequestBody final List targetIds);
+ final List targetIds);
/**
* Gets a paged list of meta data for a distribution set.
@@ -256,7 +255,7 @@ public interface MgmtDistributionSetRestApi {
@RequestMapping(method = RequestMethod.PUT, value = "/{distributionSetId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity updateMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
- @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
+ @PathVariable("metadataKey") final String metadataKey, final MgmtMetadata metadata);
/**
* Deletes a single meta data entry from the distribution set.
@@ -285,7 +284,7 @@ public interface MgmtDistributionSetRestApi {
MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity> createMetadata(@PathVariable("distributionSetId") final Long distributionSetId,
- @RequestBody final List metadataRest);
+ final List metadataRest);
/**
* Assigns a list of software modules to a distribution set.
@@ -301,7 +300,7 @@ public interface MgmtDistributionSetRestApi {
MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity assignSoftwareModules(@PathVariable("distributionSetId") final Long distributionSetId,
- @RequestBody final List softwareModuleIDs);
+ final List softwareModuleIDs);
/**
* Deletes the assignment of the software module form the distribution set.
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java
index 5a836ef55..2342cff6e 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTagRestApi.java
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -82,7 +81,7 @@ public interface MgmtDistributionSetTagRestApi {
*/
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
- ResponseEntity> createDistributionSetTags(@RequestBody final List tags);
+ ResponseEntity> createDistributionSetTags(final List tags);
/**
*
@@ -99,7 +98,7 @@ public interface MgmtDistributionSetTagRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateDistributionSetTag(
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
- @RequestBody final MgmtTagRequestBodyPut restDSTagRest);
+ final MgmtTagRequestBodyPut restDSTagRest);
/**
* Handles the DELETE request for a single distribution set tag.
@@ -142,7 +141,7 @@ public interface MgmtDistributionSetTagRestApi {
+ "/toggleTagAssignment")
ResponseEntity toggleTagAssignment(
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
- @RequestBody final List assignedDSRequestBodies);
+ final List assignedDSRequestBodies);
/**
* Handles the POST request to assign distribution sets to the given tag id.
@@ -157,7 +156,7 @@ public interface MgmtDistributionSetTagRestApi {
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.DISTRIBUTIONSET_REQUEST_MAPPING)
ResponseEntity> assignDistributionSets(
@PathVariable("distributionsetTagId") final Long distributionsetTagId,
- @RequestBody final List assignedDSRequestBodies);
+ final List assignedDSRequestBodies);
/**
* Handles the DELETE request to unassign all distribution set from the
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java
index 25468739e..aeddbe1e7 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDistributionSetTypeRestApi.java
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -99,7 +98,7 @@ public interface MgmtDistributionSetTypeRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateDistributionSetType(
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
- @RequestBody final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
+ final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
/**
* Handles the POST request of creating new DistributionSetTypes. The
@@ -115,7 +114,7 @@ public interface MgmtDistributionSetTypeRestApi {
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity> createDistributionSetTypes(
- @RequestBody final List distributionSetTypes);
+ final List distributionSetTypes);
/**
* Handles the GET request of retrieving the list of mandatory software
@@ -229,7 +228,7 @@ public interface MgmtDistributionSetTypeRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE })
ResponseEntity addMandatoryModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
- @RequestBody final MgmtId smtId);
+ final MgmtId smtId);
/**
* Handles the POST request for adding an optional software module type to a
@@ -247,6 +246,6 @@ public interface MgmtDistributionSetTypeRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE })
ResponseEntity addOptionalModule(@PathVariable("distributionSetTypeId") final Long distributionSetTypeId,
- @RequestBody final MgmtId smtId);
+ final MgmtId smtId);
}
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java
index 7f93e2ce8..905bbad88 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtRolloutRestApi.java
@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -77,7 +76,7 @@ public interface MgmtRolloutRestApi {
*/
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
- ResponseEntity create(@RequestBody final MgmtRolloutRestRequestBody rolloutRequestBody);
+ ResponseEntity create(final MgmtRolloutRestRequestBody rolloutRequestBody);
/**
* Handles the POST request for starting a rollout.
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java
index cdd63ee26..cd40ffc0b 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleRestApi.java
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequ
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -162,7 +161,7 @@ public interface MgmtSoftwareModuleRestApi {
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity> createSoftwareModules(
- @RequestBody final List softwareModules);
+ final List softwareModules);
/**
* Handles the PUT request of updating a software module.
@@ -177,7 +176,7 @@ public interface MgmtSoftwareModuleRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateSoftwareModule(
@PathVariable("softwareModuleId") final Long softwareModuleId,
- @RequestBody final MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
+ final MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
/**
* Handles the DELETE request for a single software module.
@@ -246,7 +245,7 @@ public interface MgmtSoftwareModuleRestApi {
@RequestMapping(method = RequestMethod.PUT, value = "/{softwareModuleId}/metadata/{metadataKey}", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity updateMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
- @PathVariable("metadataKey") final String metadataKey, @RequestBody final MgmtMetadata metadata);
+ @PathVariable("metadataKey") final String metadataKey, final MgmtMetadata metadata);
/**
* Deletes a single meta data entry from the software module.
@@ -275,6 +274,6 @@ public interface MgmtSoftwareModuleRestApi {
MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
ResponseEntity> createMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
- @RequestBody final List metadataRest);
+ final List metadataRest);
}
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java
index 3fe32d9ad..4fd5d2c38 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSoftwareModuleTypeRestApi.java
@@ -17,7 +17,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModule
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -94,7 +93,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateSoftwareModuleType(
@PathVariable("softwareModuleTypeId") final Long softwareModuleTypeId,
- @RequestBody final MgmtSoftwareModuleTypeRequestBodyPut restSoftwareModuleType);
+ final MgmtSoftwareModuleTypeRequestBodyPut restSoftwareModuleType);
/**
* Handles the POST request of creating new SoftwareModuleTypes. The request
@@ -110,6 +109,6 @@ public interface MgmtSoftwareModuleTypeRestApi {
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity> createSoftwareModuleTypes(
- @RequestBody final List softwareModuleTypes);
+ final List softwareModuleTypes);
}
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
index d120759b2..f7da862ee 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
@@ -16,7 +16,6 @@ import org.springframework.hateoas.ResourceSupport;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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;
@@ -83,6 +82,6 @@ public interface MgmtSystemRestApi {
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateConfigurationValue(
@PathVariable("keyName") final String keyName,
- @RequestBody final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
+ final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
}
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
index 97a0eae5c..3ffdaa534 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
@@ -21,7 +21,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -84,7 +83,7 @@ public interface MgmtTargetRestApi {
*/
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
- ResponseEntity> createTargets(@RequestBody final List targets);
+ ResponseEntity> createTargets(final List targets);
/**
* Handles the PUT request of updating a target. The ID is within the URL
@@ -103,7 +102,7 @@ public interface MgmtTargetRestApi {
@RequestMapping(method = RequestMethod.PUT, value = "/{controllerId}", consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateTarget(@PathVariable("controllerId") final String controllerId,
- @RequestBody final MgmtTargetRequestBody targetRest);
+ final MgmtTargetRequestBody targetRest);
/**
* Handles the DELETE request of deleting a target.
@@ -247,7 +246,7 @@ public interface MgmtTargetRestApi {
"application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity postAssignedDistributionSet(@PathVariable("controllerId") final String controllerId,
- @RequestBody final MgmtDistributionSetAssigment dsId);
+ final MgmtDistributionSetAssigment dsId);
/**
* Handles the GET request of retrieving the installed distribution set of
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java
index e568e7377..eb2b92af4 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.RequestParam;
@@ -81,7 +80,7 @@ public interface MgmtTargetTagRestApi {
*/
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
- ResponseEntity> createTargetTags(@RequestBody final List tags);
+ ResponseEntity> createTargetTags(final List tags);
/**
*
@@ -96,7 +95,7 @@ public interface MgmtTargetTagRestApi {
@RequestMapping(method = RequestMethod.PUT, value = "/{targetTagId}", consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
ResponseEntity updateTagretTag(@PathVariable("targetTagId") final Long targetTagId,
- @RequestBody final MgmtTagRequestBodyPut restTargetTagRest);
+ final MgmtTagRequestBodyPut restTargetTagRest);
/**
* Handles the DELETE request for a single target tag.
@@ -136,7 +135,7 @@ public interface MgmtTargetTagRestApi {
+ "/toggleTagAssignment")
ResponseEntity toggleTagAssignment(
@PathVariable("targetTagId") final Long targetTagId,
- @RequestBody final List assignedTargetRequestBodies);
+ final List assignedTargetRequestBodies);
/**
* Handles the POST request to assign targets to the given tag id.
@@ -150,7 +149,7 @@ public interface MgmtTargetTagRestApi {
*/
@RequestMapping(method = RequestMethod.POST, value = MgmtRestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING)
ResponseEntity> assignTargets(@PathVariable("targetTagId") final Long targetTagId,
- @RequestBody final List assignedTargetRequestBodies);
+ final List assignedTargetRequestBodies);
/**
* Handles the DELETE request to unassign all targets from the given tag id.
diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ControllerManagement.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ControllerManagement.java
index f06621fd4..f93b42e48 100644
--- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ControllerManagement.java
+++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/ControllerManagement.java
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
import java.net.URI;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import javax.validation.constraints.NotNull;
@@ -19,7 +20,7 @@ import org.eclipse.hawkbit.repository.eventbus.event.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
-import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
+import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -95,7 +96,7 @@ public interface ControllerManagement {
*
* @throws EntityAlreadyExistsException
* if a given entity already exists
- * @throws ToManyStatusEntriesException
+ * @throws TooManyStatusEntriesException
* if more than the allowed number of status entries are
* inserted
*/
@@ -111,7 +112,18 @@ public interface ControllerManagement {
* @return a list of actions assigned to given target which are active
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
- List findActionByTargetAndActive(@NotNull Target target);
+ List findActiveActionByTarget(@NotNull Target target);
+
+ /**
+ * Retrieves oldest {@link Action} that is active and assigned to a
+ * {@link Target}.
+ *
+ * @param target
+ * the target to retrieve the actions from
+ * @return a list of actions assigned to given target which are active
+ */
+ @PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
+ Optional findOldestActiveActionByTarget(@NotNull Target target);
/**
* Get the {@link Action} entity for given actionId with all lazy
diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TooManyStatusEntriesException.java
similarity index 81%
rename from hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java
rename to hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TooManyStatusEntriesException.java
index 7b8f4a1b0..3f3399a88 100644
--- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java
+++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TooManyStatusEntriesException.java
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.AbstractServerRtException;
*
*
*/
-public final class ToManyStatusEntriesException extends AbstractServerRtException {
+public final class TooManyStatusEntriesException extends AbstractServerRtException {
/**
*
*/
@@ -28,7 +28,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
* Creates a new FileUploadFailedException with
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
*/
- public ToManyStatusEntriesException() {
+ public TooManyStatusEntriesException() {
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
}
@@ -36,7 +36,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
* @param cause
* for the exception
*/
- public ToManyStatusEntriesException(final Throwable cause) {
+ public TooManyStatusEntriesException(final Throwable cause) {
super(SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES, cause);
}
@@ -44,7 +44,7 @@ public final class ToManyStatusEntriesException extends AbstractServerRtExceptio
* @param message
* of the error
*/
- public ToManyStatusEntriesException(final String message) {
+ public TooManyStatusEntriesException(final String message) {
super(message, SpServerError.SP_ACTION_STATUS_TO_MANY_ENTRIES);
}
}
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/ActionRepository.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/ActionRepository.java
index 0eebbced1..8989a5a41 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/ActionRepository.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/ActionRepository.java
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository.jpa;
import java.util.Collection;
import java.util.List;
+import java.util.Optional;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
@@ -79,21 +80,31 @@ public interface ActionRepository extends BaseEntityRepository,
Slice findByTarget(Pageable pageable, JpaTarget target);
/**
- * Retrieves all {@link Action}s which are active and referring the given
- * {@link Target} in a specified order. Loads also the lazy
- * {@link Action#getDistributionSet()} field.
+ * Retrieves all {@link Action}s which are active and referring to the given
+ * {@link Target} order by ID ascending.
*
- * @param pageable
- * page parameters
* @param target
* the target to find assigned actions
* @param active
* the action active flag
* @return the found {@link Action}s
*/
- @EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD)
List findByTargetAndActiveOrderByIdAsc(final JpaTarget target, boolean active);
+ /**
+ * Retrieves the oldest {@link Action} that is active and referring to the
+ * given {@link Target}.
+ *
+ * @param target
+ * the target to find assigned actions
+ * @param active
+ * the action active flag
+ *
+ * @return the found {@link Action}
+ */
+ @EntityGraph(value = "Action.ds", type = EntityGraphType.LOAD)
+ Optional findFirstByTargetAndActiveOrderByIdAsc(final JpaTarget target, boolean active);
+
/**
* Retrieves latest {@link UpdateAction} for given target and
* {@link SoftwareModule}.
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
index 34160aa37..41ad6f179 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
@@ -12,6 +12,7 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
@@ -26,7 +27,7 @@ import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
-import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
+import org.eclipse.hawkbit.repository.exception.TooManyStatusEntriesException;
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
@@ -156,10 +157,15 @@ public class JpaControllerManagement implements ControllerManagement {
}
@Override
- public List findActionByTargetAndActive(final Target target) {
+ public List findActiveActionByTarget(final Target target) {
return actionRepository.findByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
}
+ @Override
+ public Optional findOldestActiveActionByTarget(final Target target) {
+ return actionRepository.findFirstByTargetAndActiveOrderByIdAsc((JpaTarget) target, true);
+ }
+
@Override
public List findSoftwareModulesByDistributionSet(final DistributionSet distributionSet) {
return new ArrayList<>(softwareModuleRepository.findByAssignedTo((JpaDistributionSet) distributionSet));
@@ -326,7 +332,7 @@ public class JpaControllerManagement implements ControllerManagement {
LOG_DOS.error(
"Potential denial of service (DOS) attack identfied. More status entries in the system than permitted ({})!",
securityProperties.getDos().getMaxStatusEntriesPerAction());
- throw new ToManyStatusEntriesException(
+ throw new TooManyStatusEntriesException(
String.valueOf(securityProperties.getDos().getMaxStatusEntriesPerAction()));
}
}
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAction.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAction.java
index ba808ff8a..4b5b6567e 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAction.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaAction.java
@@ -186,8 +186,8 @@ public class JpaAction extends AbstractJpaTenantAwareBaseEntity implements Actio
@Override
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
- EventBusHolder.getInstance().getEventBus().post(new ActionPropertyChangeEvent(this,
- EntityPropertyChangeHelper.getChangeSet(Action.class, descriptorEvent)));
+ EventBusHolder.getInstance().getEventBus()
+ .post(new ActionPropertyChangeEvent(this, EntityPropertyChangeHelper.getChangeSet(descriptorEvent)));
}
@Override
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java
index 4545cfaf1..9fc27f1e8 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaDistributionSet.java
@@ -73,8 +73,6 @@ import org.eclipse.persistence.descriptors.DescriptorEvent;
public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implements DistributionSet, EventAwareEntity {
private static final long serialVersionUID = 1L;
- private static final String COMPLETE_PROPERTY = "complete";
-
private static final String DELETED_PROPERTY = "deleted";
@Column(name = "required_migration_step")
@@ -301,8 +299,7 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
@Override
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
- final Map changeSet = EntityPropertyChangeHelper.getChangeSet(JpaDistributionSet.class,
- descriptorEvent);
+ final Map changeSet = EntityPropertyChangeHelper.getChangeSet(descriptorEvent);
EventBusHolder.getInstance().getEventBus().post(new DistributionSetUpdateEvent(this));
if (changeSet.containsKey(DELETED_PROPERTY)) {
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRollout.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRollout.java
index 58776b6a2..6d720a75d 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRollout.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRollout.java
@@ -214,8 +214,8 @@ public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, Event
@Override
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
- EventBusHolder.getInstance().getEventBus().post(new RolloutPropertyChangeEvent(this,
- EntityPropertyChangeHelper.getChangeSet(Rollout.class, descriptorEvent)));
+ EventBusHolder.getInstance().getEventBus()
+ .post(new RolloutPropertyChangeEvent(this, EntityPropertyChangeHelper.getChangeSet(descriptorEvent)));
}
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRolloutGroup.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRolloutGroup.java
index 907fb203b..750e61185 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRolloutGroup.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaRolloutGroup.java
@@ -252,8 +252,8 @@ public class JpaRolloutGroup extends AbstractJpaNamedEntity implements RolloutGr
@Override
public void fireUpdateEvent(final DescriptorEvent descriptorEvent) {
- EventBusHolder.getInstance().getEventBus().post(new RolloutGroupPropertyChangeEvent(this,
- EntityPropertyChangeHelper.getChangeSet(RolloutGroup.class, descriptorEvent)));
+ EventBusHolder.getInstance().getEventBus().post(
+ new RolloutGroupPropertyChangeEvent(this, EntityPropertyChangeHelper.getChangeSet(descriptorEvent)));
}
@Override
diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/helper/EntityPropertyChangeHelper.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/helper/EntityPropertyChangeHelper.java
index 9e759640d..3d296c513 100644
--- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/helper/EntityPropertyChangeHelper.java
+++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/helper/EntityPropertyChangeHelper.java
@@ -12,7 +12,6 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.eventbus.event.AbstractPropertyChangeEvent.PropertyChange;
-import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.eclipse.persistence.descriptors.DescriptorEvent;
import org.eclipse.persistence.internal.sessions.ObjectChangeSet;
import org.eclipse.persistence.queries.UpdateObjectQuery;
@@ -21,9 +20,12 @@ import org.eclipse.persistence.sessions.changesets.DirectToFieldChangeRecord;
/**
* Helper class to get the change set for the property changes in the Entity.
*
- * @param
*/
-public class EntityPropertyChangeHelper {
+public final class EntityPropertyChangeHelper {
+
+ private EntityPropertyChangeHelper() {
+ // noop
+ }
/**
* To get the map of entity property change set
@@ -32,14 +34,11 @@ public class EntityPropertyChangeHelper {
* @param event
* @return the map of the changeSet
*/
- public static Map getChangeSet(final Class clazz,
- final DescriptorEvent event) {
- final T rolloutGroup = clazz.cast(event.getObject());
+ public static Map getChangeSet(final DescriptorEvent event) {
final ObjectChangeSet changeSet = ((UpdateObjectQuery) event.getQuery()).getObjectChangeSet();
return changeSet.getChanges().stream().filter(record -> record instanceof DirectToFieldChangeRecord)
.map(record -> (DirectToFieldChangeRecord) record)
.collect(Collectors.toMap(record -> record.getAttribute(),
record -> new PropertyChange(record.getOldValue(), record.getNewValue())));
}
-
}
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java
index a5e6af609..7dbcdeb89 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/smtable/SoftwareModuleAddUpdateWindow.java
@@ -151,8 +151,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
.prompt(i18n.get("textfield.description")).id(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION)
.buildTextComponent();
- typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true,
- null, i18n.get("upload.swmodule.type"));
+ typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", null, null, true, null,
+ i18n.get("upload.swmodule.type"));
typeComboBox.setId(SPUIComponentIdProvider.SW_MODULE_TYPE);
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java
index a32346141..7ed065ceb 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java
@@ -57,8 +57,6 @@ public final class SPUIComponentProvider {
*
* @param caption
* caption of the combo box
- * @param height
- * combo box height
* @param width
* combo box width
* @param style
@@ -73,9 +71,9 @@ public final class SPUIComponentProvider {
* input prompt
* @return ComboBox
*/
- public static ComboBox getComboBox(final String caption, final String height, final String width,
- final String style, final String styleName, final boolean required, final String data, final String promt) {
- return SPUIComboBoxDecorator.decorate(caption, height, width, style, styleName, required, data, promt);
+ public static ComboBox getComboBox(final String caption, final String width, final String style,
+ final String styleName, final boolean required, final String data, final String promt) {
+ return SPUIComboBoxDecorator.decorate(caption, width, style, styleName, required, data, promt);
}
/**
@@ -290,20 +288,19 @@ public final class SPUIComponentProvider {
* specify how the link should be open (f. e. new windows =
* _blank)
* @param style
- * chosen style of the link
- * @param setStyle
- * set true if the style should be used
+ * chosen style of the link. Might be {@code null} if no style
+ * should be used
* @return a link UI component
*/
public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon,
- final String targetOpen, final String style, final boolean setStyle) {
+ final String targetOpen, final String style) {
final Link link = new Link(name, new ExternalResource(resource));
link.setId(id);
link.setIcon(icon);
link.setTargetName(targetOpen);
- if (setStyle) {
+ if (style != null) {
link.setStyleName(style);
}
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/decorators/SPUIComboBoxDecorator.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/decorators/SPUIComboBoxDecorator.java
index 291173044..89d23709c 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/decorators/SPUIComboBoxDecorator.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/decorators/SPUIComboBoxDecorator.java
@@ -49,7 +49,7 @@ public final class SPUIComboBoxDecorator {
* as promt
* @return ComboBox as comp
*/
- public static ComboBox decorate(final String caption, final String height, final String width, final String style,
+ public static ComboBox decorate(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String prompt) {
final ComboBox spUICombo = new ComboBox();
// Default settings
@@ -67,10 +67,6 @@ public final class SPUIComboBoxDecorator {
if (StringUtils.isNotEmpty(styleName)) {
spUICombo.addStyleName(styleName);
}
- // Add height
- if (StringUtils.isNotEmpty(height)) {
- spUICombo.setHeight(height);
- }
// AddWidth
if (StringUtils.isNotEmpty(width)) {
spUICombo.setWidth(width);
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/AbstractCreateUpdateTagLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/AbstractCreateUpdateTagLayout.java
index 0c4aa3111..755d378ea 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/AbstractCreateUpdateTagLayout.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/AbstractCreateUpdateTagLayout.java
@@ -189,7 +189,7 @@ public abstract class AbstractCreateUpdateTagLayout exten
tagDesc.setNullRepresentation("");
- tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", "", null, null, false, "",
+ tagNameComboBox = SPUIComponentProvider.getComboBox(null, "", null, null, false, "",
i18n.get("label.combobox.tag"));
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/CreateUpdateTypeLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/CreateUpdateTypeLayout.java
index 51003fb58..b464a87c0 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/CreateUpdateTypeLayout.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/layouts/CreateUpdateTypeLayout.java
@@ -54,8 +54,8 @@ public abstract class CreateUpdateTypeLayout extends Abst
colorLabel = new LabelBuilder().name(i18n.get("label.choose.type.color")).buildLabel();
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
- tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, null, false,
- "", i18n.get("label.combobox.type"));
+ tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", null, null, false, "",
+ i18n.get("label.combobox.type"));
tagNameComboBox.setId(SPUIDefinitions.NEW_DISTRIBUTION_SET_TYPE_NAME_COMBO);
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/login/LoginView.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/login/LoginView.java
index 48805e1d1..6e5ea9238 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/login/LoginView.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/login/LoginView.java
@@ -266,14 +266,14 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
final Link docuLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_DOCUMENTATION,
i18n.get("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
- FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle, true);
+ FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
links.addComponent(docuLink);
docuLink.addStyleName(ValoTheme.LINK_SMALL);
}
if (!uiProperties.getDemo().getUser().isEmpty()) {
final Link demoLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_DEMO,
- i18n.get("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle, true);
+ i18n.get("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle);
links.addComponent(demoLink);
demoLink.addStyleName(ValoTheme.LINK_SMALL);
}
@@ -281,7 +281,7 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getRequestAccount().isEmpty()) {
final Link requestAccountLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_REQUESTACCOUNT,
i18n.get("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(),
- FontAwesome.SHOPPING_CART, "", linkStyle, true);
+ FontAwesome.SHOPPING_CART, "", linkStyle);
links.addComponent(requestAccountLink);
requestAccountLink.addStyleName(ValoTheme.LINK_SMALL);
}
@@ -289,7 +289,7 @@ public class LoginView extends VerticalLayout implements View {
if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
final Link userManagementLink = SPUIComponentProvider.getLink(SPUIComponentIdProvider.LINK_USERMANAGEMENT,
i18n.get("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
- FontAwesome.USERS, "_blank", linkStyle, true);
+ FontAwesome.USERS, "_blank", linkStyle);
links.addComponent(userManagementLink);
userManagementLink.addStyleName(ValoTheme.LINK_SMALL);
}
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java
index 1b96181b5..e0bf9b1df 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionAddUpdateWindowLayout.java
@@ -147,7 +147,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distNameTextField = createTextField("textfield.name", SPUIComponentIdProvider.DIST_ADD_NAME);
distVersionTextField = createTextField("textfield.version", SPUIComponentIdProvider.DIST_ADD_VERSION);
- distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", "", null, "",
+ distsetTypeNameComboBox = SPUIComponentProvider.getComboBox(i18n.get("label.combobox.type"), "", null, "",
false, "", i18n.get("label.combobox.type"));
distsetTypeNameComboBox.setImmediate(true);
distsetTypeNameComboBox.setNullSelectionAllowed(false);
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java
index b6b616417..3bf60df52 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java
@@ -18,7 +18,6 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
-import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.eventbus.event.DistributionCreatedEvent;
@@ -84,7 +83,7 @@ public class DistributionTable extends AbstractNamedVersionTable= 1 && managementUIState.getDistributionTableFilters().isNoTagSelected()) {
refreshFilter();
}
@@ -414,7 +410,8 @@ public class DistributionTable extends AbstractNamedVersionTable distributionSetTypeCollection = distributionSetManagement
.findDistributionSetTypesAll(pageReq);
- combobox = SPUIComponentProvider.getComboBox(null, "", "330", null, null, false, "", "label.combobox.tag");
+ combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
combobox.setId(SPUIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
combobox.setNullSelectionAllowed(false);
for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
index e20d4cbae..d8e93350b 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
@@ -8,11 +8,9 @@
*/
package org.eclipse.hawkbit.ui.utils;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.TimeZone;
@@ -37,10 +35,8 @@ import org.vaadin.alump.distributionbar.DistributionBar;
import com.google.common.base.Strings;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
-import com.vaadin.server.Sizeable.Unit;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
@@ -174,58 +170,6 @@ public final class HawkbitCommonUtil {
return boldStr;
}
- /**
- * Get target label Id.
- *
- * @param controllerId
- * as String
- * @return String as label name
- */
- public static String getTargetLabelId(final String controllerId) {
- return new StringBuilder("target").append('.').append(controllerId).toString();
- }
-
- /**
- * Get distribution table cell id.
- *
- * @param name
- * distribution name
- * @param version
- * distribution version
- * @return String distribution label id
- */
- public static String getDistributionLabelId(final String name, final String version) {
- return new StringBuilder("dist").append('.').append(name).append('.').append(version).toString();
- }
-
- /**
- * Get software module label id.
- *
- * @param name
- * software module name
- * @param version
- * software module version
- * @return String software module label id
- */
- public static String getSwModuleLabelId(final String name, final String version) {
- return new StringBuilder("swModule").append('.').append(name).append('.').append(version).toString();
- }
-
- /**
- * Get label with software module name and description.
- *
- * @param name
- * software module name
- * @param desc
- * software module description
- * @return String
- */
- public static String getSwModuleNameDescLabel(final String name, final String desc) {
- return new StringBuilder().append(
- DIV_DESCRIPTION_START + getBoldHTMLText(getFormattedName(name)) + "
" + getFormattedName(desc))
- .append(DIV_DESCRIPTION_END).toString();
- }
-
/**
* Get Label for Artifact Details.
*
@@ -294,31 +238,6 @@ public final class HawkbitCommonUtil {
return trimAndNullIfEmpty(orgText) == null ? SPUIDefinitions.SPACE : orgText;
}
- /**
- * Find extra height required to increase by all the components to utilize
- * the full height of browser for the responsive UI.
- *
- * @param newBrowserHeight
- * as current browser height.
- * @return extra height required to increase.
- */
- public static float findRequiredExtraHeight(final float newBrowserHeight) {
- return newBrowserHeight > SPUIDefinitions.REQ_MIN_BROWSER_HEIGHT
- ? (newBrowserHeight - SPUIDefinitions.REQ_MIN_BROWSER_HEIGHT) : 0;
- }
-
- /**
- * Find required extra height of software module.
- *
- * @param newBrowserHeight
- * new browser height
- * @return float heigth of software module table
- */
- public static float findRequiredSwModuleExtraHeight(final float newBrowserHeight) {
- return newBrowserHeight > SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_HEIGHT
- ? (newBrowserHeight - SPUIDefinitions.REQ_MIN_UPLOAD_BROWSER_HEIGHT) : 0;
- }
-
/**
* Find required extra width of software module.
*
@@ -363,94 +282,6 @@ public final class HawkbitCommonUtil {
return extraWidth + minPopupHeight;
}
- /**
- * Find extra width required to increase by all the components to utilize
- * the full width of browser for the responsive UI.
- *
- * @param newBrowserWidth
- * as current browser width.
- * @return extra width required to be increased.
- */
- public static float findRequiredExtraWidth(final float newBrowserWidth) {
- float width = 0;
- if (newBrowserWidth < SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) {
- width = SPUIDefinitions.REQ_MIN_BROWSER_WIDTH - newBrowserWidth;
- }
- return width;
- }
-
- /**
- * Find extra width required to increase by all the components to utilize
- * the full width of browser for the responsive UI.
- *
- * @param newBrowserWidth
- * as current browser width.
- * @return extra width required to be increased.
- */
- public static float findExtraWidth(final float newBrowserWidth) {
- return newBrowserWidth > SPUIDefinitions.REQ_MIN_BROWSER_WIDTH
- ? (newBrowserWidth - SPUIDefinitions.REQ_MIN_BROWSER_WIDTH) : 0;
- }
-
- /**
- * Get target table width based on screen width.
- *
- * @param newBrowserWidth
- * new browser width.
- * @param minTargetTableLength
- * minimum target table width.
- * @param minDistTableLength
- * minimum distribution table width.
- * @return float as table width
- */
- public static float getTargetTableWidth(final float newBrowserWidth, final float minTargetTableLength,
- final float minDistTableLength) {
- float width = 0;
- final float requiredExtraWidth = findRequiredExtraWidth(newBrowserWidth);
- // adjusting the target table width if distribution table width has
- // reached the maximum width
- if (requiredExtraWidth + minDistTableLength > SPUIDefinitions.MAX_DIST_TABLE_WIDTH) {
- width = requiredExtraWidth + minDistTableLength - SPUIDefinitions.MAX_DIST_TABLE_WIDTH;
- }
- if (width + minTargetTableLength + requiredExtraWidth > SPUIDefinitions.MAX_TARGET_TABLE_WIDTH) {
- return SPUIDefinitions.MAX_TARGET_TABLE_WIDTH;
- }
- return width + minTargetTableLength + requiredExtraWidth;
- }
-
- /**
- * Get distribution table width based on screen width.
- *
- * @param newBrowserWidth
- * new browser width.
- * @param minTableWidth
- * min distribution table width.
- * @return float as distribution table width.
- */
- public static float getDistTableWidth(final float newBrowserWidth, final float minTableWidth) {
- final float requiredExtraWidth = findExtraWidth(newBrowserWidth);
- float expectedDistWidth = minTableWidth;
- if (requiredExtraWidth > 0) {
- expectedDistWidth = expectedDistWidth + Math.round(requiredExtraWidth * 0.5F);
- }
- return expectedDistWidth;
- }
-
- /**
- * Get software module table width.
- *
- * @param newBrowserWidth
- * @param minTableWidth
- * @return
- */
- public static float getSoftwareModuleTableWidth(final float newBrowserWidth, final float minTableWidth) {
- final float requiredExtraWidth = findRequiredExtraWidth(newBrowserWidth);
- if (requiredExtraWidth + minTableWidth > SPUIDefinitions.MAX_UPLOAD_SW_MODULE_TABLE_WIDTH) {
- return SPUIDefinitions.MAX_UPLOAD_SW_MODULE_TABLE_WIDTH;
- }
- return requiredExtraWidth + minTableWidth;
- }
-
/**
* Remove the prefix from text.
*
@@ -514,55 +345,6 @@ public final class HawkbitCommonUtil {
return name + ":" + version;
}
- /**
- * Set height of artifact details table and drop area layout.
- *
- * @param dropLayout
- * drop area layout
- * @param artifactDetailsLayout
- * artifact details table
- * @param newHeight
- * new browser height
- */
- public static void setArtifactDetailsLayoutHeight(final Component artifactDetailsLayout, final float newHeight) {
- final float extraBrowserHeight = HawkbitCommonUtil.findRequiredSwModuleExtraHeight(newHeight);
- final float tableHeight = SPUIDefinitions.MIN_UPLOAD_ARTIFACT_TABLE_HEIGHT + extraBrowserHeight;
- artifactDetailsLayout.setHeight(tableHeight, Unit.PIXELS);
- }
-
- /**
- * Set height of artifact details table and drop area layout.
- *
- * @param artifactDetailsLayout
- * artifact details table
- * @param newHeight
- * new browser height
- */
- public static void setManageDistArtifactDetailsLayoutHeight(final Component artifactDetailsLayout,
- final float newHeight) {
- final float tableHeight = SPUIDefinitions.MIN_TARGET_DIST_TABLE_HEIGHT
- + HawkbitCommonUtil.findRequiredExtraHeight(newHeight) + 62;
- artifactDetailsLayout.setHeight(tableHeight, Unit.PIXELS);
- }
-
- /**
- * Duplicate check - Unique Key.
- *
- * @param name
- * as string
- * @param version
- * as string
- * @param type
- * key as string
- * @return boolean as flag
- */
- public static boolean isDuplicate(final String name, final String version, final String type) {
- final SoftwareManagement swMgmtService = SpringContextHelper.getBean(SoftwareManagement.class);
- final SoftwareModule swModule = swMgmtService.findSoftwareModuleByNameAndVersion(name, version,
- swMgmtService.findSoftwareModuleTypeByName(type));
- return swModule != null;
- }
-
/**
* Add new base software module.
*
@@ -593,15 +375,6 @@ public final class HawkbitCommonUtil {
return newSWModule;
}
- public static void setTargetVisibleColumns(final Table targTable) {
- final List