Search in sources :

Example 6 with VendorSupplierDiversity

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

the class VendorBatchServiceImpl method getVendorSupplierDiversities.

/*
     * populate list of vendor batch supplier diversities to vendor supplier diversities
     */
private List<VendorSupplierDiversity> getVendorSupplierDiversities(List<VendorBatchSupplierDiversity> supplierDiversitys) {
    List<VendorSupplierDiversity> vendorSupplierDiversitys = new ArrayList<VendorSupplierDiversity>();
    if (CollectionUtils.isNotEmpty(supplierDiversitys)) {
        for (VendorBatchSupplierDiversity diversity : supplierDiversitys) {
            LOG.info("addVendor diversity " + diversity);
            VendorSupplierDiversity vDiversity = new VendorSupplierDiversity();
            vDiversity.setVendorSupplierDiversityCode(diversity.getVendorSupplierDiversityCode());
            if (StringUtils.isNotBlank(diversity.getVendorSupplierDiversityExpirationDate())) {
                ((CuVendorSupplierDiversityExtension) vDiversity.getExtension()).setVendorSupplierDiversityExpirationDate(new java.sql.Date(getFormatDate(diversity.getVendorSupplierDiversityExpirationDate()).getTime()));
            }
            vDiversity.setActive(StringUtils.equalsIgnoreCase(YES, diversity.getActive()));
            vendorSupplierDiversitys.add(vDiversity);
        }
    }
    return vendorSupplierDiversitys;
}
Also used : ArrayList(java.util.ArrayList) VendorBatchSupplierDiversity(edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity) CuVendorSupplierDiversityExtension(edu.cornell.kfs.vnd.businessobject.CuVendorSupplierDiversityExtension) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)

Example 7 with VendorSupplierDiversity

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

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildVendorDiversitiesFromPmwFormDropDownLists.

private List<VendorSupplierDiversity> buildVendorDiversitiesFromPmwFormDropDownLists(PaymentWorksVendor pmwVendor, Map<String, SupplierDiversity> paymentWorksToKfsDiversityMap, List<VendorSupplierDiversity> kfsVendorSupplierDiversities) {
    VendorSupplierDiversity minority = createVendorSupplierDiversityForDropDownData(pmwVendor.getMinorityStatus(), pmwVendor.getMbeCertificationExpirationDate(), paymentWorksToKfsDiversityMap);
    if (ObjectUtils.isNotNull(minority)) {
        kfsVendorSupplierDiversities.add(minority);
    }
    VendorSupplierDiversity womanOwned = createVendorSupplierDiversityForDropDownData(pmwVendor.getWomanOwned(), pmwVendor.getWbeCertificationExpirationDate(), paymentWorksToKfsDiversityMap);
    if (ObjectUtils.isNotNull(womanOwned)) {
        kfsVendorSupplierDiversities.add(womanOwned);
    }
    VendorSupplierDiversity veteran = createVendorSupplierDiversityForDropDownData(pmwVendor.getDisabledVeteran(), pmwVendor.getVeteranCertificationExpirationDate(), paymentWorksToKfsDiversityMap);
    if (ObjectUtils.isNotNull(veteran)) {
        kfsVendorSupplierDiversities.add(veteran);
    }
    return kfsVendorSupplierDiversities;
}
Also used : VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)

Example 8 with VendorSupplierDiversity

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

the class VendorBatchServiceImpl method updateVendorSupplierDiversitys.

/*
     * update existing vendor supplier diversity or create a new one if it does not exist.
     */
private void updateVendorSupplierDiversitys(List<VendorBatchSupplierDiversity> supplierDiversitys, VendorDetail vendor, VendorDetail vDetail) {
    ArrayList<VendorSupplierDiversity> vendorSupplierDiversitys = new ArrayList<VendorSupplierDiversity>();
    if (CollectionUtils.isNotEmpty(supplierDiversitys)) {
        for (VendorBatchSupplierDiversity diversity : supplierDiversitys) {
            LOG.info("updateVendor diversity " + diversity);
            VendorSupplierDiversity vDiversity = getVendorSupplierDiversity(vDetail.getVendorHeader(), diversity.getVendorSupplierDiversityCode());
            boolean isExist = StringUtils.isNotBlank(vDiversity.getVendorSupplierDiversityCode());
            vDiversity.setVendorSupplierDiversityCode(diversity.getVendorSupplierDiversityCode());
            if (StringUtils.isNotBlank(diversity.getVendorSupplierDiversityExpirationDate())) {
                ((CuVendorSupplierDiversityExtension) vDiversity.getExtension()).setVendorSupplierDiversityExpirationDate(new java.sql.Date(getFormatDate(diversity.getVendorSupplierDiversityExpirationDate()).getTime()));
            }
            vDiversity.setActive(StringUtils.equalsIgnoreCase(YES, diversity.getActive()));
            if (!isExist) {
                vDetail.getVendorHeader().getVendorSupplierDiversities().add(vDiversity);
                vendor.getVendorHeader().getVendorSupplierDiversities().add(new VendorSupplierDiversity());
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) VendorBatchSupplierDiversity(edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity) CuVendorSupplierDiversityExtension(edu.cornell.kfs.vnd.businessobject.CuVendorSupplierDiversityExtension) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)

Example 9 with VendorSupplierDiversity

use of org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity 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 10 with VendorSupplierDiversity

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

Aggregations

VendorSupplierDiversity (org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)11 CuVendorSupplierDiversityExtension (edu.cornell.kfs.vnd.businessobject.CuVendorSupplierDiversityExtension)6 ArrayList (java.util.ArrayList)4 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)4 VendorHeader (org.kuali.kfs.vnd.businessobject.VendorHeader)4 Date (java.util.Date)3 VendorBatchSupplierDiversity (edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity)2 SupplierDiversity (org.kuali.kfs.vnd.businessobject.SupplierDiversity)2 CuVendorCreditCardMerchant (edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant)1 CuVendorHeaderExtension (edu.cornell.kfs.vnd.businessobject.CuVendorHeaderExtension)1 VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)1 Date (java.sql.Date)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 CommodityCode (org.kuali.kfs.vnd.businessobject.CommodityCode)1 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)1 VendorCommodityCode (org.kuali.kfs.vnd.businessobject.VendorCommodityCode)1