use of org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm in project head by mifos.
the class MultipleLoanAccountsCreationAction method getCenters.
@TransactionDemarcate(joinToken = true)
public ActionForward getCenters(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MultipleLoanAccountsCreationActionForm loanActionForm = (MultipleLoanAccountsCreationActionForm) form;
Short loanOfficerId = getShortValue(loanActionForm.getLoanOfficerId());
Short officeId = getShortValue(loanActionForm.getBranchOfficeId());
List<CustomerDto> topLevelCustomers = this.loanAccountServiceFacade.retrieveActiveGroupingAtTopOfCustomerHierarchyForLoanOfficer(loanOfficerId, officeId);
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
SessionUtils.setCollectionAttribute(LoanConstants.MULTIPLE_LOANS_CENTERS_LIST, topLevelCustomers, request);
SessionUtils.setAttribute(LoanConstants.IS_CENTER_HIERARCHY_EXISTS, isCenterHierarchyExists ? Constants.YES : Constants.NO, request);
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm in project head by mifos.
the class MultipleLoanAccountsCreationAction method getPrdOfferings.
@TransactionDemarcate(joinToken = true)
public ActionForward getPrdOfferings(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MultipleLoanAccountsCreationActionForm loanActionForm = (MultipleLoanAccountsCreationActionForm) form;
Integer customerId = getIntegerValue(loanActionForm.getCenterId());
CustomerBO customer = this.customerDao.findCustomerById(customerId);
loanActionForm.setCenterSearchId(customer.getSearchId());
List<LoanOfferingBO> loanOfferings = this.loanProductDao.findActiveLoanProductsApplicableToCustomerLevel(new CustomerLevelEntity(CustomerLevel.CLIENT));
MeetingBO customerMeeting = customer.getCustomerMeetingValue();
for (Iterator<LoanOfferingBO> iter = loanOfferings.iterator(); iter.hasNext(); ) {
LoanOfferingBO loanOffering = iter.next();
if (!isMeetingMatched(customerMeeting, loanOffering.getLoanOfferingMeeting().getMeeting())) {
iter.remove();
}
}
SessionUtils.setCollectionAttribute(LoanConstants.LOANPRDOFFERINGS, loanOfferings, request);
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm in project head by mifos.
the class MultipleLoanAccountsCreationAction method get.
@TransactionDemarcate(joinToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MultipleLoanAccountsCreationActionForm loanActionForm = (MultipleLoanAccountsCreationActionForm) form;
String searchId = loanActionForm.getCenterSearchId();
Short branchId = getShortValue(loanActionForm.getBranchOfficeId());
Integer productId = Integer.parseInt(loanActionForm.getPrdOfferingId());
MultipleLoanAccountDetailsDto multipleLoanDetails = this.loanAccountServiceFacade.retrieveMultipleLoanAccountDetails(searchId, branchId, productId);
List<ClientBO> clients = this.customerDao.findActiveClientsUnderParent(searchId, branchId);
if (clients.isEmpty()) {
throw new BusinessRuleException(LoanConstants.NOSEARCHRESULTS);
}
LoanOfferingBO loanOffering = this.loanProductDao.findById(productId);
List<MultipleLoanCreationDto> multipleLoanDetailsXX = buildClientViewHelper(loanOffering, clients);
loanActionForm.setClientDetails(multipleLoanDetailsXX);
SessionUtils.setAttribute(LoanConstants.LOANOFFERING, loanOffering, request);
SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, multipleLoanDetails.getAllLoanPruposes(), request);
SessionUtils.setAttribute(CustomerConstants.PENDING_APPROVAL_DEFINED, multipleLoanDetails.isLoanPendingApprovalStateEnabled(), request);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm in project head by mifos.
the class MultipleLoanAccountsCreationAction method create.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MultipleLoanAccountsCreationActionForm loanActionForm = (MultipleLoanAccountsCreationActionForm) form;
Integer centerId = getIntegerValue(loanActionForm.getCenterId());
Short loanProductId = getShortValue(loanActionForm.getPrdOfferingId());
Short accountStateId = getShortValue(loanActionForm.getStateSelected());
List<MultipleLoanCreationDto> applicableClientDetails = loanActionForm.getApplicableClientDetails();
List<CreateLoanRequest> createMultipleLoans = new ArrayList<CreateLoanRequest>();
for (MultipleLoanCreationDto clientDetail : applicableClientDetails) {
CreateLoanRequest createLoanRequest = new CreateLoanRequest(centerId, loanProductId, accountStateId, clientDetail.getClientId(), clientDetail.getLoanAmount(), clientDetail.getDefaultNoOfInstall(), clientDetail.getMaxLoanAmount().toString(), clientDetail.getMinLoanAmount().toString(), clientDetail.getMaxNoOfInstall(), clientDetail.getMinNoOfInstall(), getIntegerValue(clientDetail.getBusinessActivity()));
createMultipleLoans.add(createLoanRequest);
}
List<String> accountNumbers = this.loanAccountServiceFacade.createMultipleLoans(createMultipleLoans);
request.setAttribute(LoanConstants.ACCOUNTS_LIST, accountNumbers);
return mapping.findForward(ActionForwards.create_success.toString());
}
Aggregations