cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/master to 2580edb
Date Mon, 16 Feb 2015 10:43:57 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 2b7073c73 -> 2580edbcf


CLOUDSTACK-7908: UserVmResponse returns userid/username information of the creator

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/master
Commit: 2580edbcfbf7ff784209de2930df8926178801e2
Parents: 2b7073c
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Mon Feb 16 16:12:22 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Feb 16 16:12:22 2015 +0530

----------------------------------------------------------------------
 .../cloudstack/api/response/UserVmResponse.java | 24 ++++++++++++++++++++
 .../cloud/api/query/dao/UserVmJoinDaoImpl.java  |  9 ++++++++
 2 files changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2580edbc/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
index 1f55f5b..36d82de 100644
--- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java
@@ -52,6 +52,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
     @Param(description = "the account associated with the virtual machine")
     private String accountName;
 
+    @SerializedName(ApiConstants.USER_ID)
+    @Param(description = "the user's ID who deployed the virtual machine")
+    private String userId;
+
+    @SerializedName(ApiConstants.USERNAME)
+    @Param(description = "the user's name who deployed the virtual machine")
+    private String userName;
+
     @SerializedName(ApiConstants.PROJECT_ID)
     @Param(description = "the project id of the vm")
     private String projectId;
@@ -315,6 +323,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
         return accountName;
     }
 
+    public String getUserId() {
+        return userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
     public String getProjectId() {
         return projectId;
     }
@@ -535,6 +551,14 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp
         this.accountName = accountName;
     }
 
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
     @Override
     public void setDomainId(String domainId) {
         this.domainId = domainId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2580edbc/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 890b4bc..9d88334 100644
--- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -48,6 +48,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.service.ServiceOfferingDetailsVO;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
+import com.cloud.user.User;
+import com.cloud.user.dao.UserDao;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
@@ -70,6 +72,8 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long>
implem
     public AccountManager _accountMgr;
     @Inject
     private UserVmDetailsDao _userVmDetailsDao;
+    @Inject
+    private UserDao _userDao;
 
     private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
     private final SearchBuilder<UserVmJoinVO> activeVmByIsoSearch;
@@ -121,6 +125,11 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO,
Long> implem
             userVmResponse.setAccountName(userVm.getAccountName());
         }
 
+        User user = _userDao.getUser(userVm.getUserId());
+        if (user != null) {
+            userVmResponse.setUserId(user.getUuid());
+            userVmResponse.setUserName(user.getUsername());
+        }
         userVmResponse.setDomainId(userVm.getDomainUuid());
         userVmResponse.setDomainName(userVm.getDomainName());
 


Mime
View raw message