use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveCustomerThatQualifyForSavings.
@Override
public List<CustomerSearchResultDto> retrieveCustomerThatQualifyForSavings(CustomerSearchDto customerSearchDto) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
try {
List<CustomerSearchResultDto> pagedDetails = new ArrayList<CustomerSearchResultDto>();
QueryResult customerForSavings = new CustomerPersistence().searchCustForSavings(customerSearchDto.getSearchTerm(), userContext.getId());
int position = this.resultsetOffset(customerSearchDto.getPage(), customerSearchDto.getPageSize());
List<AccountSearchResultsDto> pagedResults = customerForSavings.get(position, customerSearchDto.getPageSize());
int i = 1;
for (AccountSearchResultsDto customerBO : pagedResults) {
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);
}
}
use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveCustomersThatQualifyForLoans.
@Override
public List<CustomerSearchResultDto> retrieveCustomersThatQualifyForLoans(CustomerSearchDto customerSearchDto, boolean isNewGLIMCreation) {
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) {
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 LoanAccountController method searchCustomers.
public CustomerSearchResultsDto searchCustomers(CustomerSearchFormBean formBean, boolean isNewGLIMCreation) {
// Search result cap. This is needed until ajax search is implemented.
Integer searchCap = 1000;
CustomerSearchDto customerSearchDto = new CustomerSearchDto(formBean.getSearchString(), Integer.valueOf(1), searchCap);
List<CustomerSearchResultDto> pagedDetails = this.loanAccountServiceFacade.retrieveCustomersThatQualifyForLoans(customerSearchDto, isNewGLIMCreation);
//int firstResult = formBean.getPage() * formBean.getPageSize() - (formBean.getPageSize()-1);
// FIXME selected pageNumber and pageSize info should be passed in on bean.
SearchDetailsDto searchDetails = new SearchDetailsDto(pagedDetails.size(), 1, 1, searchCap);
return new CustomerSearchResultsDto(searchDetails, pagedDetails);
}
use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class LoanAccountController method searchPossibleGuarantors.
public CustomerSearchResultsDto searchPossibleGuarantors(CustomerSearchFormBean formBean, boolean isNewGLIMCreation, Integer clientId, Integer loanId) {
//As above, same issues occur (@searchCustomers)
Integer searchCap = 1000;
CustomerSearchDto customerSearchDto = new CustomerSearchDto(formBean.getSearchString(), Integer.valueOf(1), searchCap);
List<CustomerSearchResultDto> pagedDetails = this.loanAccountServiceFacade.retrievePossibleGuarantors(customerSearchDto, isNewGLIMCreation, clientId, loanId);
SearchDetailsDto searchDetails = new SearchDetailsDto(pagedDetails.size(), 1, 1, searchCap);
return new CustomerSearchResultsDto(searchDetails, pagedDetails);
}
use of org.mifos.dto.domain.CustomerSearchResultDto in project head by mifos.
the class CreateSavingsAccountController method searchCustomers.
public CustomerSearchResultsDto searchCustomers(CreateSavingsAccountFormBean formBean) {
// Search result cap. This is needed until ajax search is implemented.
Integer searchCap = 1000;
// FIXME - keithw - selected pageNumber and pageSize info should be passed in on bean.
CustomerSearchDto customerSearchDto = new CustomerSearchDto(formBean.getSearchString(), Integer.valueOf(1), searchCap);
List<CustomerSearchResultDto> pagedDetails = this.savingsServiceFacade.retrieveCustomerThatQualifyForSavings(customerSearchDto);
SearchDetailsDto searchDetails = new SearchDetailsDto(pagedDetails.size(), 1, 1, searchCap);
return new CustomerSearchResultsDto(searchDetails, pagedDetails);
}
Aggregations