mirror of https://github.com/apache/cloudstack.git
bug 5701: listNetworkGroups api - apply page size parameter to the NetworkGroup instead of IngressRule
status 5701: resolved fixed
This commit is contained in:
parent
7eafd961fe
commit
92423042e1
|
|
@ -34,4 +34,10 @@ public interface NetworkGroupRulesDao extends GenericDao<NetworkGroupRulesVO, Lo
|
|||
* @return the list of network groups with associated ingress rules
|
||||
*/
|
||||
List<NetworkGroupRulesVO> listNetworkGroupRulesByDomain(long domainId, boolean recursive);
|
||||
|
||||
/**
|
||||
* List all network rules belonging to the specific group
|
||||
* @return the network group with associated ingress rules
|
||||
*/
|
||||
List<NetworkGroupRulesVO> listNetworkRulesByGroupId(long groupId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||
private SearchBuilder<NetworkGroupRulesVO> AccountGroupNameSearch;
|
||||
private SearchBuilder<NetworkGroupRulesVO> AccountSearch;
|
||||
private SearchBuilder<NetworkGroupRulesVO> DomainSearch;
|
||||
private SearchBuilder<NetworkGroupRulesVO> GroupSearch;
|
||||
|
||||
private DomainDao _domainDao = null;
|
||||
|
||||
|
|
@ -31,6 +32,10 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||
AccountSearch = createSearchBuilder();
|
||||
AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountSearch.done();
|
||||
|
||||
GroupSearch = createSearchBuilder();
|
||||
GroupSearch.and("groupId", GroupSearch.entity().getId(), SearchCriteria.Op.EQ);
|
||||
GroupSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -88,4 +93,12 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
|
|||
|
||||
return listActiveBy(sc, searchFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkGroupRulesVO> listNetworkRulesByGroupId(long groupId) {
|
||||
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
|
||||
SearchCriteria sc = GroupSearch.create();
|
||||
sc.setParameters("groupId", groupId);
|
||||
return listBy(sc, searchFilter);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -774,7 +774,7 @@ public class NetworkGroupManagerImpl implements NetworkGroupManager {
|
|||
|
||||
@Override
|
||||
public List<NetworkGroupRulesVO> searchForNetworkGroupRules(Criteria c) {
|
||||
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, c.getOffset(), c.getLimit());
|
||||
Filter searchFilter = new Filter(NetworkGroupVO.class, "id", true, c.getOffset(), c.getLimit());
|
||||
Object accountId = c.getCriteria(Criteria.ACCOUNTID);
|
||||
Object domainId = c.getCriteria(Criteria.DOMAINID);
|
||||
Object networkGroup = c.getCriteria(Criteria.NETWORKGROUP);
|
||||
|
|
@ -782,7 +782,7 @@ public class NetworkGroupManagerImpl implements NetworkGroupManager {
|
|||
Object recursive = c.getCriteria(Criteria.ISRECURSIVE);
|
||||
Object keyword = c.getCriteria(Criteria.KEYWORD);
|
||||
|
||||
SearchBuilder<NetworkGroupRulesVO> sb = _networkGroupRulesDao.createSearchBuilder();
|
||||
SearchBuilder<NetworkGroupVO> sb = _networkGroupDao.createSearchBuilder();
|
||||
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
|
||||
sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -815,8 +815,18 @@ public class NetworkGroupManagerImpl implements NetworkGroupManager {
|
|||
sc.setParameters("domainId", domainId);
|
||||
}
|
||||
}
|
||||
|
||||
return _networkGroupRulesDao.search(sc, searchFilter);
|
||||
|
||||
List<NetworkGroupVO> networkGroups = _networkGroupDao.search(sc, searchFilter);
|
||||
List<NetworkGroupRulesVO> networkRulesList = new ArrayList<NetworkGroupRulesVO>();
|
||||
for (NetworkGroupVO group : networkGroups) {
|
||||
networkRulesList.addAll(_networkGroupRulesDao.listNetworkRulesByGroupId(group.getId()));
|
||||
}
|
||||
|
||||
if (instanceId != null) {
|
||||
return listNetworkGroupRulesByVM((Long)instanceId);
|
||||
}
|
||||
|
||||
return networkRulesList;
|
||||
}
|
||||
|
||||
private List<NetworkGroupRulesVO> listNetworkGroupRulesByVM(long vmId) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue