|
54 | 54 | public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> implements DomainRouterDao { |
55 | 55 |
|
56 | 56 | protected SearchBuilder<DomainRouterVO> AllFieldsSearch; |
| 57 | + protected SearchBuilder<DomainRouterVO> RunningSearch; |
57 | 58 | protected SearchBuilder<DomainRouterVO> IdNetworkIdStatesSearch; |
58 | 59 | protected SearchBuilder<DomainRouterVO> HostUpSearch; |
59 | 60 | protected SearchBuilder<DomainRouterVO> StateNetworkTypeSearch; |
@@ -139,10 +140,19 @@ protected void init() { |
139 | 140 | OutsidePodSearch.done(); |
140 | 141 |
|
141 | 142 | clusterSearch = createSearchBuilder(); |
| 143 | + clusterSearch.and("state", clusterSearch.entity().getState(), Op.EQ); |
142 | 144 | SearchBuilder<HostVO> clusterHost = _hostsDao.createSearchBuilder(); |
143 | 145 | clusterHost.and("clusterId", clusterHost.entity().getClusterId(), Op.EQ); |
144 | 146 | clusterSearch.join("host", clusterHost, clusterSearch.entity().getHostId(), clusterHost.entity().getId(), JoinType.INNER); |
145 | 147 | clusterSearch.done(); |
| 148 | + |
| 149 | + RunningSearch = createSearchBuilder(); |
| 150 | + RunningSearch.and("dc", RunningSearch.entity().getDataCenterId(), Op.EQ); |
| 151 | + RunningSearch.and("account", RunningSearch.entity().getAccountId(), Op.EQ); |
| 152 | + RunningSearch.and("domainId", RunningSearch.entity().getDomainId(), Op.EQ); |
| 153 | + RunningSearch.and("state", RunningSearch.entity().getState(), Op.EQ); |
| 154 | + RunningSearch.and("podId", RunningSearch.entity().getPodIdToDeployIn(), Op.EQ); |
| 155 | + RunningSearch.done(); |
146 | 156 | } |
147 | 157 |
|
148 | 158 | @Override |
@@ -200,15 +210,17 @@ public List<DomainRouterVO> listByHostId(Long hostId) { |
200 | 210 | } |
201 | 211 |
|
202 | 212 | @Override |
203 | | - public List<DomainRouterVO> listByPodId(Long podId) { |
204 | | - SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create(); |
| 213 | + public List<DomainRouterVO> listRunningByPodId(Long podId) { |
| 214 | + SearchCriteria<DomainRouterVO> sc = RunningSearch.create(); |
| 215 | + sc.setParameters("state", State.Running); |
205 | 216 | sc.setParameters("podId", podId); |
206 | 217 | return listBy(sc); |
207 | 218 | } |
208 | 219 |
|
209 | 220 | @Override |
210 | | - public List<DomainRouterVO> listByClusterId(Long clusterId) { |
| 221 | + public List<DomainRouterVO> listRunningByClusterId(Long clusterId) { |
211 | 222 | SearchCriteria<DomainRouterVO> sc = clusterSearch.create(); |
| 223 | + sc.setParameters("state", State.Running); |
212 | 224 | sc.setJoinParameters("host", "clusterId", clusterId); |
213 | 225 | return listBy(sc); |
214 | 226 | } |
@@ -237,8 +249,9 @@ public List<DomainRouterVO> listIsolatedByHostId(Long hostId) { |
237 | 249 | } |
238 | 250 |
|
239 | 251 | @Override |
240 | | - public List<DomainRouterVO> listByDomain(Long domainId) { |
241 | | - SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create(); |
| 252 | + public List<DomainRouterVO> listRunningByDomain(Long domainId) { |
| 253 | + SearchCriteria<DomainRouterVO> sc = RunningSearch.create(); |
| 254 | + sc.setParameters("state", State.Running); |
242 | 255 | sc.setParameters("domainId", domainId); |
243 | 256 | return listBy(sc); |
244 | 257 | } |
@@ -379,4 +392,19 @@ public List<DomainRouterVO> listByVpcId(long vpcId) { |
379 | 392 | return listBy(sc); |
380 | 393 | } |
381 | 394 |
|
| 395 | + @Override |
| 396 | + public List<DomainRouterVO> listRunningByAccountId(long accountId) { |
| 397 | + SearchCriteria<DomainRouterVO> sc = RunningSearch.create(); |
| 398 | + sc.setParameters("state", State.Running); |
| 399 | + sc.setParameters("account", accountId); |
| 400 | + return listBy(sc); |
| 401 | + } |
| 402 | + |
| 403 | + @Override |
| 404 | + public List<DomainRouterVO> listRunningByDataCenter(long dcId) { |
| 405 | + SearchCriteria<DomainRouterVO> sc = RunningSearch.create(); |
| 406 | + sc.setParameters("state", State.Running); |
| 407 | + sc.setParameters("dc", dcId); |
| 408 | + return listBy(sc); |
| 409 | + } |
382 | 410 | } |
0 commit comments