Search in sources :

Example 51 with RowMapper

use of org.springframework.jdbc.core.RowMapper in project cu-kfs by CU-CommunityApps.

the class LevelOrganizationDaoJdbc method getCLevelOrganizations.

/**
 * This overridden method ...
 *
 * @see edu.cornell.kfs.module.purap.dataaccess.LevelOrganizationDao#getCLevelOrganizations()
 */
public List<LevelOrganization> getCLevelOrganizations() {
    try {
        // Build the SQL
        StringBuilder sqlBuilder = new StringBuilder(3500);
        sqlBuilder.append("select fin_coa_cd, org_cd, org_nm from ca_org_t where fin_coa_cd in('IT') and ORG_ACTIVE_CD = 'Y' and org_cd <> 'XXXX' and org_typ_cd = 'C' order by fin_coa_cd desc, org_nm");
        String sqlString = sqlBuilder.toString();
        RowMapper<LevelOrganization> mapper = new RowMapper<LevelOrganization>() {

            public LevelOrganization mapRow(ResultSet rs, int rowNum) throws SQLException {
                LevelOrganization cLevelOrganization = new LevelOrganization();
                cLevelOrganization.setCode(rs.getString("fin_coa_cd") + "-" + rs.getString("org_cd"));
                cLevelOrganization.setName(rs.getString("org_nm"));
                return cLevelOrganization;
            }
        };
        return this.getJdbcTemplate().query(sqlString, mapper);
    } catch (Exception ex) {
        LOG.info("LevelOrganizationDaoJdbc Exception: " + ex.getMessage());
        return null;
    }
}
Also used : LevelOrganization(edu.cornell.kfs.module.purap.businessobject.LevelOrganization) ResultSet(java.sql.ResultSet) SQLException(java.sql.SQLException) RowMapper(org.springframework.jdbc.core.RowMapper)

Aggregations

RowMapper (org.springframework.jdbc.core.RowMapper)51 ResultSet (java.sql.ResultSet)27 SQLException (java.sql.SQLException)16 List (java.util.List)14 Named (javax.inject.Named)8 Singleton (javax.inject.Singleton)8 Test (org.junit.jupiter.api.Test)8 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)8 Guid (org.ovirt.engine.core.compat.Guid)7 QueryMappingConfiguration (org.springframework.data.jdbc.repository.QueryMappingConfiguration)7 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Tags (org.ovirt.engine.core.common.businessentities.Tags)5 TagsTemplateMap (org.ovirt.engine.core.common.businessentities.TagsTemplateMap)5 TagsType (org.ovirt.engine.core.common.businessentities.TagsType)5 TagsUserGroupMap (org.ovirt.engine.core.common.businessentities.TagsUserGroupMap)5 TagsUserMap (org.ovirt.engine.core.common.businessentities.TagsUserMap)5 TagsVdsMap (org.ovirt.engine.core.common.businessentities.TagsVdsMap)5 TagsVmMap (org.ovirt.engine.core.common.businessentities.TagsVmMap)5 DataAccessException (org.springframework.dao.DataAccessException)5