Fix ControlledEntityResponse interface to remove IdentityProxy for

projectId and domainId.

Signed-off-by: Min Chen <min.chen@citrix.com>
This commit is contained in:
Min Chen 2012-12-17 23:24:08 -08:00
parent 57eda4e3f4
commit 3d344738b1
29 changed files with 231 additions and 222 deletions

View File

@ -23,6 +23,8 @@ public interface AutoScalePolicy extends ControlledEntity {
long getId();
String getUuid();
public int getDuration();
public int getQuietTime();

View File

@ -118,23 +118,26 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
@Override
public void execute(){
VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
}
VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
}
VpnUsersResponse vpnResponse = new VpnUsersResponse();
vpnResponse.setId(vpnUser.getId());
vpnResponse.setUserName(vpnUser.getUsername());
vpnResponse.setAccountName(account.getAccountName());
VpnUsersResponse vpnResponse = new VpnUsersResponse();
vpnResponse.setId(vpnUser.getId());
vpnResponse.setUserName(vpnUser.getUsername());
vpnResponse.setAccountName(account.getAccountName());
vpnResponse.setDomainId(account.getDomainId());
vpnResponse.setDomainName(_entityMgr.findById(Domain.class, account.getDomainId()).getName());
Domain domain = _entityMgr.findById(Domain.class, account.getDomainId());
if (domain != null) {
vpnResponse.setDomainId(domain.getUuid());
vpnResponse.setDomainName(domain.getName());
}
vpnResponse.setResponseName(getCommandName());
vpnResponse.setObjectName("vpnuser");
this.setResponseObject(vpnResponse);
vpnResponse.setResponseName(getCommandName());
vpnResponse.setObjectName("vpnuser");
this.setResponseObject(vpnResponse);
}
@Override

View File

@ -17,7 +17,6 @@
package org.apache.cloudstack.api.response;
import org.apache.cloudstack.api.ApiConstants;
import com.cloud.utils.IdentityProxy;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
@ -28,7 +27,7 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
@SerializedName(ApiConstants.ID)
@Param(description = "the autoscale policy ID")
private IdentityProxy id = new IdentityProxy("autoscale_policies");
private String id;
@SerializedName(ApiConstants.ACTION)
@Param(description = "the action to be executed if all the conditions evaluate to true for the specified duration.")
@ -50,19 +49,19 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id autoscale policy")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the autoscale policy")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the autoscale policy")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the autoscale policy")
private String domainName;
public void setId(Long id) {
this.id.setValue(id);
public void setId(String id) {
this.id = id;
}
public void setDuration(Integer duration) {
@ -86,9 +85,11 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
this.accountName = accountName;
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -97,8 +98,8 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledE
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -66,13 +66,13 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id vm profile")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vm profile")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the vm profile")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the vm profile")
private String domainName;
@ -122,9 +122,10 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
this.accountName = accountName;
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -133,8 +134,8 @@ public class AutoScaleVmGroupResponse extends BaseResponse implements Controlled
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -75,7 +75,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id vm profile")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT)
@Param(description = "the project name of the vm profile")
@ -83,7 +83,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID of the vm profile")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain name of the vm profile")
@ -128,8 +128,8 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -138,8 +138,8 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -45,7 +45,7 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain id of the Condition owner")
private final IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain name of the owner.")
@ -57,7 +57,7 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the Condition.")
private final IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT)
@Param(description = "the project name of the Condition")
@ -93,8 +93,8 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public void setZoneId(Long zoneId) {
@ -107,8 +107,8 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override

View File

@ -20,11 +20,11 @@ public interface ControlledEntityResponse {
public void setAccountName(String accountName);
public void setProjectId(Long projectId);
public void setProjectId(String projectId);
public void setProjectName(String projectName);
public void setDomainId(Long domainId);
public void setDomainId(String domainId);
public void setDomainName(String domainName);
}

View File

@ -49,13 +49,13 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID the public IP address is associated with")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain the public IP address is associated with")
private String domainName;
@ -140,8 +140,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -203,8 +203,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -66,14 +66,14 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the load balancer")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the load balancer")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID of the load balancer rule")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain of the load balancer rule")
@ -126,8 +126,9 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
@ -147,8 +148,8 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -106,13 +106,13 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the network owner")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the network owner")
private String domain;
@ -204,8 +204,9 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setNetworkOfferingName(String networkOfferingName) {
@ -249,8 +250,8 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -56,14 +56,14 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the private gateway")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the private gateway")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the ID of the domain associated with the private gateway")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain associated with the private gateway")
@ -115,8 +115,8 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -125,8 +125,8 @@ public class PrivateGatewayResponse extends BaseResponse implements ControlledEn
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -41,13 +41,13 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the account of the remote access vpn")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the account of the remote access vpn")
private String domainName;
@ -71,8 +71,9 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String name) {
@ -88,8 +89,8 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledE
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -28,14 +28,14 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id for which resource count's are updated")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name for which resource count's are updated")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID for which resource count's are updated")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name for which resource count's are updated")
private String domainName;
@ -52,8 +52,8 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -70,8 +70,8 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -28,7 +28,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the resource limit")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the resource limit")
private String domainName;
@ -40,7 +40,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
private Long max;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the resource limit")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the resource limit")
private String projectName;
@ -56,8 +56,8 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -74,7 +74,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
}

View File

@ -63,13 +63,13 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponse implements Co
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the owner")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the owner")
private String domain;
@ -131,8 +131,8 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponse implements Co
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
@ -141,8 +141,8 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponse implements Co
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override

View File

@ -69,13 +69,13 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the owner")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the owner")
private String domain;
@ -152,8 +152,8 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
@ -162,8 +162,8 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override

View File

@ -39,13 +39,13 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the owner")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the owner")
private String domain;
@ -75,8 +75,8 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
@ -85,8 +85,8 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override

View File

@ -38,14 +38,14 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID of the snapshot's account")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain name of the snapshot's account")
private String domainName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the snapshot")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the snapshot")
private String projectName;
@ -106,12 +106,13 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
this.accountName = accountName;
}
public Long getDomainId() {
return domainId.getValue();
public String getDomainId() {
return domainId;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
@ -151,8 +152,8 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -46,14 +46,14 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the static route")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the static route")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the ID of the domain associated with the static route")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain associated with the static route")
@ -89,8 +89,8 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
@ -99,8 +99,8 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -101,7 +101,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
private String domainName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain to which the template belongs")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.IS_EXTRACTABLE) @Param(description="true if the template is extractable, false otherwise")
private Boolean extractable;
@ -122,7 +122,7 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
private String templateTag;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the template")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the template")
private String projectName;
@ -237,8 +237,8 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setExtractable(Boolean extractable) {
@ -266,8 +266,8 @@ public class TemplateResponse extends BaseResponse implements ControlledEntityRe
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -200,6 +200,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
this.accountName = accountName;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@ -340,6 +341,7 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
this.securityGroupList.add(securityGroup);
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@ -373,21 +375,4 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
this.keyPairName = keyPairName;
}
@Override
public void setProjectId(Long projectId) {
// TODO: remove this later
}
@Override
public void setDomainId(Long domainId) {
// TODO: remove this later
}
public void setProjectUuid(String projectUuid){
this.projectId = projectUuid;
}
public void setDomainUuid(String domainUuid){
this.domainId = domainUuid;
}
}

View File

@ -36,13 +36,13 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the ipaddress")
private Long projectId;
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the address")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID associated with the provider")
private Long domainId;
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain associated with the provider")
private String domainName;
@ -57,7 +57,7 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
}
@Override
public void setDomainId(Long domainId) {
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@ -67,7 +67,7 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr
}
@Override
public void setProjectId(Long projectId) {
public void setProjectId(String projectId) {
this.projectId = projectId;
}

View File

@ -40,7 +40,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID of the VLAN IP range")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the VLAN IP range")
private String domainName;
@ -70,7 +70,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
private IdentityProxy networkId = new IdentityProxy("networks");
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vlan range")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vlan range")
private String projectName;
@ -98,8 +98,8 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
@ -139,8 +139,8 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -84,14 +84,14 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the ID of the domain associated with the disk volume")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the domain associated with the disk volume")
@ -225,8 +225,9 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
@ -290,8 +291,8 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -61,13 +61,13 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the VPC")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the VPC")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the VPC owner")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the owner")
private String domain;
@ -114,8 +114,8 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
@ -124,8 +124,8 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override

View File

@ -34,13 +34,13 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the account of the remote access vpn")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the account of the remote access vpn")
private String domainName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn")
private String projectName;
@ -58,8 +58,9 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
this.accountName = accountName;
}
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String name) {
@ -67,8 +68,8 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override

View File

@ -1519,7 +1519,6 @@ public class ApiResponseHelper implements ResponseGenerator {
vpnResponse.setPublicIp(ApiDBUtils.findIpAddressById(vpn.getServerAddressId()).getAddress().addr());
vpnResponse.setIpRange(vpn.getIpRange());
vpnResponse.setPresharedKey(vpn.getIpsecPresharedKey());
vpnResponse.setDomainId(vpn.getDomainId());
populateOwner(vpnResponse, vpn);
@ -2699,14 +2698,21 @@ public class ApiResponseHelper implements ResponseGenerator {
} else {
// get domain from network_domain table
Pair<Long, Boolean> domainNetworkDetails = ApiDBUtils.getDomainNetworkDetails(network.getId());
response.setDomainId(domainNetworkDetails.first());
if (domainNetworkDetails.first() != null) {
Domain domain = ApiDBUtils.findDomainById(domainNetworkDetails.first());
if (domain != null) {
response.setDomainId(domain.getUuid());
}
}
response.setSubdomainAccess(domainNetworkDetails.second());
}
Long dedicatedDomainId = ApiDBUtils.getDedicatedNetworkDomain(network.getId());
if (dedicatedDomainId != null) {
Domain domain = ApiDBUtils.findDomainById(dedicatedDomainId);
response.setDomainId(dedicatedDomainId);
if (domain != null) {
response.setDomainId(domain.getUuid());
}
response.setDomainName(domain.getName());
}
@ -2854,14 +2860,14 @@ public class ApiResponseHelper implements ResponseGenerator {
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
// find the project
Project project = ApiDBUtils.findProjectByProjectAccountIdIncludingRemoved(account.getId());
response.setProjectId(project.getId());
response.setProjectId(project.getUuid());
response.setProjectName(project.getName());
} else {
response.setAccountName(account.getAccountName());
}
Domain domain = ApiDBUtils.findDomainById(object.getDomainId());
response.setDomainId(domain.getId());
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
}
@ -2883,7 +2889,7 @@ public class ApiResponseHelper implements ResponseGenerator {
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
// find the project
Project project = ApiDBUtils.findProjectByProjectAccountIdIncludingRemoved(account.getId());
response.setProjectId(project.getId());
response.setProjectId(project.getUuid());
response.setProjectName(project.getName());
} else {
response.setAccountName(account.getAccountName());
@ -2893,7 +2899,7 @@ public class ApiResponseHelper implements ResponseGenerator {
private void populateDomain(ControlledEntityResponse response, long domainId) {
Domain domain = ApiDBUtils.findDomainById(domainId);
response.setDomainId(domain.getId());
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
}
@ -3319,7 +3325,7 @@ public class ApiResponseHelper implements ResponseGenerator {
@Override
public AutoScalePolicyResponse createAutoScalePolicyResponse(AutoScalePolicy policy) {
AutoScalePolicyResponse response = new AutoScalePolicyResponse();
response.setId(policy.getId());
response.setId(policy.getUuid());
response.setDuration(policy.getDuration());
response.setQuietTime(policy.getQuietTime());
response.setAction(policy.getAction());

View File

@ -27,6 +27,8 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import com.cloud.api.ApiDBUtils;
import com.cloud.domain.Domain;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
@ -63,15 +65,15 @@ public class GetUsageRecordsCmd extends BaseListCmd {
@Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, required=true, description="Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
private Date startDate;
@IdentityMapper(entityTableName="account")
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.LONG, description="List usage records for the specified account")
private Long accountId;
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="List usage records for specified project")
private Long projectId;
@Parameter(name=ApiConstants.TYPE, type=CommandType.LONG, description="List usage records for the specified usage type")
private Long usageType;
@ -94,7 +96,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
public Date getStartDate() {
return startDate;
}
public Long getAccountId() {
return accountId;
}
@ -102,11 +104,11 @@ public class GetUsageRecordsCmd extends BaseListCmd {
public Long getUsageType() {
return usageType;
}
public Long getProjectId() {
return projectId;
}
/////////////////////////////////////////////////////
/////////////// Misc parameters ///////////////////
/////////////////////////////////////////////////////
@ -162,7 +164,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
} else {
sb.append(hour+":");
}
int minute = cal.get(Calendar.MINUTE);
if (minute < 10) {
sb.append("0" + minute + ":");
@ -213,7 +215,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
return sb.toString();
}
@Override
public void execute(){
ManagementServerExt _mgrExt = (ManagementServerExt)_mgr;
@ -225,20 +227,23 @@ public class GetUsageRecordsCmd extends BaseListCmd {
UsageRecordResponse usageRecResponse = new UsageRecordResponse();
if (usageRecordGeneric instanceof UsageVO) {
UsageVO usageRecord = (UsageVO)usageRecordGeneric;
Account account = ApiDBUtils.findAccountByIdIncludingRemoved(usageRecord.getAccountId());
Account account = ApiDBUtils.findAccountByIdIncludingRemoved(usageRecord.getAccountId());
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
//find the project
Project project = ApiDBUtils.findProjectByProjectAccountId(account.getId());
usageRecResponse.setProjectId(project.getId());
usageRecResponse.setProjectId(project.getUuid());
usageRecResponse.setProjectName(project.getName());
} else {
usageRecResponse.setAccountId(account.getId());
usageRecResponse.setAccountName(account.getAccountName());
}
usageRecResponse.setDomainId(usageRecord.getDomainId());
Domain domain = ApiDBUtils.findDomainById(usageRecord.getDomainId());
if (domain != null) {
usageRecResponse.setDomainId(domain.getUuid());
}
usageRecResponse.setZoneId(usageRecord.getZoneId());
usageRecResponse.setDescription(usageRecord.getDescription());
usageRecResponse.setUsage(usageRecord.getUsageDisplay());
@ -246,7 +251,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
usageRecResponse.setVirtualMachineId(usageRecord.getVmInstanceId());
usageRecResponse.setVmName(usageRecord.getVmName());
usageRecResponse.setTemplateId(usageRecord.getTemplateId());
if(usageRecord.getUsageType() == UsageTypes.RUNNING_VM || usageRecord.getUsageType() == UsageTypes.ALLOCATED_VM){
//Service Offering Id
usageRecResponse.setOfferingId(identityDao.getIdentityUuid("disk_offering", usageRecord.getOfferingId().toString()));
@ -254,7 +259,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
usageRecResponse.setUsageId(identityDao.getIdentityUuid("vm_instance", usageRecord.getUsageId().toString()));
//Hypervisor Type
usageRecResponse.setType(usageRecord.getType());
} else if(usageRecord.getUsageType() == UsageTypes.IP_ADDRESS){
//isSourceNAT
usageRecResponse.setSourceNat((usageRecord.getType().equals("SourceNat"))?true:false);
@ -262,7 +267,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
usageRecResponse.setSystem((usageRecord.getSize() == 1)?true:false);
//IP Address ID
usageRecResponse.setUsageId(identityDao.getIdentityUuid("user_ip_address", usageRecord.getUsageId().toString()));
} else if(usageRecord.getUsageType() == UsageTypes.NETWORK_BYTES_SENT || usageRecord.getUsageType() == UsageTypes.NETWORK_BYTES_RECEIVED){
//Device Type
usageRecResponse.setType(usageRecord.getType());
@ -271,11 +276,11 @@ public class GetUsageRecordsCmd extends BaseListCmd {
usageRecResponse.setUsageId(identityDao.getIdentityUuid("vm_instance", usageRecord.getUsageId().toString()));
} else {
//External Device Host Id
usageRecResponse.setUsageId(identityDao.getIdentityUuid("host", usageRecord.getUsageId().toString()));
usageRecResponse.setUsageId(identityDao.getIdentityUuid("host", usageRecord.getUsageId().toString()));
}
//Network ID
usageRecResponse.setNetworkId(identityDao.getIdentityUuid("networks", usageRecord.getNetworkId().toString()));
} else if(usageRecord.getUsageType() == UsageTypes.VOLUME){
//Volume ID
usageRecResponse.setUsageId(identityDao.getIdentityUuid("volumes", usageRecord.getUsageId().toString()));
@ -291,36 +296,36 @@ public class GetUsageRecordsCmd extends BaseListCmd {
usageRecResponse.setUsageId(identityDao.getIdentityUuid("vm_template", usageRecord.getUsageId().toString()));
//Template/ISO Size
usageRecResponse.setSize(usageRecord.getSize());
} else if(usageRecord.getUsageType() == UsageTypes.SNAPSHOT){
//Snapshot ID
usageRecResponse.setUsageId(identityDao.getIdentityUuid("snapshots", usageRecord.getUsageId().toString()));
//Snapshot Size
usageRecResponse.setSize(usageRecord.getSize());
} else if(usageRecord.getUsageType() == UsageTypes.LOAD_BALANCER_POLICY){
//Load Balancer Policy ID
usageRecResponse.setUsageId(usageRecord.getUsageId().toString());
} else if(usageRecord.getUsageType() == UsageTypes.PORT_FORWARDING_RULE){
//Port Forwarding Rule ID
usageRecResponse.setUsageId(usageRecord.getUsageId().toString());
} else if(usageRecord.getUsageType() == UsageTypes.NETWORK_OFFERING){
//Network Offering Id
usageRecResponse.setOfferingId(identityDao.getIdentityUuid("network_offerings", usageRecord.getOfferingId().toString()));
//is Default
usageRecResponse.setDefault((usageRecord.getUsageId() == 1)? true:false);
} else if(usageRecord.getUsageType() == UsageTypes.VPN_USERS){
//VPN User ID
usageRecResponse.setUsageId(usageRecord.getUsageId().toString());
} else if(usageRecord.getUsageType() == UsageTypes.SECURITY_GROUP){
//Security Group Id
usageRecResponse.setUsageId(identityDao.getIdentityUuid("security_group", usageRecord.getUsageId().toString()));
}
if (usageRecord.getRawUsage() != null) {
DecimalFormat decimalFormat = new DecimalFormat("###########.######");
usageRecResponse.setRawUsage(decimalFormat.format(usageRecord.getRawUsage()));
@ -332,7 +337,7 @@ public class GetUsageRecordsCmd extends BaseListCmd {
if (usageRecord.getEndDate() != null) {
usageRecResponse.setEndDate(getDateStringInternal(usageRecord.getEndDate()));
}
}
}
usageRecResponse.setObjectName("usagerecord");
usageResponses.add(usageRecResponse);

View File

@ -27,19 +27,19 @@ import com.google.gson.annotations.SerializedName;
public class UsageRecordResponse extends BaseResponse implements ControlledEntityResponse{
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the user account name")
private String accountName;
@SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the user account Id")
private IdentityProxy accountId = new IdentityProxy("account");
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the resource")
private IdentityProxy projectId = new IdentityProxy("projects");
private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the resource")
private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID")
private IdentityProxy domainId = new IdentityProxy("domain");
private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain the resource is associated with")
private String domainName;
@ -72,7 +72,7 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit
@SerializedName("usageid") @Param(description="id of the resource")
private String usageId;
@SerializedName(ApiConstants.TYPE) @Param(description="resource type")
private String type;
@ -90,13 +90,13 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit
@SerializedName(ApiConstants.IS_SYSTEM) @Param(description="True if the IPAddress is system IP - allocated during vm deploy or lb rule create")
private Boolean isSystem;
@SerializedName("networkid") @Param(description="id of the network")
private String networkId;
@SerializedName("isdefault") @Param(description="True if the resource is default")
private Boolean isDefault;
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
@ -105,10 +105,10 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit
public void setAccountId(Long accountId) {
this.accountId.setValue(accountId);
}
@Override
public void setDomainId(Long domainId) {
this.domainId.setValue(domainId);
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setZoneId(Long zoneId) {
@ -174,17 +174,17 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit
public void setSystem(Boolean isSystem) {
this.isSystem = isSystem;
}
@Override
public void setProjectId(Long projectId) {
this.projectId.setValue(projectId);
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
@ -193,7 +193,7 @@ public class UsageRecordResponse extends BaseResponse implements ControlledEntit
public void setNetworkId(String networkId) {
this.networkId = networkId;
}
public void setDefault(Boolean isDefault) {
this.isDefault = isDefault;
}