当前位置: 首页>>代码示例>>Java>>正文


Java Note.setAttachment方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.bo.Note.setAttachment方法的典型用法代码示例。如果您正苦于以下问题:Java Note.setAttachment方法的具体用法?Java Note.setAttachment怎么用?Java Note.setAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.bo.Note的用法示例。


在下文中一共展示了Note.setAttachment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.NoteService#save(org.kuali.rice.krad.bo.Note)
    */
   @Override
public Note save(Note note) {
   	validateNoteNotNull(note);
   	if (StringUtils.isBlank(note.getRemoteObjectIdentifier())) {
   		throw new IllegalStateException("The remote object identifier must be established on a Note before it can be saved.  Given note had a null or empty remote object identifier.");
   	}
       if (note.getAttachment() != null && note.getAttachment().getAttachmentFileName() == null) {
           note.setAttachment(null);
       }
       if (note != null && note.getNoteIdentifier() == null && note.getAttachment() != null) {
           Attachment attachment = note.getAttachment();
           note.setAttachment(null);
           // store without attachment
           note = dataObjectService.save(note);
           attachment.setNoteIdentifier(note.getNoteIdentifier());
           // put attachment back
           note.setAttachment(attachment);
       }
       note = dataObjectService.save(note);
       // move attachment from pending directory
       if (note.getAttachment() != null) {
       	attachmentService.moveAttachmentWherePending(note);
       }
       return note;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:NoteServiceImpl.java

示例2: deleteNote

import org.kuali.rice.krad.bo.Note; //导入方法依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.NoteService#deleteNote(org.kuali.rice.krad.bo.Note)
    */
   @Override
public void deleteNote(Note note) {
   	validateNoteNotNull(note);
   	if ( note.getAttachment() != null ) { // Not sure about this - might blow up when no attachment
   		dataObjectService.delete(note.getAttachment());
           note.setAttachment(null);
   	}
       dataObjectService.delete(note);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:NoteServiceImpl.java

示例3: 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);
        }

    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:81,代码来源:ContractsGrantsInvoiceDocumentServiceImpl.java


注:本文中的org.kuali.rice.krad.bo.Note.setAttachment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。