use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrievePossibleGuarantors.
public List<CustomerSearchResultDto> retrievePossibleGuarantors(CustomerSearchDto customerSearchDto, boolean isNewGLIMCreation, Integer clientId, Integer loanId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
try {
List<CustomerSearchResultDto> pagedDetails = new ArrayList<CustomerSearchResultDto>();
QueryResult customerForSavings = customerPersistence.searchGroupClient(customerSearchDto.getSearchTerm(), userContext.getId(), isNewGLIMCreation);
int position = (customerSearchDto.getPage() - 1) * customerSearchDto.getPageSize();
List<AccountSearchResultsDto> pagedResults = customerForSavings.get(position, customerSearchDto.getPageSize());
int i = 1;
for (AccountSearchResultsDto customerBO : pagedResults) {
if (CustomerLevel.getLevel(customerBO.getLevelId()) == CustomerLevel.CLIENT && customerBO.getClientId() != clientId && isApplicableForGuaranty(customerBO, loanId)) {
CustomerSearchResultDto customer = new CustomerSearchResultDto();
customer.setCustomerId(customerBO.getClientId());
customer.setBranchName(customerBO.getOfficeName());
customer.setGlobalId(customerBO.getGlobelNo());
customer.setSearchIndex(i);
customer.setCenterName(StringUtils.defaultIfEmpty(customerBO.getCenterName(), "--"));
customer.setGroupName(StringUtils.defaultIfEmpty(customerBO.getGroupName(), "--"));
customer.setClientName(customerBO.getClientName());
pagedDetails.add(customer);
}
i++;
}
return pagedDetails;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
} catch (HibernateSearchException e) {
throw new MifosRuntimeException(e);
} catch (ConfigurationException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class FundTransferController method searchCustomers.
// All methods are called by Spring Webflow
public CustomerSearchResultsDto searchCustomers(CustomerSearchFormBean formBean) {
Integer searchCap = 1000;
CustomerSearchDto customerSearchDto = new CustomerSearchDto(formBean.getSearchString(), Integer.valueOf(1), searchCap);
List<CustomerSearchResultDto> pagedDetails = this.savingsServiceFacade.retrieveCustomersThatQualifyForTransfer(customerSearchDto);
SearchDetailsDto searchDetails = new SearchDetailsDto(pagedDetails.size(), 1, 1, searchCap);
return new CustomerSearchResultsDto(searchDetails, pagedDetails);
}
Aggregations