use of org.mifos.dto.screen.NotesSearchResultsDto in project head by mifos.
the class NotesAction method getSearchResult.
@Override
protected QueryResult getSearchResult(ActionForm form) throws Exception {
Integer accountId = Integer.valueOf(((NotesActionForm) form).getAccountId());
AccountBO account = new AccountBusinessService().getAccount(accountId);
if (account.isSavingsAccount()) {
NoteSearchDto noteSearchDto = new NoteSearchDto(accountId, Integer.valueOf(1), Integer.valueOf(10));
NotesSearchResultsDto noteResults = this.savingsServiceFacade.retrievePagedNotesDto(noteSearchDto);
}
return legacyAccountDao.getAllAccountNotes(accountId);
}
use of org.mifos.dto.screen.NotesSearchResultsDto in project head by mifos.
the class SavingsDaoHibernate method searchNotes.
@SuppressWarnings("unchecked")
@Override
public NotesSearchResultsDto searchNotes(NoteSearchDto noteSearch) {
Session session = StaticHibernateUtil.getSessionTL();
Criteria criteriaQuery = session.createCriteria(AccountNotesEntity.class);
criteriaQuery.add(Restrictions.eq("account.accountId", noteSearch.getAccountId()));
criteriaQuery.addOrder(Order.desc("commentId"));
Integer totalNumberOfSavingsNotes = 10;
int firstResult = (noteSearch.getPage() * noteSearch.getPageSize()) - noteSearch.getPageSize();
criteriaQuery.setFirstResult(firstResult);
criteriaQuery.setMaxResults(noteSearch.getPageSize());
List<AccountNotesEntity> pagedResults = criteriaQuery.list();
List<CustomerNoteDto> pageDtoResults = new ArrayList<CustomerNoteDto>();
for (AccountNotesEntity note : pagedResults) {
pageDtoResults.add(new CustomerNoteDto(note.getCommentDate(), note.getComment(), note.getPersonnelName()));
}
SearchDetailsDto searchDetails = new SearchDetailsDto(totalNumberOfSavingsNotes.intValue(), firstResult, noteSearch.getPage(), noteSearch.getPageSize());
NotesSearchResultsDto resultsDto = new NotesSearchResultsDto(searchDetails, pageDtoResults);
return resultsDto;
}
Aggregations