Updated Branches: refs/heads/master f3e968b98 -> 2bb716efd
CLOUDSTACK-4874: rever the previous commits. Service offering details are already being returned in "serviceofferingdetails" field of the service offering response Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e52e7a56 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e52e7a56 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e52e7a56 Branch: refs/heads/master Commit: e52e7a5634d57f4d9dec2587b10658ae8d75643a Parents: f3e968b Author: Alena Prokharchyk <[email protected]> Authored: Wed Oct 23 14:07:47 2013 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Wed Oct 23 17:17:14 2013 -0700 ---------------------------------------------------------------------- .../org/apache/cloudstack/api/ApiConstants.java | 2 +- .../user/offering/ListServiceOfferingsCmd.java | 22 ---------------- .../api/response/ServiceOfferingResponse.java | 10 -------- .../com/cloud/api/query/QueryManagerImpl.java | 27 +------------------- 4 files changed, 2 insertions(+), 59 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e52e7a56/api/src/org/apache/cloudstack/api/ApiConstants.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index dbf6685..61eeb95 100755 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -521,7 +521,7 @@ public class ApiConstants { public static final String ROUTING = "isrouting"; public static final String MAX_CONNECTIONS = "maxconnections"; public static final String SERVICE_STATE = "servicestate"; - public static final String RESOURCE_TAGS = "resourcetags"; + public static final String RESOURCE_DETAIL = "resourcedetail"; public static final String EXPUNGE = "expunge"; public enum HostDetails { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e52e7a56/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java index 2869d62..60eb438 100644 --- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java @@ -63,9 +63,6 @@ public class ListServiceOfferingsCmd extends BaseListCmd { @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".") private String systemVmType; - - @Parameter(name = ApiConstants.RESOURCE_TAGS, type = CommandType.MAP, description = "List service offerings by resource tags (key/value pairs)", since="4.3") - private Map resourceTag; ///////////////////////////////////////////////////// @@ -95,25 +92,6 @@ public class ListServiceOfferingsCmd extends BaseListCmd { public String getSystemVmType(){ return systemVmType; } - - public Map<String, String> getResourceTags() { - Map<String, String> tagsMap = null; - if (resourceTag != null && !resourceTag.isEmpty()) { - tagsMap = new HashMap<String, String>(); - Collection<?> servicesCollection = resourceTag.values(); - Iterator<?> iter = servicesCollection.iterator(); - while (iter.hasNext()) { - HashMap<String, String> services = (HashMap<String, String>) iter.next(); - String key = services.get("key"); - String value = services.get("value"); - if (value == null) { - throw new InvalidParameterValueException("No value is passed in for key " + key); - } - tagsMap.put(key, value); - } - } - return tagsMap; - } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e52e7a56/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java index 204de3b..e305ee9 100644 --- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java @@ -17,9 +17,7 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import java.util.LinkedHashSet; import java.util.Map; -import java.util.Set; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; @@ -107,13 +105,8 @@ public class ServiceOfferingResponse extends BaseResponse { @Param(description = "additional key/value details tied with this service offering", since = "4.2.0") private Map<String, String> details; - @SerializedName(ApiConstants.RESOURCE_TAGS) @Param(description="the list of resource tags associated with service offering." + - " The resource tags are not used for Volume/VM placement on the specific host.", - responseObject = ResourceTagResponse.class, since="4.3") - private Set<ResourceTagResponse> resourceTags; public ServiceOfferingResponse(){ - resourceTags = new LinkedHashSet<ResourceTagResponse>(); } public String getId() { @@ -295,7 +288,4 @@ public class ServiceOfferingResponse extends BaseResponse { this.details = details; } - public void addTag(ResourceTagResponse tag){ - this.resourceTags.add(tag); - } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e52e7a56/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 cbe5e24..eff5d38 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -2390,22 +2390,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { Long domainId = cmd.getDomainId(); Boolean isSystem = cmd.getIsSystem(); String vmTypeStr = cmd.getSystemVmType(); - Map<String, String> resourceTags = cmd.getResourceTags(); - SearchBuilder<ServiceOfferingJoinVO> sb = _srvOfferingJoinDao.createSearchBuilder(); - if (resourceTags != null && !resourceTags.isEmpty()) { - SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder(); - for (int count=0; count < resourceTags.size(); count++) { - tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ); - tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ); - tagSearch.cp(); - } - tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ); - sb.groupBy(sb.entity().getId()); - sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER); - } - - SearchCriteria<ServiceOfferingJoinVO> sc = sb.create(); + SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria(); if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && isSystem) { throw new InvalidParameterValueException("Only ROOT admins can access system's offering"); @@ -2515,17 +2501,6 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { if (vmTypeStr != null) { sc.addAnd("vm_type", SearchCriteria.Op.EQ, vmTypeStr); } - - - if (resourceTags != null && !resourceTags.isEmpty()) { - int count = 0; - sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.ServiceOffering.toString()); - for (String key : resourceTags.keySet()) { - sc.setJoinParameters("tagSearch", "key" + String.valueOf(count), key); - sc.setJoinParameters("tagSearch", "value" + String.valueOf(count), resourceTags.get(key)); - count++; - } - } return _srvOfferingJoinDao.searchAndCount(sc, searchFilter); }
