use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.
the class TagDaoImpl method attachVmToTag.
@Override
public void attachVmToTag(TagsVmMap tagVmMap) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("tag_id", tagVmMap.getTagId()).addValue("vm_id", tagVmMap.getVmId()).addValue("DefaultDisplayType", tagVmMap.getDefaultDisplayType());
getCallsHandler().executeModification("Inserttags_vm_map", parameterSource);
}
use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.
the class QuotaDaoImpl method getAllRelevantQuotasForCluster.
@Override
public List<Quota> getAllRelevantQuotasForCluster(Guid clusterId, long engineSessionSeqId, boolean isFiltered) {
MapSqlParameterSource quotaParameterSource = getCustomMapSqlParameterSource();
quotaParameterSource.addValue("cluster_id", clusterId).addValue("engine_session_seq_id", engineSessionSeqId).addValue("is_filtered", isFiltered);
return getCallsHandler().executeReadList("getAllThinQuotasByClusterId", getQuotaMetaDataFromResultSet(), quotaParameterSource);
}
use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.
the class QuotaDaoImpl method getAllQuotaIncludingConsumption.
/**
* Get all the full quotas. Including consumption data. This call is very heavy and should be used really and with
* caution. It was created to support cache initialization
*
* @return all quota in DB (including consumption calculation)
*/
@Override
public List<Quota> getAllQuotaIncludingConsumption() {
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
// get thin quota (only basic quota meta data)
List<Quota> allThinQuota = getCallsHandler().executeReadList("getAllThinQuota", getQuotaMetaDataFromResultSet(), parameterSource);
if (!allThinQuota.isEmpty()) {
Map<Guid, Quota> allQuotaMap = new HashMap<>();
for (Quota quota : allThinQuota) {
allQuotaMap.put(quota.getId(), quota);
}
List<QuotaStorage> quotaStorageList = getAllQuotaStorageIncludingConsumption();
List<QuotaCluster> quotaClusterList = getAllQuotaClusterIncludingConsumption();
for (QuotaStorage quotaStorage : quotaStorageList) {
Quota quota = allQuotaMap.get(quotaStorage.getQuotaId());
if (quota != null) {
if (quotaStorage.getStorageId() == null || quotaStorage.getStorageId().equals(Guid.Empty)) {
quota.setGlobalQuotaStorage(quotaStorage);
} else {
if (quota.getQuotaStorages() == null) {
quota.setQuotaStorages(new ArrayList<>());
}
quota.getQuotaStorages().add(quotaStorage);
}
}
}
for (QuotaCluster quotaCluster : quotaClusterList) {
Quota quota = allQuotaMap.get(quotaCluster.getQuotaId());
if (quota != null) {
if (quotaCluster.getClusterId() == null || quotaCluster.getClusterId().equals(Guid.Empty)) {
quota.setGlobalQuotaCluster(quotaCluster);
} else {
if (quota.getQuotaClusters() == null) {
quota.setQuotaClusters(new ArrayList<>());
}
quota.getQuotaClusters().add(quotaCluster);
}
}
}
}
// The thin quota were all filled
return allThinQuota;
}
use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.
the class RepoFileMetaDataDaoImpl method addRepoFileMap.
@Override
public void addRepoFileMap(RepoImage map) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("repo_domain_id", map.getRepoDomainId()).addValue("repo_image_id", map.getRepoImageId()).addValue("repo_image_name", map.getRepoImageName()).addValue("size", map.getSize()).addValue("date_created", map.getDateCreated()).addValue("last_refreshed", map.getLastRefreshed()).addValue("file_type", map.getFileType().getValue());
getCallsHandler().executeModification("InsertRepo_domain_file_meta_data", parameterSource);
}
use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.
the class RepoFileMetaDataDaoImpl method removeRepoDomainFileList.
@Override
public void removeRepoDomainFileList(Guid id, ImageFileType fileType) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("storage_domain_id", id);
if (fileType == null || fileType == ImageFileType.All) {
parameterSource.addValue("file_type", null);
} else {
parameterSource.addValue("file_type", fileType.getValue());
}
getCallsHandler().executeModification("DeleteRepo_domain_file_list", parameterSource);
}
Aggregations