Search in sources :

Example 91 with MapSqlParameterSource

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

the class RoleDaoImpl method getAll.

@Override
public List<Role> getAll() {
    Integer appMode = Config.<Integer>getValue(ConfigValues.ApplicationMode);
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("app_mode", appMode);
    return getCallsHandler().executeReadList("GetAllFromRole", rolesRowMapper, parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 92 with MapSqlParameterSource

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

the class RoleDaoImpl method save.

@Override
public void save(Role role) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("description", role.getDescription()).addValue("id", role.getId()).addValue("name", role.getName()).addValue("is_readonly", role.isReadonly()).addValue("role_type", role.getType().getId()).addValue("allows_viewing_children", role.allowsViewingChildren()).addValue("app_mode", role.getAppMode().getValue());
    getCallsHandler().executeModification("InsertRole", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 93 with MapSqlParameterSource

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

the class RoleDaoImpl method update.

@Override
public void update(Role role) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("description", role.getDescription()).addValue("id", role.getId()).addValue("name", role.getName()).addValue("is_readonly", role.isReadonly()).addValue("role_type", role.getType().getId()).addValue("allows_viewing_children", role.allowsViewingChildren());
    getCallsHandler().executeModification("UpdateRole", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 94 with MapSqlParameterSource

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

the class TagDaoImpl method update.

@Override
public void update(Tags tag) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("description", tag.getDescription()).addValue("tag_id", tag.getTagId()).addValue("tag_name", tag.getTagName()).addValue("parent_id", tag.getParentId()).addValue("readonly", tag.getIsReadonly()).addValue("type", tag.getType());
    getCallsHandler().executeModification("Updatetags", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 95 with MapSqlParameterSource

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

the class TagDaoImpl method updateDefaultDisplayForVmTag.

@Override
public void updateDefaultDisplayForVmTag(TagsVmMap tagsVmMap) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("tag_id", tagsVmMap.getTagId()).addValue("vm_id", tagsVmMap.getVmId()).addValue("DefaultDisplayType", tagsVmMap.getDefaultDisplayType());
    getCallsHandler().executeModification("UpdateVmTagsDefaultDisplayType", 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