Repository: cloudstack
Updated Branches:
  refs/heads/master 7de9d2f00 -> 5fa7801b2


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/5fa7801b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5fa7801b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5fa7801b

Branch: refs/heads/master
Commit: 5fa7801b20f3ffb4fe0ae0380167873dfbc346ba
Parents: 7de9d2f
Author: Min Chen <[email protected]>
Authored: Mon Nov 17 15:04:03 2014 -0800
Committer: Min Chen <[email protected]>
Committed: Thu Nov 20 09:46:00 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/5fa7801b/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 824bb9b..418b81c 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -653,9 +653,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);
@@ -675,8 +674,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) {

Reply via email to