本文整理汇总了Java中org.kuali.rice.krad.bo.Note.setNoteTypeCode方法的典型用法代码示例。如果您正苦于以下问题:Java Note.setNoteTypeCode方法的具体用法?Java Note.setNoteTypeCode怎么用?Java Note.setNoteTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.bo.Note
的用法示例。
在下文中一共展示了Note.setNoteTypeCode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disapproveDocument
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DocumentService#disapproveDocument(org.kuali.rice.krad.document.Document,
* java.lang.String)
*/
@Override
public Document disapproveDocument(Document document, String annotation) throws Exception {
checkForNulls(document);
Note note = createNoteFromDocument(document, annotation);
//if note type is BO, override and link disapprove notes to Doc Header
if (document.getNoteType().equals(NoteType.BUSINESS_OBJECT)) {
note.setNoteTypeCode(NoteType.DOCUMENT_HEADER.getCode());
note.setRemoteObjectIdentifier(document.getDocumentHeader().getObjectId());
}
document.addNote(note);
//SAVE THE NOTE
//Note: This save logic is replicated here and in KualiDocumentAction, when to save (based on doc state) should be moved
// into a doc service method
getNoteService().save(note);
prepareWorkflowDocument(document);
getWorkflowDocumentService().disapprove(document.getDocumentHeader().getWorkflowDocument(), annotation);
UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(),
document.getDocumentHeader().getWorkflowDocument());
removeAdHocPersonsAndWorkgroups(document);
return document;
}
示例2: createNoteFromDocument
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DocumentService#createNoteFromDocument(org.kuali.rice.krad.document.Document,
* java.lang.String)
*/
@Override
public Note createNoteFromDocument(Document document, String text) {
Note note = new Note();
note.setNotePostedTimestamp(getDateTimeService().getCurrentTimestamp());
note.setNoteText(text);
note.setNoteTypeCode(document.getNoteType().getCode());
GloballyUnique bo = document.getNoteTarget();
// TODO gah! this is awful
Person kualiUser = GlobalVariables.getUserSession().getPerson();
if (kualiUser == null) {
throw new IllegalStateException("Current UserSession has a null Person.");
}
return bo == null ? null : getNoteService().createNote(note, bo, kualiUser.getPrincipalId());
}
示例3: isVendorContractExpired
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.vnd.document.service.VendorService#isVendorContractExpired(org.kuali.kfs.vnd.businessobject.VendorDetail)
*/
@Override
public boolean isVendorContractExpired(Document document, VendorDetail vendorDetail) {
boolean isExpired = false;
Date currentDate = SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
List<VendorContract> vendorContracts = vendorDetail.getVendorContracts();
List<Note> notes = document.getNotes();
for (VendorContract vendorContract : vendorContracts) {
if (currentDate.compareTo(vendorContract.getVendorContractEndDate()) > 0 || !vendorContract.isActive()) {
Note newNote = new Note();
newNote.setNoteText("Vendor Contract: " + vendorContract.getVendorContractName() + " contract has expired contract end date.");
newNote.setNotePostedTimestampToCurrent();
newNote.setNoteTypeCode(OLEConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Note note = noteService.createNote(newNote, vendorDetail, GlobalVariables.getUserSession().getPrincipalId());
notes.add(note);
return true;
}
}
return isExpired;
}
示例4: isVendorContractExpired
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.vnd.document.service.VendorService#isVendorContractExpired(org.kuali.rice.krad.document.Document, java.lang.Integer, org.kuali.kfs.vnd.businessobject.VendorDetail)
*/
@Override
public boolean isVendorContractExpired(Document document, Integer vendorContractGeneratedIdentifier, VendorDetail vendorDetail) {
boolean isExpired = false;
if (ObjectUtils.isNotNull(vendorContractGeneratedIdentifier)) {
VendorContract vendorContract = SpringContext.getBean(BusinessObjectService.class).findBySinglePrimaryKey(VendorContract.class, vendorContractGeneratedIdentifier);
Date currentDate = SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
List<Note> notes = document.getNotes();
if ((currentDate.compareTo(vendorContract.getVendorContractEndDate()) > 0 && (vendorContract.getVendorContractExtensionDate() == null || currentDate.compareTo(vendorContract.getVendorContractExtensionDate()) > 0)) || !vendorContract.isActive()) {
Note newNote = new Note();
newNote.setNoteText("Vendor Contract: " + vendorContract.getVendorContractName() + " contract has expired contract end date.");
newNote.setNotePostedTimestampToCurrent();
newNote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Note note = noteService.createNote(newNote, vendorDetail, GlobalVariables.getUserSession().getPrincipalId());
notes.add(note);
isExpired = true;
}
}
return isExpired;
}
示例5: testNoteSave_LargePersonId
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* tests saving notes
*
* @throws Exception
*/
@Test public void testNoteSave_LargePersonId() throws Exception {
Note note = new Note();
note.setAuthorUniversalIdentifier("superLongNameUsersFromWorkflow");
note.setNotePostedTimestamp(CoreApiServiceLocator.getDateTimeService().getCurrentTimestamp());
note.setNoteText("i like notes");
note.setRemoteObjectIdentifier("1209348109834u");
note.setNoteTypeCode(NoteType.BUSINESS_OBJECT.getCode());
try {
KRADServiceLocator.getNoteService().save(note);
} catch (Exception e) {
fail("Saving a note should not fail");
}
}
示例6: createVendorNote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
public void createVendorNote(VendorDetail vendorDetail, String vendorNote) {
try {
if (StringUtils.isNotBlank(vendorNote)) {
Note newBONote = new Note();
newBONote.setNoteText(vendorNote);
newBONote.setNotePostedTimestampToCurrent();
newBONote.setNoteTypeCode(OLEConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Note note = noteService.createNote(newBONote, vendorDetail, GlobalVariables.getUserSession().getPrincipalId());
noteService.save(note);
}
} catch (Exception e){
throw new RuntimeException("Problems creating note for Vendor " + vendorDetail);
}
}
示例7: addNoteForInvoiceReportFail
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
protected void addNoteForInvoiceReportFail(ContractsGrantsInvoiceDocument document) {
Note note = new Note();
note.setNotePostedTimestampToCurrent();
note.setNoteText(configurationService.getPropertyValueAsString(ArKeyConstants.ERROR_FILE_UPLOAD_NO_PDF_FILE_SELECTED_FOR_SAVE));
note.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
note = noteService.createNote(note, document.getNoteTarget(), systemUser.getPrincipalId());
noteService.save(note);
document.addNote(note);
}
示例8: createCustomerNote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
@Override
public void createCustomerNote(String customerNumber, String customerNote) {
Customer customer = getByPrimaryKey(customerNumber);
if (StringUtils.isNotBlank(customerNote)) {
Note newBONote = new Note();
newBONote.setNoteText(customerNote);
newBONote.setNotePostedTimestampToCurrent();
newBONote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Note note = noteService.createNote(newBONote, customer, GlobalVariables.getUserSession().getPrincipalId());
noteService.save(note);
}
}
示例9: addCustomerCreatedNote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* Reference getDocumentService.createNoteFromDocument
*
* This method creates a note on the maintenance doc indicating that a AR Customer record has been generated.
* @param temProfile
* @return
*/
protected Note addCustomerCreatedNote(TemProfile temProfile) {
String text = "AR Customer ID " + temProfile.getCustomer().getCustomerNumber() + " has been generated";
Note note = new Note();
note.setNotePostedTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
note.setVersionNumber(Long.valueOf(1));
note.setNoteText(text);
note.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Person kualiUser = GlobalVariables.getUserSession().getPerson();
note = getNoteService().createNote(note, temProfile, kualiUser.getPrincipalId());
return note;
}
示例10: createVendorNote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
public void createVendorNote(VendorDetail vendorDetail, String vendorNote) {
try {
if (StringUtils.isNotBlank(vendorNote)) {
Note newBONote = new Note();
newBONote.setNoteText(vendorNote);
newBONote.setNotePostedTimestampToCurrent();
newBONote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Note note = noteService.createNote(newBONote, vendorDetail, GlobalVariables.getUserSession().getPrincipalId());
noteService.save(note);
}
} catch (Exception e){
throw new RuntimeException("Problems creating note for Vendor " + vendorDetail);
}
}
示例11: cancelQuote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* Cancels the process of obtaining quotes. Checks whether any of the quote requests have been transmitted. If none have, tries
* to obtain confirmation from the user for the cancellation. If confirmation is obtained, clears out the list of Vendors from
* which to obtain quotes and writes the given reason to a note on the PO.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward cancelQuote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchaseOrderForm poForm = (PurchaseOrderForm) form;
PurchaseOrderDocument document = (PurchaseOrderDocument) poForm.getDocument();
for (PurchaseOrderVendorQuote quotedVendors : document.getPurchaseOrderVendorQuotes()) {
if (quotedVendors.getPurchaseOrderQuoteTransmitTimestamp() != null) {
GlobalVariables.getMessageMap().putError(PurapPropertyConstants.VENDOR_QUOTES, PurapKeyConstants.ERROR_PURCHASE_ORDER_QUOTE_ALREADY_TRASNMITTED);
return mapping.findForward(OLEConstants.MAPPING_BASIC);
}
}
String message = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(PurapKeyConstants.PURCHASE_ORDER_QUESTION_CONFIRM_CANCEL_QUOTE);
Object question = request.getParameter(OLEConstants.QUESTION_INST_ATTRIBUTE_NAME);
if (question == null) {
// ask question if not already asked
return performQuestionWithInput(mapping, form, request, response, PODocumentsStrings.CONFIRM_CANCEL_QUESTION, message, OLEConstants.CONFIRMATION_QUESTION, PODocumentsStrings.CONFIRM_CANCEL_RETURN, "");
} else {
Object buttonClicked = request.getParameter(OLEConstants.QUESTION_CLICKED_BUTTON);
if ((PODocumentsStrings.CONFIRM_CANCEL_QUESTION.equals(question)) && ConfirmationQuestion.YES.equals(buttonClicked)) {
String reason = request.getParameter(OLEConstants.QUESTION_REASON_ATTRIBUTE_NAME);
if (StringUtils.isEmpty(reason)) {
return performQuestionWithInputAgainBecauseOfErrors(mapping, form, request, response, PODocumentsStrings.CONFIRM_CANCEL_QUESTION, message, OLEConstants.CONFIRMATION_QUESTION, PODocumentsStrings.CONFIRM_CANCEL_RETURN, "", "", PurapKeyConstants.ERROR_PURCHASE_ORDER_REASON_REQUIRED, OLEConstants.QUESTION_REASON_ATTRIBUTE_NAME, "250");
}
document.getPurchaseOrderVendorQuotes().clear();
Note cancelNote = new Note();
cancelNote.setAuthorUniversalIdentifier(GlobalVariables.getUserSession().getPerson().getPrincipalId());
String reasonPrefix = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(PurapKeyConstants.PURCHASE_ORDER_CANCEL_QUOTE_NOTE_TEXT);
cancelNote.setNoteText(reasonPrefix + reason);
cancelNote.setNoteTypeCode(document.getNoteType().getCode());
cancelNote.setNotePostedTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
document.addNote(cancelNote);
document.updateAndSaveAppDocStatus(PurapConstants.PurchaseOrderStatuses.APPDOC_IN_PROCESS);
//being required to add notes about changing po status even though i'm not changing status
document.setStatusChange(null);
SpringContext.getBean(PurapService.class).saveDocumentNoValidation(document);
}
}
return mapping.findForward(OLEConstants.MAPPING_BASIC);
}
示例12: generateInvoicesForInvoiceAddresses
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* This method generates the attached invoices for the agency addresses in the Contracts & Grants Invoice Document.
*/
@Override
public void generateInvoicesForInvoiceAddresses(ContractsGrantsInvoiceDocument document) {
InvoiceTemplate invoiceTemplate = null;
Iterator<InvoiceAddressDetail> iterator = document.getInvoiceAddressDetails().iterator();
while (iterator.hasNext()) {
InvoiceAddressDetail invoiceAddressDetail = iterator.next();
byte[] reportStream;
byte[] copyReportStream;
// validating the invoice template
if (ObjectUtils.isNotNull(invoiceAddressDetail.getCustomerInvoiceTemplateCode())) {
invoiceTemplate = businessObjectService.findBySinglePrimaryKey(InvoiceTemplate.class, invoiceAddressDetail.getCustomerInvoiceTemplateCode());
// generate invoices from templates.
if (ObjectUtils.isNotNull(invoiceTemplate) && invoiceTemplate.isActive() && StringUtils.isNotBlank(invoiceTemplate.getFilename())) {
ModuleConfiguration systemConfiguration = kualiModuleService.getModuleServiceByNamespaceCode(KFSConstants.OptionalModuleNamespaces.ACCOUNTS_RECEIVABLE).getModuleConfiguration();
String templateFolderPath = ((FinancialSystemModuleConfiguration) systemConfiguration).getTemplateFileDirectories().get(KFSConstants.TEMPLATES_DIRECTORY_KEY);
String templateFilePath = templateFolderPath + File.separator + invoiceTemplate.getFilename();
File templateFile = new File(templateFilePath);
File outputDirectory = null;
String outputFileName;
try {
// generating original invoice
outputFileName = document.getDocumentNumber() + "_" + invoiceAddressDetail.getCustomerAddressName() + getDateTimeService().toDateStringForFilename(getDateTimeService().getCurrentDate()) + ArConstants.TemplateUploadSystem.EXTENSION;
Map<String, String> replacementList = getTemplateParameterList(document);
replacementList.put(ArPropertyConstants.CustomerInvoiceDocumentFields.CUSTOMER+"."+ArPropertyConstants.FULL_ADDRESS, contractsGrantsBillingUtilityService.buildFullAddress(invoiceAddressDetail.getCustomerAddress()));
reportStream = PdfFormFillerUtil.populateTemplate(templateFile, replacementList);
// creating and saving the original note with an attachment
if (ObjectUtils.isNotNull(document.getInvoiceGeneralDetail()) && document.getInvoiceGeneralDetail().isFinalBillIndicator()) {
reportStream = PdfFormFillerUtil.createFinalmarkOnFile(reportStream, getConfigurationService().getPropertyValueAsString(ArKeyConstants.INVOICE_ADDRESS_PDF_WATERMARK_FINAL));
}
Note note = new Note();
note.setNotePostedTimestampToCurrent();
final String finalNotePattern = getConfigurationService().getPropertyValueAsString(ArKeyConstants.INVOICE_ADDRESS_PDF_FINAL_NOTE);
note.setNoteText(MessageFormat.format(finalNotePattern, document.getDocumentNumber(), invoiceAddressDetail.getCustomerAddressName()));
note.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
note = noteService.createNote(note, document.getNoteTarget(), systemUser.getPrincipalId());
Attachment attachment = attachmentService.createAttachment(note, outputFileName, ArConstants.TemplateUploadSystem.TEMPLATE_MIME_TYPE, reportStream.length, new ByteArrayInputStream(reportStream), KFSConstants.EMPTY_STRING);
// adding attachment to the note
note.setAttachment(attachment);
noteService.save(note);
attachment.setNoteIdentifier(note.getNoteIdentifier());
businessObjectService.save(attachment);
document.addNote(note);
// generating Copy invoice
outputFileName = document.getDocumentNumber() + "_" + invoiceAddressDetail.getCustomerAddressName() + getDateTimeService().toDateStringForFilename(getDateTimeService().getCurrentDate()) + getConfigurationService().getPropertyValueAsString(ArKeyConstants.INVOICE_ADDRESS_PDF_COPY_FILENAME_SUFFIX) + ArConstants.TemplateUploadSystem.EXTENSION;
copyReportStream = PdfFormFillerUtil.createWatermarkOnFile(reportStream, getConfigurationService().getPropertyValueAsString(ArKeyConstants.INVOICE_ADDRESS_PDF_WATERMARK_COPY));
// creating and saving the copy note with an attachment
Note copyNote = new Note();
copyNote.setNotePostedTimestampToCurrent();
final String copyNotePattern = getConfigurationService().getPropertyValueAsString(ArKeyConstants.INVOICE_ADDRESS_PDF_COPY_NOTE);
copyNote.setNoteText(MessageFormat.format(copyNotePattern, document.getDocumentNumber(), invoiceAddressDetail.getCustomerAddressName()));
copyNote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
copyNote = noteService.createNote(copyNote, document.getNoteTarget(), systemUser.getPrincipalId());
Attachment copyAttachment = attachmentService.createAttachment(copyNote, outputFileName, ArConstants.TemplateUploadSystem.TEMPLATE_MIME_TYPE, copyReportStream.length, new ByteArrayInputStream(copyReportStream), KFSConstants.EMPTY_STRING);
// adding attachment to the note
copyNote.setAttachment(copyAttachment);
noteService.save(copyNote);
copyAttachment.setNoteIdentifier(copyNote.getNoteIdentifier());
businessObjectService.save(copyAttachment);
document.addNote(copyNote);
invoiceAddressDetail.setNoteId(note.getNoteIdentifier());
// saving the note to the document header
documentService.updateDocument(document);
} catch (IOException | DocumentException ex) {
addNoteForInvoiceReportFail(document);
}
} else {
addNoteForInvoiceReportFail(document);
}
} else {
addNoteForInvoiceReportFail(document);
}
}
}
示例13: submitSensitiveData
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* Invoked when an authorized user presses "Submit" button on the "Assign Sensitive Data" page.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServeletRequest
* @param response The HttpServeletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward submitSensitiveData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("Submit Sensitive Data started");
PurchaseOrderForm poForm = (PurchaseOrderForm) form;
PurchaseOrderDocument po = (PurchaseOrderDocument) poForm.getDocument();
Integer poId = po.getPurapDocumentIdentifier();
List<SensitiveData> sds = poForm.getSensitiveDatasAssigned();
String sdaReason = poForm.getSensitiveDataAssignmentReason();
SensitiveDataService sdService = SpringContext.getBean(SensitiveDataService.class);
// check business rules
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAssignSensitiveDataEvent("", po, sdaReason, sds));
if (!rulePassed) {
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
// update table SensitiveDataAssignment
SensitiveDataAssignment sda = new SensitiveDataAssignment(poId, poForm.getSensitiveDataAssignmentReason(), GlobalVariables.getUserSession().getPerson().getPrincipalName(), poForm.getSensitiveDatasAssigned());
SpringContext.getBean(BusinessObjectService.class).save(sda);
// update table PurchaseOrderSensitiveData
sdService.deletePurchaseOrderSensitiveDatas(poId);
List<PurchaseOrderSensitiveData> posds = new ArrayList<PurchaseOrderSensitiveData>();
for (SensitiveData sd : sds) {
posds.add(new PurchaseOrderSensitiveData(poId, po.getRequisitionIdentifier(), sd.getSensitiveDataCode()));
}
SpringContext.getBean(BusinessObjectService.class).save(posds);
// need this to update workflow doc for searching restrictions on sensitive data
SpringContext.getBean(PurapService.class).saveRoutingDataForRelatedDocuments(po.getAccountsPayablePurchasingDocumentLinkIdentifier());
// reset the sensitive data related fields in the po form
po.setAssigningSensitiveData(false);
ParameterService parmService = SpringContext.getBean(ParameterService.class);
if (parmService.parameterExists(PurchaseOrderDocument.class, PurapParameterConstants.PO_SENSITIVE_DATA_NOTE_IND) && parmService.getParameterValueAsBoolean(PurchaseOrderDocument.class, PurapParameterConstants.PO_SENSITIVE_DATA_NOTE_IND)) {
Note newNote = new Note();
String introNoteMessage = "Sensitive Data:" + KFSConstants.BLANK_SPACE;
String reason = sda.getSensitiveDataAssignmentReasonText();
// Build out full message.
String noteText = introNoteMessage + " " + reason;
newNote.setNoteText(noteText);
newNote.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
poForm.setNewNote(newNote);
poForm.setAttachmentFile(new BlankFormFile());
insertBONote(mapping, poForm, request, response);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
示例14: cancelQuote
import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
* Cancels the process of obtaining quotes. Checks whether any of the quote requests have been transmitted. If none have, tries
* to obtain confirmation from the user for the cancellation. If confirmation is obtained, clears out the list of Vendors from
* which to obtain quotes and writes the given reason to a note on the PO.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @throws Exception
* @return An ActionForward
*/
public ActionForward cancelQuote(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchaseOrderForm poForm = (PurchaseOrderForm) form;
PurchaseOrderDocument document = (PurchaseOrderDocument) poForm.getDocument();
for (PurchaseOrderVendorQuote quotedVendors : document.getPurchaseOrderVendorQuotes()) {
if (quotedVendors.getPurchaseOrderQuoteTransmitTimestamp() != null) {
GlobalVariables.getMessageMap().putError(PurapPropertyConstants.VENDOR_QUOTES, PurapKeyConstants.ERROR_PURCHASE_ORDER_QUOTE_ALREADY_TRASNMITTED);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
}
String message = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(PurapKeyConstants.PURCHASE_ORDER_QUESTION_CONFIRM_CANCEL_QUOTE);
Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
if (question == null) {
// ask question if not already asked
return performQuestionWithInput(mapping, form, request, response, PODocumentsStrings.CONFIRM_CANCEL_QUESTION, message, KFSConstants.CONFIRMATION_QUESTION, PODocumentsStrings.CONFIRM_CANCEL_RETURN, "");
}
else {
Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
if ((PODocumentsStrings.CONFIRM_CANCEL_QUESTION.equals(question)) && ConfirmationQuestion.YES.equals(buttonClicked)) {
String reason = request.getParameter(KFSConstants.QUESTION_REASON_ATTRIBUTE_NAME);
if (StringUtils.isEmpty(reason)) {
return performQuestionWithInputAgainBecauseOfErrors(mapping, form, request, response, PODocumentsStrings.CONFIRM_CANCEL_QUESTION, message, KFSConstants.CONFIRMATION_QUESTION, PODocumentsStrings.CONFIRM_CANCEL_RETURN, "", "", PurapKeyConstants.ERROR_PURCHASE_ORDER_REASON_REQUIRED, KFSConstants.QUESTION_REASON_ATTRIBUTE_NAME, "250");
}
document.getPurchaseOrderVendorQuotes().clear();
Note cancelNote = new Note();
cancelNote.setAuthorUniversalIdentifier(GlobalVariables.getUserSession().getPerson().getPrincipalId());
String reasonPrefix = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(PurapKeyConstants.PURCHASE_ORDER_CANCEL_QUOTE_NOTE_TEXT);
cancelNote.setNoteText(reasonPrefix + reason);
cancelNote.setNoteTypeCode(document.getNoteType().getCode());
cancelNote.setNotePostedTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
document.addNote(cancelNote);
document.updateAndSaveAppDocStatus(PurapConstants.PurchaseOrderStatuses.APPDOC_IN_PROCESS);
// being required to add notes about changing po status even though i'm not changing status
document.setStatusChange(null);
SpringContext.getBean(PurapService.class).saveDocumentNoValidation(document);
}
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}