Search in sources :

Example 1 with DbEngineDialect

use of org.ovirt.engine.core.dal.dbbroker.DbEngineDialect in project ovirt-engine by oVirt.

the class SystemStatisticsDaoImpl method getSystemStatisticsValue.

@Override
public Integer getSystemStatisticsValue(String entity, String status) {
    MapSqlParameterSource parameterSource = new CustomMapSqlParameterSource(dbEngineDialect).addValue("entity", entity).addValue("status", status);
    RowMapper<Integer> mapper = (rs, rowNum) -> rs.getInt("val");
    Map<String, Object> dbResults = dbEngineDialect.createJdbcCallForQuery(jdbcTemplate).withProcedureName("Getsystem_statistics").returningResultSet("RETURN_VALUE", mapper).execute(parameterSource);
    return (Integer) DbFacadeUtils.asSingleResult((List<?>) dbResults.get("RETURN_VALUE"));
}
Also used : Objects(java.util.Objects) Inject(javax.inject.Inject) List(java.util.List) Map(java.util.Map) RowMapper(org.springframework.jdbc.core.RowMapper) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Named(javax.inject.Named) DbEngineDialect(org.ovirt.engine.core.dal.dbbroker.DbEngineDialect) Singleton(javax.inject.Singleton) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) DbFacadeUtils(org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) List(java.util.List)

Aggregations

List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Inject (javax.inject.Inject)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 CustomMapSqlParameterSource (org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)1 DbEngineDialect (org.ovirt.engine.core.dal.dbbroker.DbEngineDialect)1 DbFacadeUtils (org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 RowMapper (org.springframework.jdbc.core.RowMapper)1 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)1