Search in sources :

Example 31 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class PaymentWorksDataProcessingIntoKfsServiceImpl method buildVendorMaintenanceDocumentBase.

private MaintenanceDocument buildVendorMaintenanceDocumentBase(VendorDetail newVendorDetail, VendorDetail oldVendorDetail, String documentAction, boolean isNewVendor, List<Note> notesToPersist) throws WorkflowException {
    MaintenanceDocument vendorMaintDoc = (MaintenanceDocument) getDocumentService().getNewDocument(CUVendorConstants.VENDOR_DOCUMENT_TYPE_NAME);
    vendorMaintDoc.getNewMaintainableObject().setBusinessObject(newVendorDetail);
    vendorMaintDoc.getOldMaintainableObject().setBusinessObject(oldVendorDetail);
    vendorMaintDoc.getDocumentHeader().setDocumentDescription(buildVendorMainenanceDocumentDescription(newVendorDetail, isNewVendor));
    vendorMaintDoc.getNewMaintainableObject().setMaintenanceAction(documentAction);
    for (Note note : notesToPersist) {
        note.setRemoteObjectIdentifier(vendorMaintDoc.getObjectId());
        vendorMaintDoc.addNote(note);
    }
    return vendorMaintDoc;
}
Also used : MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) Note(org.kuali.kfs.krad.bo.Note)

Example 32 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuAttachmentServiceImplTest method setupMockNote.

private Note setupMockNote(String objectId) {
    Note mockNote = EasyMock.createMock(Note.class);
    EasyMock.expect(mockNote.getRemoteObjectIdentifier()).andStubReturn(objectId);
    EasyMock.replay(mockNote);
    return mockNote;
}
Also used : Note(org.kuali.kfs.krad.bo.Note)

Example 33 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuAttachmentServiceImplTest method setUp.

@Before
public void setUp() throws IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    attachmentService = new CuAttachmentServiceImpl();
    attachmentService.setKualiConfigurationService(new MockConfigurationService());
    attachmentService.setAttachmentDao(new MockAttachmentDao());
    attachmentService.setNoteService(new MockNoteService());
    attachmentService.setAntiVirusService(new MockAntivirusService());
    attachment = new Attachment();
    attachment.setObjectId(String.valueOf(new Guid()));
    attachment.setAttachmentIdentifier(attachment.getObjectId());
    Note noteGood = setupMockNote();
    attachment.setNote(noteGood);
    createAttachmentFile(noteGood, GOOD_FILE_NAME);
    noteVirus = setupMockNote();
    createAttachmentFile(noteVirus, VIRUS_FILE_NAME);
}
Also used : Note(org.kuali.kfs.krad.bo.Note) Attachment(org.kuali.kfs.krad.bo.Attachment) Guid(org.kuali.kfs.sys.util.Guid) Before(org.junit.Before)

Example 34 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuAttachmentServiceImplTest method setupMockNote.

private Note setupMockNote() {
    Note mockNote = EasyMock.createMock(Note.class);
    EasyMock.expect(mockNote.getRemoteObjectIdentifier()).andStubReturn(String.valueOf(new Guid()));
    EasyMock.replay(mockNote);
    return mockNote;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) Guid(org.kuali.kfs.sys.util.Guid)

Example 35 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class AccountReversionTrickleDownInactivationServiceImpl method addMaintenanceLockedNotes.

/**
 * Adds notes about any maintence locks on Account Reversions.
 *
 * @param documentNumber
 * @param lockedAccountReversions
 * @param messageKey
 * @param noteParent
 * @param noteTemplate
 */
protected void addMaintenanceLockedNotes(String documentNumber, Map<AccountReversion, String> lockedAccountReversions, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) {
    for (Map.Entry<AccountReversion, String> entry : lockedAccountReversions.entrySet()) {
        try {
            AccountReversion accountReversion = entry.getKey();
            String accountReversionString = accountReversion.getUniversityFiscalYear() + " - " + accountReversion.getChartOfAccountsCode() + " - " + accountReversion.getAccountNumber();
            if (StringUtils.isNotBlank(accountReversionString)) {
                String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey);
                String noteText = MessageFormat.format(noteTextTemplate, accountReversionString, entry.getValue());
                Note note = noteService.createNote(noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId());
                note.setNoteText(noteText);
                noteService.save(note);
            }
        } catch (Exception e) {
            LOG.error("Unable to create/save notes for document " + documentNumber, e);
            throw new RuntimeException("Unable to create/save notes for document " + documentNumber, e);
        }
    }
}
Also used : AccountReversion(edu.cornell.kfs.coa.businessobject.AccountReversion) Note(org.kuali.kfs.krad.bo.Note) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Note (org.kuali.kfs.krad.bo.Note)76 Attachment (org.kuali.kfs.krad.bo.Attachment)14 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)12 IOException (java.io.IOException)9 FileNotFoundException (java.io.FileNotFoundException)7 ArrayList (java.util.ArrayList)7 NoteService (org.kuali.kfs.krad.service.NoteService)7 FileInputStream (java.io.FileInputStream)6 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)6 NonTransactional (org.kuali.kfs.sys.service.NonTransactional)6 File (java.io.File)5 Iterator (java.util.Iterator)5 DocumentService (org.kuali.kfs.krad.service.DocumentService)5 Person (org.kuali.rice.kim.api.identity.Person)5 NoteExtendedAttribute (edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Document (org.kuali.kfs.krad.document.Document)4 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)4 HashMap (java.util.HashMap)3 List (java.util.List)3