introduced open actionIds in MgmtTargetAssignmentResponseBody (#864)
* introduced open actionIds in MgmtTargetAssignmentResponseBody Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed SonarQube issues Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * removed unused method parameter Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * updated documentation tests Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * added limit to the alreadyAssignedActions in the AssignmentResult Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * moved alreadyAssignedActions limitation to MgmtDistributionSetMapper Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * removed alreadyAssignedActions Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed sonarQube issues Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed compilation error Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed PR review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed PR review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * Renamed AssignmentResult to AbstractAssignmentResult Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed review findings Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * fixed formatting Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com> * reverted method visibility Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
973f1952c7
commit
d40b11d2ab
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionId;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSet;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtDistributionSetRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtTargetAssignmentResponseBody;
|
||||
@@ -137,9 +138,9 @@ public final class MgmtDistributionSetMapper {
|
||||
|
||||
static MgmtTargetAssignmentResponseBody toResponse(final DistributionSetAssignmentResult dsAssignmentResult) {
|
||||
final MgmtTargetAssignmentResponseBody result = new MgmtTargetAssignmentResponseBody();
|
||||
result.setAssigned(dsAssignmentResult.getAssigned());
|
||||
result.setAlreadyAssigned(dsAssignmentResult.getAlreadyAssigned());
|
||||
result.setTotal(dsAssignmentResult.getTotal());
|
||||
result.setAssignedActions(dsAssignmentResult.getAssignedEntity().stream()
|
||||
.map(a -> new MgmtActionId(a.getTarget().getControllerId(), a.getId())).collect(Collectors.toList()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -286,7 +286,8 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
|
||||
if (offline) {
|
||||
return ResponseEntity.ok(MgmtDistributionSetMapper.toResponse(
|
||||
deploymentManagement.offlineAssignedDistributionSet(dsId.getId(), Arrays.asList(targetId))));
|
||||
deploymentManagement.offlineAssignedDistributionSet(dsId.getId(),
|
||||
Collections.singletonList(targetId))));
|
||||
}
|
||||
|
||||
findTargetWithExceptionIfNotFound(targetId);
|
||||
@@ -294,7 +295,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
|
||||
if (maintenanceWindow == null) {
|
||||
return ResponseEntity.ok(MgmtDistributionSetMapper.toResponse(this.deploymentManagement
|
||||
.assignDistributionSet(dsId.getId(), Arrays.asList(new TargetWithActionType(targetId,
|
||||
.assignDistributionSet(dsId.getId(), Collections.singletonList(new TargetWithActionType(targetId,
|
||||
MgmtRestModelMapper.convertActionType(dsId.getType()), dsId.getForcetime())))));
|
||||
}
|
||||
|
||||
@@ -306,7 +307,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
|
||||
return ResponseEntity
|
||||
.ok(MgmtDistributionSetMapper.toResponse(this.deploymentManagement.assignDistributionSet(dsId.getId(),
|
||||
Arrays.asList(new TargetWithActionType(targetId,
|
||||
Collections.singletonList(new TargetWithActionType(targetId,
|
||||
MgmtRestModelMapper.convertActionType(dsId.getType()), dsId.getForcetime(),
|
||||
cronSchedule, duration, timezone)))));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user