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;
}
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());
}
}
}
}
Aggregations