Search in sources :

Example 1 with SupplierDiversity

use of org.kuali.kfs.vnd.businessobject.SupplierDiversity in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method createVendorSupplierDiversityForDropDownData.

private VendorSupplierDiversity createVendorSupplierDiversityForDropDownData(String pmwDiversityStatusDescription, String pmwDiversityCertifiedExpirationDate, Map<String, SupplierDiversity> paymentWorksToKfsDiversityMap) {
    VendorSupplierDiversity kfsVendorVendorSupplierDiversity = null;
    if (ObjectUtils.isNotNull(pmwDiversityStatusDescription) && paymentWorksToKfsDiversityMap.containsKey(pmwDiversityStatusDescription)) {
        SupplierDiversity supplierDiversityFromMap = paymentWorksToKfsDiversityMap.get(pmwDiversityStatusDescription);
        java.sql.Date expirationDate = null;
        if (StringUtils.containsIgnoreCase(pmwDiversityStatusDescription, PaymentWorksConstants.DIVERSITY_EXPIRATION_DATE_CERTIFIED) && (ObjectUtils.isNotNull(pmwDiversityCertifiedExpirationDate))) {
            try {
                SimpleDateFormat userEnteredDateFormat = new SimpleDateFormat(KFSConstants.MONTH_DAY_YEAR_DATE_FORMAT);
                java.util.Date userEnteredDate = userEnteredDateFormat.parse(pmwDiversityCertifiedExpirationDate);
                expirationDate = new java.sql.Date(userEnteredDate.getTime());
            } catch (ParseException pe) {
                LOG.info("createVendorSupplierDiversityForDropDownData: ParseException caught while attempting to create VendorSupplierDiversity object for PaymentWorks diveristy " + pmwDiversityStatusDescription + " with PaymentWorks user entered certified expiration date value of " + pmwDiversityCertifiedExpirationDate + ". Setting diversity expiration date to one year from today.");
                expirationDate = addOneYearToDate(getDateTimeService().getCurrentDate());
            }
        } else {
            expirationDate = addOneYearToDate(getDateTimeService().getCurrentDate());
        }
        kfsVendorVendorSupplierDiversity = buildVendorSupplierDiversity(supplierDiversityFromMap.getVendorSupplierDiversityCode(), expirationDate);
    }
    return kfsVendorVendorSupplierDiversity;
}
Also used : SupplierDiversity(org.kuali.kfs.vnd.businessobject.SupplierDiversity) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity) ParseException(java.text.ParseException) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.sql.Date)

Example 2 with SupplierDiversity

use of org.kuali.kfs.vnd.businessobject.SupplierDiversity in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildVendorDiversitiesFromPmwFormCheckboxes.

private List<VendorSupplierDiversity> buildVendorDiversitiesFromPmwFormCheckboxes(PaymentWorksVendor pmwVendor, Map<String, SupplierDiversity> paymentWorksToKfsDiversityMap, List<VendorSupplierDiversity> kfsVendorSupplierDiversities) {
    ArrayList<String> pmwDiversities = new ArrayList<String>(Arrays.asList(pmwVendor.getDiversityClassifications().split("\\s*,\\s*")));
    if (!pmwDiversities.isEmpty()) {
        for (String pmwDiversity : pmwDiversities) {
            if (paymentWorksToKfsDiversityMap.containsKey(pmwDiversity)) {
                SupplierDiversity supplierDiversityFromMap = paymentWorksToKfsDiversityMap.get(pmwDiversity);
                kfsVendorSupplierDiversities.add(buildVendorSupplierDiversity(supplierDiversityFromMap.getVendorSupplierDiversityCode(), addOneYearToDate(getDateTimeService().getCurrentDate())));
            } else {
                LOG.info("buildVendorDiversities:: PaymentWorks Vendor : " + pmwVendor.getRequestingCompanyLegalName() + "  Diversity Value : " + pmwDiversity + " does not have corresponding KFS SupplierDiversity defined.");
            }
        }
    }
    return kfsVendorSupplierDiversities;
}
Also used : ArrayList(java.util.ArrayList) SupplierDiversity(org.kuali.kfs.vnd.businessobject.SupplierDiversity) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)

Example 3 with SupplierDiversity

use of org.kuali.kfs.vnd.businessobject.SupplierDiversity 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)

Aggregations

SupplierDiversity (org.kuali.kfs.vnd.businessobject.SupplierDiversity)3 VendorSupplierDiversity (org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)2 PaymentWorksSupplierDiversityMapDatabaseRow (edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksSupplierDiversityMapDatabaseRow)1 Date (java.sql.Date)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1