Search in sources :

Example 11 with MaintenanceDocument

use of org.kuali.kfs.kns.document.MaintenanceDocument in project cu-kfs by CU-CommunityApps.

the class EzraServiceImpl method routeAgencyDocument.

private void routeAgencyDocument(Agency agency, Agency oldAgency) {
    GlobalVariables.clear();
    GlobalVariables.setUserSession(new UserSession(KFSConstants.SYSTEM_USER));
    // DocumentService docService = SpringContext.getBean(DocumentService.class);
    MaintenanceDocument agencyDoc = null;
    try {
        agencyDoc = (MaintenanceDocument) documentService.getNewDocument("AGCY");
    } catch (WorkflowException we) {
        we.printStackTrace();
    }
    agencyDoc.getDocumentHeader().setDocumentDescription("Auto creation of new agency: " + agency.getAgencyNumber());
    if (ObjectUtils.isNotNull(oldAgency)) {
        agencyDoc.getOldMaintainableObject().setBusinessObject(oldAgency);
        agencyDoc.getDocumentHeader().setDocumentDescription(agency.getAgencyNumber() + " by auto edit");
    }
    Maintainable agencyMaintainable = agencyDoc.getNewMaintainableObject();
    agencyMaintainable.setBusinessObject(agency);
    agencyDoc.setNewMaintainableObject(agencyMaintainable);
    try {
        documentService.saveDocument(agencyDoc);
        agencyDoc.getDocumentHeader().getWorkflowDocument().route("Automatically created and routed");
    } catch (WorkflowException we) {
        we.printStackTrace();
    }
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) UserSession(org.kuali.kfs.krad.UserSession) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) Maintainable(org.kuali.kfs.kns.maintenance.Maintainable)

Example 12 with MaintenanceDocument

use of org.kuali.kfs.kns.document.MaintenanceDocument in project cu-kfs by CU-CommunityApps.

the class EzraServiceImpl method routeAwardDocument.

private void routeAwardDocument(Award award, Award oldAward) {
    GlobalVariables.clear();
    GlobalVariables.setUserSession(new UserSession(KFSConstants.SYSTEM_USER));
    // DocumentService docService = SpringContext.getBean(DocumentService.class);
    MaintenanceDocument awardDoc = null;
    try {
        awardDoc = (MaintenanceDocument) documentService.getNewDocument("AWRD");
    } catch (WorkflowException we) {
        we.printStackTrace();
    }
    LOG.info("Created a new Award doc. " + award.getProposalNumber());
    awardDoc.getDocumentHeader().setDocumentDescription("Auto creation of new award : " + award.getProposalNumber());
    if (ObjectUtils.isNotNull(oldAward)) {
        awardDoc.getOldMaintainableObject().setBusinessObject(oldAward);
        award.setVersionNumber(oldAward.getVersionNumber());
        awardDoc.getDocumentHeader().setDocumentDescription(award.getProposalNumber() + " by auto edit");
    }
    awardDoc.getNewMaintainableObject().setBusinessObject(award);
    ;
    try {
        documentService.saveDocument(awardDoc);
        // documentService.routeDocument(awardDoc, "Automatically created and routed", null);
        awardDoc.getDocumentHeader().getWorkflowDocument().route("Automatically created and routed");
    } catch (WorkflowException we) {
        we.printStackTrace();
    } catch (RuntimeException rte) {
        LOG.error(rte);
    }
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) UserSession(org.kuali.kfs.krad.UserSession) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException)

Example 13 with MaintenanceDocument

use of org.kuali.kfs.kns.document.MaintenanceDocument in project cu-kfs by CU-CommunityApps.

the class PurchasingActionBase method doesDocumentAllowImmediateSaveOfNewNote.

private boolean doesDocumentAllowImmediateSaveOfNewNote(Document document, Note note) {
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    PersistableBusinessObject noteTarget = document.getNoteTarget();
    // This is the same logic used by the KualiDocumentActionBase.insertBONote() method.
    return !workflowDocument.isInitiated() && StringUtils.isNotBlank(noteTarget.getObjectId()) && !(document instanceof MaintenanceDocument && StringUtils.equals(NoteType.BUSINESS_OBJECT.getCode(), note.getNoteTypeCode()));
}
Also used : PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument)

Example 14 with MaintenanceDocument

use of org.kuali.kfs.kns.document.MaintenanceDocument 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)

Example 15 with MaintenanceDocument

use of org.kuali.kfs.kns.document.MaintenanceDocument in project cu-kfs by CU-CommunityApps.

the class PaymentWorksDataProcessingIntoKfsServiceImpl method buildVendorMaintenanceDocument.

private MaintenanceDocument buildVendorMaintenanceDocument(PaymentWorksVendor paymentWorksVendor, KfsVendorDataWrapper kfsVendorDataWrapper) throws WorkflowException {
    boolean isNewVendor = true;
    MaintenanceDocument vendorMaintDoc = buildVendorMaintenanceDocumentBase(kfsVendorDataWrapper.getVendorDetail(), new VendorDetail(), KFSConstants.MAINTENANCE_NEW_ACTION, isNewVendor, kfsVendorDataWrapper.getVendorNotes());
    return vendorMaintDoc;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument)

Aggregations

MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)15 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)7 Date (java.sql.Date)3 UserSession (org.kuali.kfs.krad.UserSession)3 Note (org.kuali.kfs.krad.bo.Note)3 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)2 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)2 Account (org.kuali.kfs.coa.businessobject.Account)2 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)2 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)2 DocumentHeader (org.kuali.kfs.krad.bo.DocumentHeader)2 Document (org.kuali.kfs.krad.document.Document)2 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)2 DocumentService (org.kuali.kfs.krad.service.DocumentService)2 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)2 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)1 AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)1 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)1 AccountReversionTrickleDownInactivationService (edu.cornell.kfs.coa.service.AccountReversionTrickleDownInactivationService)1 KfsVendorDataWrapper (edu.cornell.kfs.pmw.batch.businessobject.KfsVendorDataWrapper)1