Fixed broken rollout management API concerning target status map. (#365)

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-11-23 20:57:29 +01:00
committed by Michael Hirsch
parent 54ba35966e
commit a57165686e
15 changed files with 363 additions and 118 deletions

View File

@@ -37,8 +37,8 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity {
@JsonProperty(required = true)
private Long totalTargets;
@JsonProperty(required = true)
private final Map<String, Long> totalTargetsPerStatus = new HashMap<>();
@JsonProperty
private Map<String, Long> totalTargetsPerStatus;
/**
* @return the status
@@ -121,4 +121,12 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity {
public Map<String, Long> getTotalTargetsPerStatus() {
return totalTargetsPerStatus;
}
public void addTotalTargetsPerStatus(final String status, final Long totalTargetCountByStatus) {
if (totalTargetsPerStatus == null) {
totalTargetsPerStatus = new HashMap<>();
}
totalTargetsPerStatus.put(status, totalTargetCountByStatus);
}
}

View File

@@ -8,14 +8,14 @@
*/
package org.eclipse.hawkbit.mgmt.json.model.rolloutgroup;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;
/**
* Model for the rollout group annotated with json-annotations for easier
* serialization and de-serialization.
@@ -32,34 +32,20 @@ public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup {
private int totalTargets;
private final Map<String, Long> totalTargetsPerStatus = new HashMap<>();
private Map<String, Long> totalTargetsPerStatus;
/**
* @return the rolloutGroupId
*/
public Long getRolloutGroupId() {
return rolloutGroupId;
}
/**
* @param rolloutGroupId
* the rolloutGroupId to set
*/
public void setRolloutGroupId(final Long rolloutGroupId) {
this.rolloutGroupId = rolloutGroupId;
}
/**
* @return the status
*/
public String getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(final String status) {
this.status = status;
}
@@ -68,7 +54,7 @@ public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup {
return totalTargets;
}
public void setTotalTargets(int totalTargets) {
public void setTotalTargets(final int totalTargets) {
this.totalTargets = totalTargets;
}
@@ -76,4 +62,12 @@ public class MgmtRolloutGroupResponseBody extends MgmtRolloutGroup {
return totalTargetsPerStatus;
}
public void addTotalTargetsPerStatus(final String status, final Long totalTargetCountByStatus) {
if (totalTargetsPerStatus == null) {
totalTargetsPerStatus = new HashMap<>();
}
totalTargetsPerStatus.put(status, totalTargetCountByStatus);
}
}