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

all the tags of all resources.
This commit is contained in:
Min Chen 2014-11-17 15:04:03 -08:00
parent 91d448ff45
commit 66e0f049db
1 changed files with 9 additions and 5 deletions

View File

@ -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) {