cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [05/10] git commit: updated refs/heads/ui-restyle to fbb0499
Date Thu, 03 Oct 2013 19:47:58 GMT
CLOUDSTACK-4785:
Adding list details for UserVm.
Signed off by : nitin mehta<nitin.mehta@citrix.com>


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

Branch: refs/heads/ui-restyle
Commit: 8466fad6ca92b0d9ea6c23f5c1be0540e2489ae5
Parents: 85b5c6e
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Wed Oct 2 14:53:07 2013 -0700
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Wed Oct 2 14:53:07 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/vm/dao/NicDetailDaoImpl.java  |  5 ----
 .../src/com/cloud/vm/dao/UserVmDetailsDao.java  |  5 +++-
 .../com/cloud/vm/dao/UserVmDetailsDaoImpl.java  |  9 ++++++
 .../com/cloud/api/query/QueryManagerImpl.java   | 29 +++++++++++++++++++-
 4 files changed, 41 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8466fad6/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
index e166891..67bc0b5 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDetailDaoImpl.java
@@ -70,11 +70,6 @@ public class NicDetailDaoImpl extends GenericDaoBase<NicDetailVO, Long>
implemen
         sc.setParameters("nicId", nicId);
 
         List<NicDetailVO> results = search(sc, null);
-        /*Map<String, String> details = new HashMap<String, String>(results.size());
-        for (NicDetailVO result : results) {
-            details.put(result.getName(), result.getValue());
-        } */
-
         return results;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8466fad6/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
index e2fa720..e117f63 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDao.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.vm.dao;
 
+import java.util.List;
 import java.util.Map;
 
 import com.cloud.utils.db.GenericDao;
@@ -23,7 +24,9 @@ import com.cloud.vm.UserVmDetailVO;
 
 public interface UserVmDetailsDao extends GenericDao<UserVmDetailVO, Long> {
     Map<String, String> findDetails(long vmId);
-    
+
+    public List<UserVmDetailVO> findDetailsList(long vmId);
+
     void persist(long vmId, Map<String, String> details);
     
     UserVmDetailVO findDetail(long vmId, String name);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8466fad6/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
index 01abce3..ce8dbd8 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java
@@ -82,6 +82,15 @@ public class UserVmDetailsDaoImpl extends GenericDaoBase<UserVmDetailVO,
Long> i
         return details;
 	}
 
+    @Override
+    public List<UserVmDetailVO> findDetailsList(long vmId) {
+        SearchCriteria<UserVmDetailVO> sc = VmSearch.create();
+        sc.setParameters("vmId", vmId);
+
+        List<UserVmDetailVO> results = search(sc, null);
+        return results;
+    }
+
 	@Override
 	public void persist(long vmId, Map<String, String> details) {
         Transaction txn = Transaction.currentTxn();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8466fad6/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index be52f29..5f3cceb 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -27,6 +27,8 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import com.cloud.vm.UserVmDetailVO;
+import com.cloud.vm.dao.UserVmDetailsDao;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
@@ -296,6 +298,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
     private NicDetailDao _nicDetailDao;
 
     @Inject
+    UserVmDetailsDao _userVmDetailDao;
+
+    @Inject
     private HighAvailabilityManager _haMgr;
 
     @Inject
@@ -3221,7 +3226,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
 
             return volumeDetailResponseList;
 
-        } else {
+        } else if (resourceType == ResourceTag.TaggedResourceType.Nic){
 
             List<NicDetailVO> nicDetailList;
             if (key == null) {
@@ -3245,6 +3250,28 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
 
             return nicDetailResponseList;
 
+        } else {
+
+            List<UserVmDetailVO> userVmDetailList;
+            if (key == null) {
+                userVmDetailList = _userVmDetailDao.findDetailsList(id);
+            } else {
+                UserVmDetailVO nicDetail = _userVmDetailDao.findDetail(id, key);
+                userVmDetailList = new LinkedList<UserVmDetailVO>();
+                userVmDetailList.add(nicDetail);
+            }
+
+            List<ResourceDetailResponse> nicDetailResponseList = new ArrayList<ResourceDetailResponse>();
+            for (UserVmDetailVO nicDetail : userVmDetailList) {
+                ResourceDetailResponse userVmDetailResponse = new ResourceDetailResponse();
+                userVmDetailResponse.setName(nicDetail.getName());
+                userVmDetailResponse.setValue(nicDetail.getValue());
+                userVmDetailResponse.setResourceType(ResourceTag.TaggedResourceType.Nic.toString());
+                userVmDetailResponse.setObjectName("uservmdetail");
+                nicDetailResponseList.add(userVmDetailResponse);
+            }
+
+            return nicDetailResponseList;
         }
 
     }


Mime
View raw message