Search in sources :

Example 1 with PaymentWorksSupplierDiversityMapDatabaseRow

use of edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow in project cu-kfs by CU-CommunityApps.

the class KfsSupplierDiversityDaoJdbc method buildPmwToKfsSupplierDiversityMap.

@Override
public Map<String, SupplierDiversity> buildPmwToKfsSupplierDiversityMap() {
    Map<String, SupplierDiversity> pmwToKfsDiversityMap = new HashMap<String, SupplierDiversity>();
    List<PaymentWorksSupplierDiversityMapDatabaseRow> pmwToKfsDiversityDatabaseRows = findActiveSupplierDiversitiesForMap();
    if (ObjectUtils.isNotNull(pmwToKfsDiversityDatabaseRows) && !pmwToKfsDiversityDatabaseRows.isEmpty()) {
        ListIterator<PaymentWorksSupplierDiversityMapDatabaseRow> kfsDiversityValueDatabaseRowsIterator = pmwToKfsDiversityDatabaseRows.listIterator();
        while (kfsDiversityValueDatabaseRowsIterator.hasNext()) {
            PaymentWorksSupplierDiversityMapDatabaseRow pmwToKfsSupplierDiversityRow = kfsDiversityValueDatabaseRowsIterator.next();
            String mapKey = pmwToKfsSupplierDiversityRow.getPmwSupplierDiversityDescription();
            SupplierDiversity mapValue = new SupplierDiversity();
            mapValue.setVendorSupplierDiversityCode(pmwToKfsSupplierDiversityRow.getKfsSupplierDiversityCode());
            mapValue.setVendorSupplierDiversityDescription(pmwToKfsSupplierDiversityRow.getKfsSupplierDiversityDescription());
            mapValue.setActive(true);
            pmwToKfsDiversityMap.put(mapKey, mapValue);
        }
    }
    for (String key : pmwToKfsDiversityMap.keySet()) {
        SupplierDiversity value = pmwToKfsDiversityMap.get(key);
        LOG.info("buildPmwToKfsSupplierDiversityMap: key: pmwDiversityDescription = " + key + "  value: kfsDiversityCode = " + value.getVendorSupplierDiversityCode() + " kfsDiversityDescription = " + value.getVendorSupplierDiversityDescription());
    }
    return pmwToKfsDiversityMap;
}
Also used : HashMap(java.util.HashMap) PaymentWorksSupplierDiversityMapDatabaseRow(edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow) SupplierDiversity(org.kuali.kfs.vnd.businessobject.SupplierDiversity)

Example 2 with PaymentWorksSupplierDiversityMapDatabaseRow

use of edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow in project cu-kfs by CU-CommunityApps.

the class KfsSupplierDiversityDaoJdbc method findActiveSupplierDiversitiesForMap.

private List<PaymentWorksSupplierDiversityMapDatabaseRow> findActiveSupplierDiversitiesForMap() {
    try {
        RowMapper<PaymentWorksSupplierDiversityMapDatabaseRow> mapRow = new RowMapper<PaymentWorksSupplierDiversityMapDatabaseRow>() {

            public PaymentWorksSupplierDiversityMapDatabaseRow mapRow(ResultSet resultSet, int rowNumber) throws SQLException {
                PaymentWorksSupplierDiversityMapDatabaseRow pmwToKfsSupplierDiversity = new PaymentWorksSupplierDiversityMapDatabaseRow();
                pmwToKfsSupplierDiversity.setKfsSupplierDiversityCode(resultSet.getString(KFS_SUPP_DVRST_CD_COL));
                pmwToKfsSupplierDiversity.setKfsSupplierDiversityDescription(resultSet.getString(KFS_SUPP_DVRST_DESC_COL));
                pmwToKfsSupplierDiversity.setPmwSupplierDiversityDescription(resultSet.getString(PMW_SUPP_DVRST_DESC_COL));
                return pmwToKfsSupplierDiversity;
            }
        };
        return this.getJdbcTemplate().query(KFS_SUPPLIER_DIVERSITY_SQL, mapRow);
    } catch (Exception e) {
        LOG.info("findActiveSupplierDiversitiesForMap Exception: " + e.getMessage());
        return null;
    }
}
Also used : PaymentWorksSupplierDiversityMapDatabaseRow(edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow) ResultSet(java.sql.ResultSet) SQLException(java.sql.SQLException) RowMapper(org.springframework.jdbc.core.RowMapper)

Aggregations

PaymentWorksSupplierDiversityMapDatabaseRow (edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 SupplierDiversity (org.kuali.kfs.vnd.businessobject.SupplierDiversity)1 RowMapper (org.springframework.jdbc.core.RowMapper)1