From d2bd6e522e717fcab03cb84aad7278942a73da16 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 Dec 2010 09:57:23 -0800 Subject: [PATCH] bug 7448: add domain parameter in returned objects from listNetworks API. (changed by Alena) --- api/src/com/cloud/api/response/NetworkResponse.java | 13 ++++++++++++- server/src/com/cloud/api/ApiResponseHelper.java | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/src/com/cloud/api/response/NetworkResponse.java b/api/src/com/cloud/api/response/NetworkResponse.java index c62c0610603..f15020f8a8b 100644 --- a/api/src/com/cloud/api/response/NetworkResponse.java +++ b/api/src/com/cloud/api/response/NetworkResponse.java @@ -95,7 +95,8 @@ public class NetworkResponse extends BaseResponse{ @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id associated with the network") private Long domainId; - + @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the network") + private String domain; public Long getId() { return id; @@ -288,4 +289,14 @@ public class NetworkResponse extends BaseResponse{ public void setIsSystem(Boolean isSystem) { this.isSystem = isSystem; } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 088425efaea..9c65cbbe15b 100644 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2412,7 +2412,9 @@ public class ApiResponseHelper implements ResponseGenerator { Account account = ApiDBUtils.findAccountById(network.getAccountId()); if (account != null) { response.setAccountName(account.getAccountName()); - response.setDomainId(account.getDomainId()); + Domain domain = ApiDBUtils.findDomainById(account.getDomainId()); + response.setDomainId(domain.getId()); + response.setDomain(domain.getName()); } response.setObjectName("network"); return response;