Updated Dao classes with correct field names.

This commit is contained in:
Boris Schrijver 2015-09-17 10:54:26 +02:00
parent b31e64d49d
commit fa5f388fe9
4 changed files with 17 additions and 3 deletions

View File

@ -45,6 +45,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
private final SearchBuilder<DataCenterIpAddressVO> AllFieldsSearch;
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCount;
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllIpCountForDc;
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCount;
private final GenericSearchBuilder<DataCenterIpAddressVO, Integer> AllAllocatedIpCountForDc;
@ -228,7 +229,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
if (onlyCountAllocated) {
sc = AllAllocatedIpCountForDc.create();
} else {
sc = AllIpCount.create();
sc = AllIpCountForDc.create();
}
sc.setParameters("data_center_id", dcId);
@ -254,6 +255,11 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre
AllIpCount.and("pod", AllIpCount.entity().getPodId(), SearchCriteria.Op.EQ);
AllIpCount.done();
AllIpCountForDc = createSearchBuilder(Integer.class);
AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getId());
AllIpCountForDc.and("data_center_id", AllIpCountForDc.entity().getPodId(), SearchCriteria.Op.EQ);
AllIpCountForDc.done();
AllAllocatedIpCount = createSearchBuilder(Integer.class);
AllAllocatedIpCount.select(null, Func.COUNT, AllAllocatedIpCount.entity().getId());
AllAllocatedIpCount.and("pod", AllAllocatedIpCount.entity().getPodId(), SearchCriteria.Op.EQ);

View File

@ -55,6 +55,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
protected SearchBuilder<IPAddressVO> AllFieldsSearch;
protected SearchBuilder<IPAddressVO> VlanDbIdSearchUnallocated;
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCount;
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDc;
protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCount;
protected GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCountForDc;
protected GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDashboard;
@ -101,6 +102,11 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
AllIpCount.and("vlan", AllIpCount.entity().getVlanId(), Op.EQ);
AllIpCount.done();
AllIpCountForDc = createSearchBuilder(Integer.class);
AllIpCountForDc.select(null, Func.COUNT, AllIpCountForDc.entity().getAddress());
AllIpCountForDc.and("dc", AllIpCountForDc.entity().getDataCenterId(), Op.EQ);
AllIpCountForDc.done();
AllocatedIpCount = createSearchBuilder(Integer.class);
AllocatedIpCount.select(null, Func.COUNT, AllocatedIpCount.entity().getAddress());
AllocatedIpCount.and("dc", AllocatedIpCount.entity().getDataCenterId(), Op.EQ);
@ -290,7 +296,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
@Override
public int countIPs(long dcId, boolean onlyCountAllocated) {
SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCount.create() : AllIpCount.create();
SearchCriteria<Integer> sc = onlyCountAllocated ? AllocatedIpCountForDc.create() : AllIpCountForDc.create();
sc.setParameters("dc", dcId);
return customSearch(sc, null).get(0);

View File

@ -200,7 +200,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
@Override
public List<VolumeVO> findByDc(long dcId) {
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
sc.setParameters("data_center_id", dcId);
sc.setParameters("dcId", dcId);
return listBy(sc);
}
@ -322,6 +322,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
AllFieldsSearch.and("dcId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ);
AllFieldsSearch.and("instanceId", AllFieldsSearch.entity().getInstanceId(), Op.EQ);
AllFieldsSearch.and("deviceId", AllFieldsSearch.entity().getDeviceId(), Op.EQ);

View File

@ -155,6 +155,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ);
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
AllFieldsSearch.and("zone", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodIdToDeployIn(), Op.EQ);
AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ);
AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ);
AllFieldsSearch.done();