Search in sources :

Example 71 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VdsSpmIdMapDaoImpl method removeByVdsAndStoragePool.

@Override
public void removeByVdsAndStoragePool(Guid vdsId, Guid storagePoolId) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vds_id", vdsId).addValue("storage_pool_id", storagePoolId);
    getCallsHandler().executeModification("DeleteByPoolvds_spm_id_map", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 72 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VdsSpmIdMapDaoImpl method save.

@Override
public void save(VdsSpmIdMap vdsSpmIdMap) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("storage_pool_id", vdsSpmIdMap.getStoragePoolId()).addValue("vds_id", vdsSpmIdMap.getId()).addValue("vds_spm_id", vdsSpmIdMap.getVdsSpmId());
    getCallsHandler().executeModification("Insertvds_spm_id_map", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 73 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VdsStatisticsDaoImpl method remove.

@Override
public void remove(Guid id) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vds_id", id);
    getCallsHandler().executeModification("DeleteVdsStatistics", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 74 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VdsStatisticsDaoImpl method update.

@Override
public void update(VdsStatistics stats) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("cpu_idle", stats.getCpuIdle()).addValue("cpu_load", stats.getCpuLoad()).addValue("cpu_sys", stats.getCpuSys()).addValue("cpu_user", stats.getCpuUser()).addValue("usage_cpu_percent", stats.getUsageCpuPercent()).addValue("usage_mem_percent", stats.getUsageMemPercent()).addValue("usage_network_percent", stats.getUsageNetworkPercent()).addValue("vds_id", stats.getId()).addValue("mem_available", stats.getMemAvailable()).addValue("mem_free", stats.getMemFree()).addValue("mem_shared", stats.getMemShared()).addValue("swap_free", stats.getSwapFree()).addValue("swap_total", stats.getSwapTotal()).addValue("ksm_cpu_percent", stats.getKsmCpuPercent()).addValue("ksm_pages", stats.getKsmPages()).addValue("ksm_state", stats.getKsmState()).addValue("anonymous_hugepages", stats.getAnonymousHugePages()).addValue("boot_time", stats.getBootTime()).addValue("ha_score", stats.getHighlyAvailableScore()).addValue("ha_configured", stats.getHighlyAvailableIsConfigured()).addValue("ha_active", stats.getHighlyAvailableIsActive()).addValue("ha_global_maintenance", stats.getHighlyAvailableGlobalMaintenance()).addValue("ha_local_maintenance", stats.getHighlyAvailableLocalMaintenance()).addValue("cpu_over_commit_time_stamp", stats.getCpuOverCommitTimeStamp()).addValue("hugepages", serializeHugePages(stats.getHugePages()));
    getCallsHandler().executeModification("UpdateVdsStatistics", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 75 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VdsStatisticsDaoImpl method save.

@Override
public void save(VdsStatistics stats) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("cpu_idle", stats.getCpuIdle()).addValue("cpu_load", stats.getCpuLoad()).addValue("cpu_sys", stats.getCpuSys()).addValue("cpu_user", stats.getCpuUser()).addValue("usage_cpu_percent", stats.getUsageCpuPercent()).addValue("usage_mem_percent", stats.getUsageMemPercent()).addValue("usage_network_percent", stats.getUsageNetworkPercent()).addValue("vds_id", stats.getId()).addValue("mem_available", stats.getMemAvailable()).addValue("mem_free", stats.getMemFree()).addValue("mem_shared", stats.getMemShared()).addValue("swap_free", stats.getSwapFree()).addValue("swap_total", stats.getSwapTotal()).addValue("ksm_cpu_percent", stats.getKsmCpuPercent()).addValue("ksm_pages", stats.getKsmPages()).addValue("ksm_state", stats.getKsmState()).addValue("anonymous_hugepages", stats.getAnonymousHugePages()).addValue("boot_time", stats.getBootTime()).addValue("ha_score", stats.getHighlyAvailableScore()).addValue("ha_configured", stats.getHighlyAvailableIsConfigured()).addValue("ha_active", stats.getHighlyAvailableIsActive()).addValue("ha_global_maintenance", stats.getHighlyAvailableGlobalMaintenance()).addValue("ha_local_maintenance", stats.getHighlyAvailableLocalMaintenance()).addValue("cpu_over_commit_time_stamp", stats.getCpuOverCommitTimeStamp()).addValue("hugepages", serializeHugePages(stats.getHugePages()));
    getCallsHandler().executeModification("InsertVdsStatistics", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Aggregations

MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)505 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)82 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)63 Test (org.junit.jupiter.api.Test)48 ArrayList (java.util.ArrayList)36 EmptyResultDataAccessException (org.springframework.dao.EmptyResultDataAccessException)34 ResultSet (java.sql.ResultSet)33 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)32 List (java.util.List)30 HashMap (java.util.HashMap)29 SQLException (java.sql.SQLException)25 Guid (org.ovirt.engine.core.compat.Guid)25 Collectors (java.util.stream.Collectors)16 CustomMapSqlParameterSource (org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)16 Transactional (org.springframework.transaction.annotation.Transactional)16 java.util (java.util)13 Component (org.springframework.stereotype.Component)13 Map (java.util.Map)12 RowMapper (org.springframework.jdbc.core.RowMapper)11 Named (javax.inject.Named)10