cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [06/51] [abbrv] git commit: updated refs/heads/object_store to 9aec9c6
Date Thu, 20 Jun 2013 01:17:27 GMT
remove duplicated VPC router in return value of functions in DomainRouterDaoImpl


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

Branch: refs/heads/object_store
Commit: 10e80afdeb7f631113ec62d86a4e734fa614b0be
Parents: 9d7c7c1
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Tue Jun 18 15:29:46 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Tue Jun 18 15:29:46 2013 +0200

----------------------------------------------------------------------
 .../src/com/cloud/vm/dao/DomainRouterDaoImpl.java | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/10e80afd/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
index 391fa58..65b9d3b 100755
--- a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.vm.dao;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
@@ -44,6 +45,7 @@ import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.UpdateBuilder;
@@ -103,6 +105,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
         IdNetworkIdStatesSearch.done();
 
         HostUpSearch = createSearchBuilder();
+        HostUpSearch.select(null, Func.DISTINCT, HostUpSearch.entity().getId());
         HostUpSearch.and("host", HostUpSearch.entity().getHostId(), Op.EQ);
         HostUpSearch.and("states", HostUpSearch.entity().getState(), Op.NIN);
         SearchBuilder<RouterNetworkVO> joinRouterNetwork3 = _routerNetworkDao.createSearchBuilder();
@@ -112,6 +115,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
         HostUpSearch.done();
           
         StateNetworkTypeSearch = createSearchBuilder();
+        StateNetworkTypeSearch.select(null, Func.DISTINCT, StateNetworkTypeSearch.entity().getId());
         StateNetworkTypeSearch.and("state", StateNetworkTypeSearch.entity().getState(), Op.EQ);
         SearchBuilder<RouterNetworkVO> joinRouterNetwork4 = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork4.and("networkId", joinRouterNetwork4.entity().getNetworkId(), Op.EQ);
@@ -214,7 +218,12 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
             sc.setParameters("host", hostId);
         }
         sc.setJoinParameters("networkRouter", "type", Network.GuestType.Isolated);
-        return listBy(sc);
+        List<DomainRouterVO> routerIds = listBy(sc);
+        List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
+        for (DomainRouterVO router : routerIds) {
+            routers.add(findById(router.getId()));
+        }
+        return routers;
     }
 
     @Override
@@ -253,7 +262,12 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO,
Long> im
         sc.setParameters("state", state);
         sc.setJoinParameters("networkRouter", "type", type);
         sc.setJoinParameters("host", "mgmtServerId", mgmtSrvrId);
-        return listBy(sc);
+        List<DomainRouterVO> routerIds = listBy(sc);
+        List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
+        for (DomainRouterVO router : routerIds) {
+            routers.add(findById(router.getId()));
+        }
+        return routers;
     }
 
     @Override


Mime
View raw message