You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/02/27 09:10:25 UTC

git commit: refs/heads/4.1 - CLOUDSTACK-420: listZones missing name parameter

Updated Branches:
  refs/heads/4.1 48ce06b9b -> 2fc5a3ca5


CLOUDSTACK-420: listZones missing name parameter

When calling the listZones API command, you can now supply a name to pull a specific zone by name.

Updated two classes to include name paramater and query data centers/zones by name if suppled:
- server/src/com/cloud/api/query/QueryManagerImpl.java
- api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/4.1
Commit: 2fc5a3ca5e1539ef42b92c59fb0e42e1c6c73bc5
Parents: 48ce06b
Author: David Grizzanti <da...@sungard.com>
Authored: Wed Feb 27 11:22:28 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed Feb 27 13:39:59 2013 +0530

----------------------------------------------------------------------
 .../api/command/user/zone/ListZonesByCmd.java      |    7 +++++++
 .../src/com/cloud/api/query/QueryManagerImpl.java  |    3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2fc5a3ca/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
index 97fe2ff..bbfb598 100644
--- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java
@@ -53,6 +53,9 @@ public class ListZonesByCmd extends BaseListCmd {
             description="the ID of the domain associated with the zone")
     private Long domainId;
 
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
+    private String name;
+
     @Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
     private Boolean showCapacities;
 
@@ -72,6 +75,10 @@ public class ListZonesByCmd extends BaseListCmd {
         return domainId;
     }
 
+    public String getName(){
+        return name;
+    }
+
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2fc5a3ca/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 51312a6..746e8cb 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -2190,12 +2190,15 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         Long domainId = cmd.getDomainId();
         Long id = cmd.getId();
         String keyword = cmd.getKeyword();
+        String name = cmd.getName();
 
         Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
         SearchCriteria<DataCenterJoinVO> sc = _dcJoinDao.createSearchCriteria();
 
         if (id != null) {
             sc.addAnd("id", SearchCriteria.Op.EQ, id);
+        } else if (name != null) {
+            sc.addAnd("name", SearchCriteria.Op.EQ, name);
         } else {
             if (keyword != null) {
                 SearchCriteria<DataCenterJoinVO> ssc = _dcJoinDao.createSearchCriteria();