Search in sources :

Example 1 with CuPaymentRequestService

use of edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService 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)

Aggregations

CuPaymentRequestService (edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService)1 ArrayList (java.util.ArrayList)1 Note (org.kuali.kfs.krad.bo.Note)1 NoteService (org.kuali.kfs.krad.service.NoteService)1