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