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;
}
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);
}
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;
}
Aggregations