Search in sources :

Example 1 with NoteService

use of org.kuali.kfs.krad.service.NoteService in project cu-kfs by CU-CommunityApps.

the class PaymentRequestView method getNotes.

/**
 * @see org.kuali.kfs.module.purap.businessobject.AbstractRelatedView#getNotes()j
 * This is overriden to prevent duplicate fetching of the object id needed to fetch notes
 * which becomes a problem when you have a lot of associated payment requests with a
 * given purchase order
 */
@Override
public List<Note> getNotes() {
    List<Note> notes = new ArrayList<Note>();
    // reverse the order of notes only when anything exists in it..
    NoteService noteService = SpringContext.getBean(NoteService.class);
    // ==== CU Customization: Use a CU-specific PREQ service method to get the note target object ID, instead of always using the doc header one. ====
    CuPaymentRequestService cuPaymentRequestService = SpringContext.getBean(CuPaymentRequestService.class);
    List<Note> tmpNotes = noteService.getByRemoteObjectId(cuPaymentRequestService.getPaymentRequestNoteTargetObjectId(getDocumentNumber()));
    notes.clear();
    // reverse the order of notes retrieved so that newest note is in the front
    for (int i = tmpNotes.size() - 1; i >= 0; i--) {
        Note note = tmpNotes.get(i);
        notes.add(note);
    }
    return notes;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) ArrayList(java.util.ArrayList) NoteService(org.kuali.kfs.krad.service.NoteService) CuPaymentRequestService(edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService)

Example 2 with NoteService

use of org.kuali.kfs.krad.service.NoteService in project cu-kfs by CU-CommunityApps.

the class CuCreditMemoServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    accountsPayableService = EasyMock.createNiceMock(AccountsPayableService.class);
    EasyMock.expect(accountsPayableService.getExpiredOrClosedAccountList(creditMemoDocument)).andReturn(new HashMap<>());
    EasyMock.replay(accountsPayableService);
    dataDictionaryService = EasyMock.createNiceMock(DataDictionaryService.class);
    EasyMock.expect(dataDictionaryService.getAttributeMaxLength(DocumentHeader.class, KRADPropertyConstants.DOCUMENT_DESCRIPTION)).andReturn(200);
    EasyMock.replay(dataDictionaryService);
    dateTimeService = new DateTimeServiceImpl();
    documentService = new MockDocumentServiceImpl();
    noteService = EasyMock.createMock(NoteService.class);
    purapService = EasyMock.createMock(PurapService.class);
    vendorService = new MockVendorServiceImpl();
    creditMemoServiceImpl = PowerMock.createPartialMock(CuCreditMemoServiceImplTest.TestCuCreditMemoServiceImpl.class, "reIndexDocument", "getCreditMemoDocumentById");
    creditMemoServiceImpl.setDocumentService(documentService);
    creditMemoServiceImpl.setNoteService(noteService);
    creditMemoServiceImpl.setPurapService(purapService);
    creditMemoServiceImpl.setAccountsPayableService(accountsPayableService);
    creditMemoServiceImpl.setVendorService(vendorService);
    creditMemoServiceImpl.setDataDictionaryService(dataDictionaryService);
    creditMemoDocument = setupVendorCreditMemoDocument();
    mo14Person = MockPersonUtil.createMockPerson(UserNameFixture.mo14);
    mo14Session = MockPersonUtil.createMockUserSession(mo14Person);
    GlobalVariables.setUserSession(mo14Session);
}
Also used : DateTimeServiceImpl(org.kuali.rice.core.impl.datetime.DateTimeServiceImpl) PurapService(org.kuali.kfs.module.purap.document.service.PurapService) NoteService(org.kuali.kfs.krad.service.NoteService) AccountsPayableService(org.kuali.kfs.module.purap.document.service.AccountsPayableService) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService) Before(org.junit.Before)

Example 3 with NoteService

use of org.kuali.kfs.krad.service.NoteService in project cu-kfs by CU-CommunityApps.

the class AbstractRelatedView method getNotes.

public List<Note> getNotes() {
    List<Note> notes = new ArrayList<Note>();
    // reverse the order of notes only when anything exists in it..
    NoteService noteService = SpringContext.getBean(NoteService.class);
    // ==== CU Customization: Use the note target property, rather than always assuming that the doc header is the target. ====
    List<Note> tmpNotes = noteService.getByRemoteObjectId(findDocument(this.documentNumber).getNoteTarget().getObjectId());
    notes.clear();
    // reverse the order of notes retrieved so that newest note is in the front
    for (int i = tmpNotes.size() - 1; i >= 0; i--) {
        Note note = tmpNotes.get(i);
        notes.add(note);
    }
    return notes;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) ArrayList(java.util.ArrayList) NoteService(org.kuali.kfs.krad.service.NoteService)

Aggregations

NoteService (org.kuali.kfs.krad.service.NoteService)3 ArrayList (java.util.ArrayList)2 Note (org.kuali.kfs.krad.bo.Note)2 CuPaymentRequestService (edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService)1 Before (org.junit.Before)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 AccountsPayableService (org.kuali.kfs.module.purap.document.service.AccountsPayableService)1 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)1 DateTimeServiceImpl (org.kuali.rice.core.impl.datetime.DateTimeServiceImpl)1