You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/11/20 18:57:17 UTC

git commit: updated refs/heads/4.5 to 66e0f04

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 91d448ff4 -> 66e0f049d


CLOUDSTACK-7954:ListTags API is ignoring the resourceID and displaying
    all the tags of all resources.


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

Branch: refs/heads/4.5
Commit: 66e0f049db0a996476a2e6bbf3dd9041ef1ace1a
Parents: 91d448f
Author: Min Chen <mi...@citrix.com>
Authored: Mon Nov 17 15:04:03 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Nov 20 09:48:07 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/query/QueryManagerImpl.java | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66e0f049/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 475b42c..31273ec 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -648,9 +648,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         sb.and("value", sb.entity().getValue(), SearchCriteria.Op.EQ);
 
         if (resourceId != null) {
-            sb.and().op("resourceId", sb.entity().getResourceId(), SearchCriteria.Op.EQ);
-            sb.or("resourceUuid", sb.entity().getResourceUuid(), SearchCriteria.Op.EQ);
-            sb.cp();
+            sb.and("resourceId", sb.entity().getResourceId(), SearchCriteria.Op.EQ);
+            sb.and("resourceUuid", sb.entity().getResourceUuid(), SearchCriteria.Op.EQ);
         }
 
         sb.and("resourceType", sb.entity().getResourceType(), SearchCriteria.Op.EQ);
@@ -670,8 +669,13 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         }
 
         if (resourceId != null) {
-            sc.setParameters("resourceId", resourceId);
-            sc.setParameters("resourceUuid", resourceId);
+            try {
+                long rid = Long.parseLong(resourceId);
+                sc.setParameters("resourceId", rid);
+            } catch (NumberFormatException ex) {
+                // internal id instead of resource id is passed
+                sc.setParameters("resourceUuid", resourceId);
+            }
         }
 
         if (resourceType != null) {