bug 9651: added tags to network response for ui

This commit is contained in:
Alex Huang 2011-06-07 15:08:04 -07:00
parent 0a1e93e957
commit 246c01b1ab
2 changed files with 18 additions and 1 deletions

View File

@ -116,6 +116,9 @@ public class NetworkResponse extends BaseResponse{
@SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) @Param(description="true if security group is enabled, false otherwise")
private Boolean isSecurityGroupEnabled;
@SerializedName(ApiConstants.TAGS) @Param(description="comma separated tag")
private String tags;
public Long getId() {
return id;
}
@ -356,4 +359,17 @@ public class NetworkResponse extends BaseResponse{
this.isSecurityGroupEnabled = sgEnabled;
}
public void setTags(List<String> tags) {
if (tags == null || tags.size() == 0) {
return;
}
StringBuilder buf = new StringBuilder();
for (String tag : tags) {
buf.append(tag).append(",");
}
this.tags = buf.delete(buf.length()-1, buf.length()).toString();
}
}

View File

@ -956,7 +956,7 @@ public class ApiResponseHelper implements ResponseGenerator {
FirewallRuleResponse response = new FirewallRuleResponse();
response.setId(fwRule.getId());
response.setPrivateStartPort(Integer.toString(fwRule.getDestinationPortStart()));
response.setPrivateEndPort(Integer.toString(fwRule.getDestinationPortEnd()));
response.setPrivateEndPort(Integer.toString(fwRule.getDestinationPortEnd()));
response.setProtocol(fwRule.getProtocol());
response.setPublicStartPort(Integer.toString(fwRule.getSourcePortStart()));
response.setPublicEndPort(Integer.toString(fwRule.getSourcePortEnd()));
@ -2488,6 +2488,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setDns2(profile.getDns2());
response.setIsSecurityGroupEnabled(network.isSecurityGroupEnabled());
response.setTags(network.getTags());
// populate capability
Map<Service, Map<Capability, String>> serviceCapabilitiesMap = ApiDBUtils.getNetworkCapabilities(networkOffering.getId(), network.getDataCenterId());