Remove IdentityProxy from AutoScale responses.

Signed-off-by: Min Chen <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1aa30f03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1aa30f03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1aa30f03

Branch: refs/heads/api_refactoring
Commit: 1aa30f03e7a99ff3bbfebca4b98823de2a25c359
Parents: a390b27
Author: Min Chen <[email protected]>
Authored: Tue Dec 18 11:19:36 2012 -0800
Committer: Min Chen <[email protected]>
Committed: Tue Dec 18 11:19:36 2012 -0800

----------------------------------------------------------------------
 .../com/cloud/network/as/AutoScaleVmProfile.java   |    2 +
 api/src/com/cloud/offering/DiskOffering.java       |    2 +
 api/src/com/cloud/offering/ServiceOffering.java    |    2 +
 .../api/response/AutoScaleVmGroupResponse.java     |   18 ++--
 .../api/response/AutoScaleVmProfileResponse.java   |   31 +++---
 .../api/response/CloudIdentifierResponse.java      |   11 +-
 .../cloudstack/api/response/ConditionResponse.java |   13 +--
 .../cloudstack/api/response/CounterResponse.java   |    9 +-
 core/src/com/cloud/storage/DiskOfferingVO.java     |   72 +++++++-------
 server/src/com/cloud/api/ApiResponseHelper.java    |   44 +++++++--
 .../com/cloud/migration/ServiceOffering21VO.java   |   56 +++++++-----
 .../com/cloud/network/as/AutoScaleVmProfileVO.java |    2 +-
 12 files changed, 148 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/com/cloud/network/as/AutoScaleVmProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java 
b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
index 8ca5415..b7002fd 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
@@ -29,6 +29,8 @@ public interface AutoScaleVmProfile extends ControlledEntity {
 
     public long getId();
 
+    public String getUuid();
+
     public Long getZoneId();
 
     public Long getServiceOfferingId();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/com/cloud/offering/DiskOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/DiskOffering.java 
b/api/src/com/cloud/offering/DiskOffering.java
index 32a338f..10a045d 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -26,6 +26,8 @@ import java.util.Date;
 public interface DiskOffering {
     long getId();
 
+    String getUuid();
+
     String getUniqueName();
 
     boolean getUseLocalStorage();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/com/cloud/offering/ServiceOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/ServiceOffering.java 
b/api/src/com/cloud/offering/ServiceOffering.java
index 1a1acb2..84950c6 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -34,6 +34,8 @@ public interface ServiceOffering {
 
     long getId();
 
+    String getUuid();
+
     String getDisplayText();
 
     Date getCreated();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java 
b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
index a6ea46f..a4f3da6 100644
--- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java
@@ -28,15 +28,15 @@ public class AutoScaleVmGroupResponse extends BaseResponse 
implements Controlled
 
     @SerializedName(ApiConstants.ID)
     @Param(description = "the autoscale vm group ID")
-    private IdentityProxy id = new IdentityProxy("autoscale_vmgroups");
+    private String id;
 
     @SerializedName(ApiConstants.LBID)
     @Param(description = "the load balancer rule ID")
-    private IdentityProxy loadBalancerId = new IdentityProxy("firewall_rules");
+    private String loadBalancerId;
 
     @SerializedName(ApiConstants.VMPROFILE_ID)
     @Param(description = "the autoscale profile that contains information 
about the vms in the vm group.")
-    private IdentityProxy profileId = new 
IdentityProxy("autoscale_vmprofiles");
+    private String profileId;
 
     @SerializedName(ApiConstants.MIN_MEMBERS)
     @Param(description = "the minimum number of members in the vmgroup, the 
number of instances in the vm group will be equal to or more than this number.")
@@ -81,16 +81,16 @@ public class AutoScaleVmGroupResponse extends BaseResponse 
implements Controlled
 
     }
 
-    public void setId(Long id) {
-        this.id.setValue(id);
+    public void setId(String id) {
+        this.id = id;
     }
 
-    public void setLoadBalancerId(Long loadBalancerId) {
-        this.loadBalancerId.setValue(loadBalancerId);
+    public void setLoadBalancerId(String loadBalancerId) {
+        this.loadBalancerId = loadBalancerId;
     }
 
-    public void setProfileId(Long profileId) {
-        this.profileId.setValue(profileId);
+    public void setProfileId(String profileId) {
+        this.profileId = profileId;
     }
 
     public void setMinMembers(int minMembers) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java 
b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
index cc338bf..0041be9 100644
--- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java
@@ -25,7 +25,6 @@ import org.apache.cloudstack.api.BaseCmd.CommandType;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.Parameter;
 import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
 import com.cloud.utils.Pair;
 import com.google.gson.annotations.SerializedName;
 
@@ -33,20 +32,20 @@ public class AutoScaleVmProfileResponse extends 
BaseResponse implements Controll
 
     @SerializedName(ApiConstants.ID)
     @Param(description = "the autoscale vm profile ID")
-    private IdentityProxy id = new IdentityProxy("autoscale_vmprofiles");
+    private String id;
 
     /* Parameters related to deploy virtual machine */
     @SerializedName(ApiConstants.ZONE_ID)
     @Param(description = "the availability zone to be used while deploying a 
virtual machine")
-    private IdentityProxy zoneId = new IdentityProxy("data_center");
+    private String zoneId;
 
     @SerializedName(ApiConstants.SERVICE_OFFERING_ID)
     @Param(description = "the service offering to be used while deploying a 
virtual machine")
-    private IdentityProxy serviceOfferingId = new 
IdentityProxy("disk_offering");
+    private String serviceOfferingId;
 
     @SerializedName(ApiConstants.TEMPLATE_ID)
     @Param(description = "the template to be used while deploying a virtual 
machine")
-    private IdentityProxy templateId = new IdentityProxy("vm_template");
+    private String templateId;
 
     @SerializedName(ApiConstants.OTHER_DEPLOY_PARAMS)
     @Param(description = "parameters other than 
zoneId/serviceOfferringId/templateId to be used while deploying a virtual 
machine")
@@ -64,7 +63,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse 
implements Controll
 
     @SerializedName(ApiConstants.AUTOSCALE_USER_ID)
     @Param(description = "the ID of the user used to launch and destroy the 
VMs")
-    private IdentityProxy autoscaleUserId = new IdentityProxy("user");
+    private String autoscaleUserId;
 
     @Parameter(name = ApiConstants.CS_URL, type = CommandType.STRING, 
description = "the API URL including port of the CloudStack Management Server 
example: http://server.cloud.com:8080/client/api?";)
     private String csUrl;
@@ -93,20 +92,20 @@ public class AutoScaleVmProfileResponse extends 
BaseResponse implements Controll
 
     }
 
-    public void setId(Long id) {
-        this.id.setValue(id);
+    public void setId(String id) {
+        this.id = id;
     }
 
-    public void setZoneId(Long zoneId) {
-        this.zoneId.setValue(zoneId);
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
     }
 
-    public void setServiceOfferingId(Long serviceOfferingId) {
-        this.serviceOfferingId.setValue(serviceOfferingId);
+    public void setServiceOfferingId(String serviceOfferingId) {
+        this.serviceOfferingId = serviceOfferingId;
     }
 
-    public void setTemplateId(Long templateId) {
-        this.templateId.setValue(templateId);
+    public void setTemplateId(String templateId) {
+        this.templateId = templateId;
     }
 
     public void setOtherDeployParams(String otherDeployParams) {
@@ -147,8 +146,8 @@ public class AutoScaleVmProfileResponse extends 
BaseResponse implements Controll
         this.projectName = projectName;
     }
 
-    public void setAutoscaleUserId(Long autoscaleUserId) {
-        this.autoscaleUserId.setValue(autoscaleUserId);
+    public void setAutoscaleUserId(String autoscaleUserId) {
+        this.autoscaleUserId = autoscaleUserId;
     }
 
     public void setDestroyVmGraceperiod(Integer destroyVmGraceperiod) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java 
b/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
index 2da1221..d6d2fa7 100644
--- a/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java
@@ -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;
@@ -25,7 +24,7 @@ import org.apache.cloudstack.api.BaseResponse;
 public class CloudIdentifierResponse extends BaseResponse {
 
     @SerializedName(ApiConstants.USER_ID) @Param(description="the user ID for 
the cloud identifier")
-    private IdentityProxy userId = new IdentityProxy("user");
+    private String userId;
 
     @SerializedName("cloudidentifier") @Param(description="the cloud 
identifier")
     private String cloudIdentifier;
@@ -33,12 +32,12 @@ public class CloudIdentifierResponse extends BaseResponse {
     @SerializedName("signature") @Param(description="the signed response for 
the cloud identifier")
     private String signature;
 
-    public Long getUserId() {
-        return userId.getValue();
+    public String getUserId() {
+        return userId;
     }
 
-    public void setUserId(Long userId) {
-        this.userId.setValue(userId);
+    public void setUserId(String userId) {
+        this.userId = userId;
     }
 
     public String getCloudIdentifier() {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/org/apache/cloudstack/api/response/ConditionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java 
b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java
index 83ff222..c90e78a 100644
--- a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java
@@ -21,7 +21,6 @@ import java.util.List;
 
 import org.apache.cloudstack.api.ApiConstants;
 import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
@@ -29,7 +28,7 @@ import org.apache.cloudstack.api.BaseResponse;
 public class ConditionResponse extends BaseResponse implements 
ControlledEntityResponse {
     @SerializedName("id")
     @Param(description = "the id of the Condition")
-    private final IdentityProxy id = new IdentityProxy("conditions");
+    private String id;
 
     @SerializedName(value = ApiConstants.THRESHOLD)
     @Param(description = "Threshold Value for the counter.")
@@ -53,7 +52,7 @@ public class ConditionResponse extends BaseResponse 
implements ControlledEntityR
 
     @SerializedName(ApiConstants.ZONE_ID)
     @Param(description = "zone id of counter")
-    private final IdentityProxy zoneId = new IdentityProxy("data_center");
+    private String zoneId;
 
     @SerializedName(ApiConstants.PROJECT_ID)
     @Param(description = "the project id of the Condition.")
@@ -71,8 +70,8 @@ public class ConditionResponse extends BaseResponse 
implements ControlledEntityR
     // ///////////////// Setters ///////////////////////
     // ///////////////////////////////////////////////////
 
-    public void setId(Long id) {
-        this.id.setValue(id);
+    public void setId(String id) {
+        this.id = id;
     }
 
     public void setThreshold(long threshold) {
@@ -97,8 +96,8 @@ public class ConditionResponse extends BaseResponse 
implements ControlledEntityR
         this.projectId = projectId;
     }
 
-    public void setZoneId(Long zoneId) {
-        this.zoneId.setValue(zoneId);
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/api/src/org/apache/cloudstack/api/response/CounterResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/CounterResponse.java 
b/api/src/org/apache/cloudstack/api/response/CounterResponse.java
index f3cf3b3..1d13d68 100644
--- a/api/src/org/apache/cloudstack/api/response/CounterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/CounterResponse.java
@@ -22,7 +22,6 @@ import org.apache.cloudstack.api.Entity;
 
 import com.cloud.network.as.Counter;
 import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
 import com.google.gson.annotations.SerializedName;
 import org.apache.cloudstack.api.BaseResponse;
 
@@ -31,7 +30,7 @@ import org.apache.cloudstack.api.BaseResponse;
 public class CounterResponse extends BaseResponse {
     @SerializedName("id")
     @Param(description = "the id of the Counter")
-    private final IdentityProxy id = new IdentityProxy("counter");
+    private String id;
 
     @SerializedName(value = ApiConstants.NAME)
     @Param(description = "Name of the counter.")
@@ -47,10 +46,10 @@ public class CounterResponse extends BaseResponse {
 
     @SerializedName(ApiConstants.ZONE_ID)
     @Param(description = "zone id of counter")
-    private final IdentityProxy zoneId = new IdentityProxy("data_center");
+    private String zoneId;
 
-    public void setId(Long id) {
-        this.id.setValue(id);
+    public void setId(String id) {
+        this.id = id;
     }
 
     public void setName(String name) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/core/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/DiskOfferingVO.java 
b/core/src/com/cloud/storage/DiskOfferingVO.java
index 10ce0a1..a526712 100755
--- a/core/src/com/cloud/storage/DiskOfferingVO.java
+++ b/core/src/com/cloud/storage/DiskOfferingVO.java
@@ -42,12 +42,12 @@ import com.cloud.utils.db.GenericDao;
 @Table(name="disk_offering")
 @Inheritance(strategy=InheritanceType.JOINED)
 @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, 
length=32)
-public class DiskOfferingVO implements DiskOffering, Identity {
+public class DiskOfferingVO implements DiskOffering {
     public enum Type {
         Disk,
         Service
     };
-    
+
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     @Column(name="id")
@@ -58,7 +58,7 @@ public class DiskOfferingVO implements DiskOffering, Identity 
{
 
     @Column(name="unique_name")
     private String uniqueName;
-    
+
     @Column(name="name")
     private String name = null;
 
@@ -70,39 +70,39 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
 
     @Column(name="tags", length=4096)
     String tags;
-    
+
     @Column(name="type")
     Type type;
-    
+
     @Column(name=GenericDao.REMOVED)
     @Temporal(TemporalType.TIMESTAMP)
     private Date removed;
 
     @Column(name=GenericDao.CREATED_COLUMN)
     private Date created;
-    
+
     @Column(name="recreatable")
     private boolean recreatable;
-    
+
     @Column(name="use_local_storage")
     private boolean useLocalStorage;
-    
+
     @Column(name="system_use")
     private boolean systemUse;
-    
+
     @Column(name="customized")
     private boolean customized;
 
     @Column(name="uuid")
     private String uuid;
-    
+
     @Column(name="sort_key")
     int sortKey;
 
     public DiskOfferingVO() {
        this.uuid = UUID.randomUUID().toString();
     }
-    
+
     public DiskOfferingVO(Long domainId, String name, String displayText, long 
diskSize, String tags, boolean isCustomized) {
         this.domainId = domainId;
         this.name = name;
@@ -115,7 +115,7 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
         this.customized = isCustomized;
        this.uuid = UUID.randomUUID().toString();
     }
-    
+
     public DiskOfferingVO(String name, String displayText, boolean mirrored, 
String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse, 
boolean customized) {
         this.domainId = null;
         this.type = Type.Service;
@@ -147,7 +147,7 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public long getId() {
         return id;
     }
-    
+
     @Override
     public boolean isCustomized() {
                return customized;
@@ -161,25 +161,25 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public String getUniqueName() {
         return uniqueName;
     }
-    
+
     @Override
     public boolean getUseLocalStorage() {
         return useLocalStorage;
     }
-    
+
     @Override
     public Long getDomainId() {
         return domainId;
     }
-    
+
     public Type getType() {
         return type;
     }
-    
+
     public boolean isRecreatable() {
         return recreatable;
     }
-    
+
     public void setDomainId(Long domainId) {
         this.domainId = domainId;
     }
@@ -188,17 +188,17 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public String getName() {
         return name;
     }
-    
+
     public void setName(String name) {
         this.name = name;
     }
-    
+
 
     @Override
     public boolean getSystemUse() {
         return systemUse;
     }
-    
+
     public void setSystemUse(boolean systemUse) {
         this.systemUse = systemUse;
     }
@@ -215,7 +215,7 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public long getDiskSize(){
        return diskSize;
     }
-       
+
     @Override
     public void setDiskSize(long diskSize) {
         this.diskSize = diskSize;
@@ -224,21 +224,21 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public Date getRemoved() {
         return removed;
     }
-    
+
        @Override
     public Date getCreated() {
                return created;
        }
-       
+
     protected void setTags(String tags) {
         this.tags = tags;
     }
-    
+
     @Override
     public String getTags() {
         return tags;
     }
-    
+
     public void setUniqueName(String name) {
         this.uniqueName = name;
     }
@@ -250,7 +250,7 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
         if (tags == null || tags.isEmpty()) {
             return new String[0];
         }
-        
+
         return tags.split(",");
     }
 
@@ -259,30 +259,30 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
         if (this.tags == null) {
             return false;
         }
-        
+
         for (String tag : tags) {
             if (!this.tags.matches(tag)) {
                 return false;
             }
         }
-        
+
         return true;
     }
-    
+
     @Transient
     public void setTagsArray(List<String> newTags) {
         if (newTags.isEmpty()) {
             setTags(null);
             return;
         }
-        
+
         StringBuilder buf = new StringBuilder();
         for (String tag : newTags) {
             buf.append(tag).append(",");
         }
-        
+
         buf.delete(buf.length() - 1, buf.length());
-        
+
         setTags(buf.toString());
     }
 
@@ -293,12 +293,12 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public void setRemoved(Date removed) {
         this.removed = removed;
     }
-    
+
     @Override
     public String getUuid() {
        return this.uuid;
     }
-    
+
     public void setUuid(String uuid) {
        this.uuid = uuid;
     }
@@ -306,7 +306,7 @@ public class DiskOfferingVO implements DiskOffering, 
Identity {
     public void setSortKey(int key) {
        sortKey = key;
     }
-    
+
     public int getSortKey() {
        return sortKey;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java 
b/server/src/com/cloud/api/ApiResponseHelper.java
index f9b908c..e911e56 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -3282,7 +3282,7 @@ public class ApiResponseHelper implements 
ResponseGenerator {
     @Override
     public CounterResponse createCounterResponse(Counter counter) {
         CounterResponse response = new CounterResponse();
-        response.setId(counter.getId());
+        response.setId(counter.getUuid());
         response.setSource(counter.getSource().toString());
         response.setName(counter.getName());
         response.setValue(counter.getValue());
@@ -3293,7 +3293,7 @@ public class ApiResponseHelper implements 
ResponseGenerator {
     @Override
     public ConditionResponse createConditionResponse(Condition condition) {
         ConditionResponse response = new ConditionResponse();
-        response.setId(condition.getId());
+        response.setId(condition.getUuid());
         List<CounterResponse> counterResponseList = new 
ArrayList<CounterResponse>();
         
counterResponseList.add(createCounterResponse(ApiDBUtils.getCounter(condition.getCounterid())));
         response.setCounterResponse(counterResponseList);
@@ -3307,14 +3307,32 @@ public class ApiResponseHelper implements 
ResponseGenerator {
     @Override
     public AutoScaleVmProfileResponse 
createAutoScaleVmProfileResponse(AutoScaleVmProfile profile) {
         AutoScaleVmProfileResponse response = new AutoScaleVmProfileResponse();
-        response.setId(profile.getId());
-        response.setZoneId(profile.getZoneId());
-        response.setServiceOfferingId(profile.getServiceOfferingId());
-        response.setTemplateId(profile.getTemplateId());
+        response.setId(profile.getUuid());
+        if (profile.getZoneId() != null) {
+            DataCenterVO zone = ApiDBUtils.findZoneById(profile.getZoneId());
+            if (zone != null) {
+                response.setZoneId(zone.getUuid());
+            }
+        }
+        if (profile.getServiceOfferingId() != null) {
+            ServiceOffering so = 
ApiDBUtils.findServiceOfferingById(profile.getServiceOfferingId());
+            if (so != null) {
+                response.setServiceOfferingId(so.getUuid());
+            }
+        }
+        if (profile.getTemplateId() != null) {
+            VMTemplateVO template = 
ApiDBUtils.findTemplateById(profile.getTemplateId());
+            if (template != null) {
+                response.setTemplateId(template.getUuid());
+            }
+        }
         response.setOtherDeployParams(profile.getOtherDeployParams());
         response.setCounterParams(profile.getCounterParams());
         response.setDestroyVmGraceperiod(profile.getDestroyVmGraceperiod());
-        response.setAutoscaleUserId(profile.getAutoScaleUserId());
+        User user = ApiDBUtils.findUserById(profile.getAutoScaleUserId());
+        if (user != null) {
+            response.setAutoscaleUserId(user.getUuid());
+        }
         response.setObjectName("autoscalevmprofile");
 
         // Populates the account information in the response
@@ -3346,13 +3364,19 @@ public class ApiResponseHelper implements 
ResponseGenerator {
     @Override
     public AutoScaleVmGroupResponse 
createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup) {
         AutoScaleVmGroupResponse response = new AutoScaleVmGroupResponse();
-        response.setId(vmGroup.getId());
+        response.setId(vmGroup.getUuid());
         response.setMinMembers(vmGroup.getMinMembers());
         response.setMaxMembers(vmGroup.getMaxMembers());
         response.setState(vmGroup.getState());
         response.setInterval(vmGroup.getInterval());
-        response.setProfileId(vmGroup.getProfileId());
-        response.setLoadBalancerId(vmGroup.getProfileId());
+        AutoScaleVmProfileVO profile = 
ApiDBUtils.findAutoScaleVmProfileById(vmGroup.getProfileId());
+        if (profile != null) {
+            response.setProfileId(profile.getUuid());
+        }
+        FirewallRuleVO fw = 
ApiDBUtils.findFirewallRuleById(vmGroup.getProfileId());
+        if (fw != null) {
+            response.setLoadBalancerId(fw.getUuid());
+        }
 
         List<AutoScalePolicyResponse> scaleUpPoliciesResponse = new 
ArrayList<AutoScalePolicyResponse>();
         List<AutoScalePolicyResponse> scaleDownPoliciesResponse = new 
ArrayList<AutoScalePolicyResponse>();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/server/src/com/cloud/migration/ServiceOffering21VO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/migration/ServiceOffering21VO.java 
b/server/src/com/cloud/migration/ServiceOffering21VO.java
index adfac1a..fdec30e 100644
--- a/server/src/com/cloud/migration/ServiceOffering21VO.java
+++ b/server/src/com/cloud/migration/ServiceOffering21VO.java
@@ -32,25 +32,25 @@ import com.cloud.offering.ServiceOffering;
 public class ServiceOffering21VO extends DiskOffering21VO implements 
ServiceOffering {
     @Column(name="cpu")
        private int cpu;
-    
+
     @Column(name="speed")
     private int speed;
-    
+
     @Column(name="ram_size")
        private int ramSize;
-    
+
     @Column(name="nw_rate")
     private Integer rateMbps;
-    
+
     @Column(name="mc_rate")
     private Integer multicastRateMbps;
-    
+
     @Column(name="ha_enabled")
     private boolean offerHA;
-    
+
     @Column(name="host_tag")
-    private String hostTag;    
-    
+    private String hostTag;
+
     protected ServiceOffering21VO() {
         super();
     }
@@ -64,19 +64,19 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
         this.multicastRateMbps = multicastRateMbps;
         this.offerHA = offerHA;
     }
-    
+
     public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, 
Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String 
displayText, boolean useLocalStorage, boolean recreatable, String tags, String 
hostTag) {
        this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, 
displayText, useLocalStorage, recreatable, tags);
                this.hostTag = hostTag;
     }
-    
+
 
        @Override
        public boolean getOfferHA() {
            return offerHA;
        }
 
-       @Override       
+       @Override
        public boolean getLimitCpuUse() {
            return false;
        }
@@ -84,7 +84,7 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
        public void setOfferHA(boolean offerHA) {
                this.offerHA = offerHA;
        }
-       
+
        @Override
     @Transient
        public String[] getTagsArray() {
@@ -92,15 +92,15 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
            if (tags == null || tags.length() == 0) {
                return new String[0];
            }
-           
+
            return tags.split(",");
        }
-       
+
        @Override
        public int getCpu() {
            return cpu;
        }
-       
+
        public void setCpu(int cpu) {
                this.cpu = cpu;
        }
@@ -112,17 +112,17 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
        public void setRamSize(int ramSize) {
                this.ramSize = ramSize;
        }
-       
+
        @Override
        public int getSpeed() {
            return speed;
        }
-       
+
        @Override
        public int getRamSize() {
            return ramSize;
        }
-       
+
        public void setRateMbps(Integer rateMbps) {
                this.rateMbps = rateMbps;
        }
@@ -135,7 +135,7 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
        public void setMulticastRateMbps(Integer multicastRateMbps) {
                this.multicastRateMbps = multicastRateMbps;
        }
-       
+
        @Override
     public Integer getMulticastRateMbps() {
                return multicastRateMbps;
@@ -147,8 +147,8 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
 
        public void setHostTag(String hostTag) {
                this.hostTag = hostTag;
-       }       
-       
+       }
+
        public String getHostTag() {
                return hostTag;
        }
@@ -156,10 +156,18 @@ public class ServiceOffering21VO extends DiskOffering21VO 
implements ServiceOffe
     @Override
     public boolean getDefaultUse() {
         return false;
-    }  
-    
+    }
+
     @Override
     public String getSystemVmType() {
         return null;
-    }   
+    }
+
+    @Override
+    public String getUuid() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1aa30f03/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java 
b/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java
index d0a6f8e..22e8778 100644
--- a/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java
+++ b/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java
@@ -41,7 +41,7 @@ import com.cloud.utils.net.NetUtils;
 @Entity
 @Table(name = "autoscale_vmprofiles")
 @Inheritance(strategy = InheritanceType.JOINED)
-public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity {
+public class AutoScaleVmProfileVO implements AutoScaleVmProfile{
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)

Reply via email to