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