You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/22 04:06:33 UTC

[1/3] git commit: api: Fix jobid and entitytype for BaseResponse and QueryAsyncJob*

Updated Branches:
  refs/heads/api_refactoring f548099d0 -> 024f0d95d


api: Fix jobid and entitytype for BaseResponse and QueryAsyncJob*

- Fix jobid serialization issue that broke the UI
- Fix AsyncJob Result and Response
- Get rid of getUuid(), setUuid(), just use getId, setId for uuid...
- All uuids from over the wire are UUIDs

Signed-off-by: Rohit Yadav <bh...@apache.org>


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

Branch: refs/heads/api_refactoring
Commit: 08892c51a36072ea7f2dc8fbbdcee4191594b5ee
Parents: f548099
Author: Rohit Yadav <bh...@apache.org>
Authored: Fri Dec 21 17:04:17 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Fri Dec 21 19:05:45 2012 -0800

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/BaseResponse.java    |   13 +------------
 .../command/user/job/QueryAsyncJobResultCmd.java   |    5 ++---
 .../cloudstack/api/response/AsyncJobResponse.java  |    2 ++
 .../com/cloud/api/query/dao/UserVmJoinDaoImpl.java |    2 +-
 4 files changed, 6 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/08892c51/api/src/org/apache/cloudstack/api/BaseResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
index a3fe6b0..28ca6b8 100644
--- a/api/src/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -50,11 +50,8 @@ public abstract class BaseResponse implements ResponseObject {
         return null;
     }
 
-    // For use by list commands with pending async jobs
-    protected String jobId;
-
     @SerializedName(ApiConstants.JOB_ID) @Param(description="the UUID of the latest async job acting on this object")
-    protected String jobUuid;
+    protected String jobId;
 
     @SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
     private Integer jobStatus;
@@ -67,14 +64,6 @@ public abstract class BaseResponse implements ResponseObject {
         this.jobId = jobId;
     }
 
-    public String getJobUuid() {
-        return jobUuid;
-    }
-
-    public void setJobUuid(String jobUuid) {
-        this.jobUuid = jobUuid;
-    }
-
     public Integer getJobStatus() {
         return jobStatus;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/08892c51/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
index 74a8a17..2e2e667 100644
--- a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
@@ -20,7 +20,6 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
 import org.apache.cloudstack.api.Implementation;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.AsyncJobResponse;
@@ -36,8 +35,8 @@ public class QueryAsyncJobResultCmd extends BaseCmd {
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
 
-    @IdentityMapper(entityTableName="async_job")
-    @Parameter(name=ApiConstants.JOB_ID, type=CommandType.LONG, required=true, description="the ID of the asychronous job")
+    @Parameter(name=ApiConstants.JOB_ID, type=CommandType.UUID, entityType=AsyncJobResponse.class,
+            required=true, description="the ID of the asychronous job")
     private Long id;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/08892c51/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java b/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java
index 42912be..355942f 100644
--- a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java
@@ -20,11 +20,13 @@ import java.util.Date;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.Entity;
 import org.apache.cloudstack.api.ResponseObject;
 import com.cloud.async.AsyncJob;
 import com.cloud.serializer.Param;
 import com.google.gson.annotations.SerializedName;
 
+@Entity(value=AsyncJob.class)
 @SuppressWarnings("unused")
 public class AsyncJobResponse extends BaseResponse {
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/08892c51/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
index e8317a8..c134284 100644
--- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -124,7 +124,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
             }
         }
         userVmResponse.setPassword(userVm.getPassword());
-        userVmResponse.setJobUuid(userVm.getJobUuid());
+        userVmResponse.setJobId(userVm.getJobUuid());
         userVmResponse.setJobStatus(userVm.getJobStatus());
         //userVmResponse.setForVirtualNetwork(userVm.getForVirtualNetwork());