Search in sources :

Example 1 with VendorBatchSupplierDiversity

use of edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity 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 2 with VendorBatchSupplierDiversity

use of edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity 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)

Aggregations

CuVendorSupplierDiversityExtension (edu.cornell.kfs.vnd.businessobject.CuVendorSupplierDiversityExtension)2 VendorBatchSupplierDiversity (edu.cornell.kfs.vnd.businessobject.VendorBatchSupplierDiversity)2 ArrayList (java.util.ArrayList)2 VendorSupplierDiversity (org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)2