From 08892c51a36072ea7f2dc8fbbdcee4191594b5ee Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 21 Dec 2012 17:04:17 -0800 Subject: [PATCH] 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 --- api/src/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(-) diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java index a3fe6b0ee01..28ca6b8c2de 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; } 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 74a8a177ca4..2e2e6678444 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; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java b/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java index 42912be744a..355942fb3dd 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 { diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index e8317a850e1..c134284f728 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 implem } } userVmResponse.setPassword(userVm.getPassword()); - userVmResponse.setJobUuid(userVm.getJobUuid()); + userVmResponse.setJobId(userVm.getJobUuid()); userVmResponse.setJobStatus(userVm.getJobStatus()); //userVmResponse.setForVirtualNetwork(userVm.getForVirtualNetwork());