CLOUDSTACK-7954:ListTags API is ignoring the resourceID and displaying

all the tags of all resources.

(cherry picked from commit 5fa7801b20)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Min Chen 2014-11-17 15:04:03 -08:00 committed by Rohit Yadav
parent 5563a7314e
commit eaaac81870
1 changed files with 9 additions and 5 deletions

View File

@ -616,9 +616,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);
@ -638,8 +637,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) {