use of org.mifos.dto.domain.CustomerNoteDto 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;
}
use of org.mifos.dto.domain.CustomerNoteDto in project head by mifos.
the class SavingsBO method toDto.
public SavingsAccountDetailDto toDto() {
List<SavingsRecentActivityDto> recentActivity = this.getRecentAccountActivity(3);
List<CustomerNoteDto> recentNoteDtos = new ArrayList<CustomerNoteDto>();
List<AccountNotesEntity> recentNotes = this.getRecentAccountNotes();
for (AccountNotesEntity accountNotesEntity : recentNotes) {
recentNoteDtos.add(new CustomerNoteDto(accountNotesEntity.getCommentDate(), accountNotesEntity.getComment(), accountNotesEntity.getPersonnelName()));
}
SavingsPerformanceHistoryDto savingsPerformanceHistoryDto = new SavingsPerformanceHistoryDto(getActivationDate(), savingsPerformance.getTotalDeposits().toString(), savingsPerformance.getTotalWithdrawals().toString(), savingsPerformance.getTotalInterestEarned().toString(), savingsPerformance.getMissedDeposits() != null ? savingsPerformance.getMissedDeposits().toString() : "0");
AccountActionDateEntity nextInstallment = getDetailsOfNextInstallment();
return new SavingsAccountDetailDto(this.savingsOffering.toFullDto(), recentActivity, recentNoteDtos, this.recommendedAmount.toString(), this.globalAccountNum, getAccountId(), getState().getValue(), getState().name(), getSavingsBalance().toString(), nextInstallment != null ? nextInstallment.getActionDate() : null, getTotalAmountDue().toString(), getTotalAmountDueForNextInstallment().toString(), getTotalAmountInArrears().toString(), savingsPerformanceHistoryDto, this.savingsOffering.getSavingsTypeAsEnum().name(), this.customer.getCustomerId());
}
use of org.mifos.dto.domain.CustomerNoteDto in project head by mifos.
the class CustomerDaoHibernate method getRecentCustomerNoteDto.
@Override
public List<CustomerNoteDto> getRecentCustomerNoteDto(Integer customerId) {
Integer recent = 3;
List<CustomerNoteDto> customerNotes = getCustomerNoteDto(customerId);
if (customerNotes == null) {
return null;
}
if (customerNotes.size() < (recent + 1)) {
return customerNotes;
}
List<CustomerNoteDto> recentCustomerNotes = new ArrayList<CustomerNoteDto>(recent);
for (int i = 0; i < recent; i++) {
recentCustomerNotes.add(customerNotes.get(i));
}
return recentCustomerNotes;
}
use of org.mifos.dto.domain.CustomerNoteDto in project head by mifos.
the class CustomerDaoHibernate method getCustomerNoteDto.
@SuppressWarnings("unchecked")
private List<CustomerNoteDto> getCustomerNoteDto(Integer customerId) {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("CUSTOMER_ID", customerId);
List<Object[]> queryResult = (List<Object[]>) this.genericDao.executeNamedQuery("Customer.getCustomerNoteDto", queryParameters);
if (queryResult.size() == 0) {
return null;
}
List<CustomerNoteDto> customerNotes = new ArrayList<CustomerNoteDto>();
Date commentDate;
String comment;
String personnelName;
for (Object[] customerNote : queryResult) {
commentDate = (Date) customerNote[0];
comment = (String) customerNote[1];
personnelName = (String) customerNote[2];
customerNotes.add(new CustomerNoteDto(commentDate, comment, personnelName));
}
return customerNotes;
}
Aggregations