Search in sources :

Example 1 with KfsVendorDataWrapper

use of edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method createVendorDetail.

protected KfsVendorDataWrapper createVendorDetail(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap, Map<String, SupplierDiversity> paymentWorksToKfsDiversityMap) {
    if (paymentWorksVendorIsPurchaseOrderVendor(pmwVendor)) {
        KfsVendorDataWrapper kfsVendorDataWrapper = new KfsVendorDataWrapper();
        kfsVendorDataWrapper.getErrorMessages().add(getConfigurationService().getPropertyValueAsString(PaymentWorksKeyConstants.PO_VENDOR_PROCESSING_NOT_AUTOMATIC_YET));
        kfsVendorDataWrapper.setVendorDetail(null);
        return kfsVendorDataWrapper;
    }
    KfsVendorDataWrapper kfsVendorDataWrapper = populateTaxRuleDependentAttributes(pmwVendor, paymentWorksIsoToFipsCountryMap);
    if (ObjectUtils.isNotNull(kfsVendorDataWrapper.getVendorDetail())) {
        kfsVendorDataWrapper.getVendorDetail().getVendorHeader().setVendorTypeCode(determineKfsVendorTypeCodeBasedOnPmwVendorType(pmwVendor.getVendorType()));
        kfsVendorDataWrapper.getVendorDetail().getVendorHeader().setVendorSupplierDiversities(buildVendorDiversities(pmwVendor, paymentWorksToKfsDiversityMap));
        kfsVendorDataWrapper.getVendorDetail().setVendorDunsNumber(pmwVendor.getRequestingCompanyDuns());
        kfsVendorDataWrapper.getVendorDetail().setVendorCreditCardIndicator(new Boolean(pmwVendor.isAcceptCreditCards()));
        kfsVendorDataWrapper.getVendorDetail().setActiveIndicator(true);
        kfsVendorDataWrapper.getVendorDetail().setVendorUrlAddress(pmwVendor.getRequestingCompanyUrl());
        kfsVendorDataWrapper.getVendorDetail().setVendorAddresses(buildVendorAddresses(pmwVendor, paymentWorksIsoToFipsCountryMap));
        kfsVendorDataWrapper.getVendorDetail().setVendorContacts(buildVendorContacts(pmwVendor));
        kfsVendorDataWrapper.getVendorDetail().setExtension(buildVendorDetailExtension(pmwVendor));
        kfsVendorDataWrapper.getVendorDetail().setVendorParentIndicator(true);
        kfsVendorDataWrapper = buildRemainingVendorNotes(pmwVendor, kfsVendorDataWrapper);
        kfsVendorDataWrapper.getVendorDetail().setBoNotes(kfsVendorDataWrapper.getVendorNotes());
    }
    return kfsVendorDataWrapper;
}
Also used : KfsVendorDataWrapper(edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper)

Example 2 with KfsVendorDataWrapper

use of edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper in project cu-kfs by CU-CommunityApps.

the class PaymentWorksDataProcessingIntoKfsServiceImpl method createKfsVendorMaintenaceDocument.

private MaintenanceDocument createKfsVendorMaintenaceDocument(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap, Map<String, SupplierDiversity> paymentWorksToKfsDiversityMap, PaymentWorksNewVendorRequestsBatchReportData reportData) {
    MaintenanceDocument vendorMaintenceDoc = null;
    try {
        KfsVendorDataWrapper kfsVendorDataWrapper = getPaymentWorksVendorToKfsVendorDetailConversionService().createKfsVendorDetailFromPmwVendor(pmwVendor, paymentWorksIsoToFipsCountryMap, paymentWorksToKfsDiversityMap);
        if (kfsVendorDataWrapper.noProcessingErrorsGenerated()) {
            vendorMaintenceDoc = buildVendorMaintenanceDocument(pmwVendor, kfsVendorDataWrapper);
            LOG.info("createKfsVendorMaintenaceDocument: vendorMaintenceDoc created for pmwVendorId = " + pmwVendor.getPmwVendorRequestId());
        } else {
            reportData.getPendingPaymentWorksVendorsThatCouldNotBeProcessed().incrementRecordCount();
            reportData.addPmwVendorsThatCouldNotBeProcessed(new PaymentWorksBatchReportRawDataItem(pmwVendor.toString(), kfsVendorDataWrapper.getErrorMessages()));
            LOG.info("createKfsVendorMaintenaceDocument: vendorMaintenceDoc not created due to pmw-to-kfs data conversion error(s): " + kfsVendorDataWrapper.getErrorMessages().toString());
        }
    } catch (WorkflowException we) {
        List<String> edocCreateErrors = convertReportDataValidationErrors(GlobalVariables.getMessageMap().getErrorMessages());
        captureKfsProcessingErrorsForVendor(pmwVendor, reportData, edocCreateErrors);
        LOG.error("createKfsVendorMaintenaceDocument: eDoc creation error(s): " + edocCreateErrors.toString());
        LOG.error("createKfsVendorMaintenaceDocument: eDoc creation exception caught: " + we.getMessage());
        vendorMaintenceDoc = null;
    } finally {
        GlobalVariables.getMessageMap().clearErrorMessages();
    }
    return vendorMaintenceDoc;
}
Also used : MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) PaymentWorksBatchReportRawDataItem(edu.cornell.kfs.pmw.batch.report.PaymentWorksBatchReportRawDataItem) ArrayList(java.util.ArrayList) AutoPopulatingList(org.springframework.util.AutoPopulatingList) List(java.util.List) KfsVendorDataWrapper(edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper)

Aggregations

KfsVendorDataWrapper (edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper)2 PaymentWorksBatchReportRawDataItem (edu.cornell.kfs.pmw.batch.report.PaymentWorksBatchReportRawDataItem)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1 AutoPopulatingList (org.springframework.util.AutoPopulatingList)1