mirror of https://github.com/apache/cloudstack.git
optimize db list.size() cases
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
e676b80052
commit
3f80cd3c66
|
|
@ -296,8 +296,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
|
|||
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, dcId);
|
||||
|
||||
List<DataCenterIpAddressVO> result = listBy(sc);
|
||||
return result.size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
public DataCenterIpAddressDaoImpl() {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||
public int countAllocatedVnets(long physicalNetworkId) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
return listBy(sc).size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
|
|||
public long countFreeIpsInVlan(long vlanDbId) {
|
||||
SearchCriteria<IPAddressVO> sc = VlanDbIdSearchUnallocated.create();
|
||||
sc.setParameters("vlanDbId", vlanDbId);
|
||||
return listBy(sc).size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -415,8 +415,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>implements Ne
|
|||
sc.setParameters("broadcastUri", broadcastURI);
|
||||
sc.setParameters("guestType", guestTypes);
|
||||
sc.setJoinParameters("persistent", "persistent", isPersistent);
|
||||
List<NetworkVO> persistentNetworks = search(sc, null);
|
||||
return persistentNetworks.size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ public class CommandExecLogDaoImpl extends GenericDaoBase<CommandExecLogVO, Long
|
|||
SearchCriteria<CommandExecLogVO> sc = CommandSearch.create();
|
||||
sc.setParameters("host_id", id);
|
||||
sc.setParameters("command_name", "CopyCommand");
|
||||
List<CommandExecLogVO> copyCmds = customSearch(sc, null);
|
||||
return copyCmds.size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -170,8 +170,7 @@ public class NicIpAliasDaoImpl extends GenericDaoBase<NicIpAliasVO, Long> implem
|
|||
public Integer countAliasIps(long id) {
|
||||
SearchCriteria<NicIpAliasVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("instanceId", id);
|
||||
List<NicIpAliasVO> list = listBy(sc);
|
||||
return list.size();
|
||||
return getCount(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue