Search in sources :

Example 1 with MultipleLoanAccountsCreationActionForm

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());
}
Also used : CustomerDto(org.mifos.dto.domain.CustomerDto) MultipleLoanAccountsCreationActionForm(org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with MultipleLoanAccountsCreationActionForm

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());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomerLevelEntity(org.mifos.customers.business.CustomerLevelEntity) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) CustomerBO(org.mifos.customers.business.CustomerBO) MultipleLoanAccountsCreationActionForm(org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with MultipleLoanAccountsCreationActionForm

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());
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) MultipleLoanAccountDetailsDto(org.mifos.dto.screen.MultipleLoanAccountDetailsDto) ClientBO(org.mifos.customers.client.business.ClientBO) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) MultipleLoanCreationDto(org.mifos.accounts.loan.util.helpers.MultipleLoanCreationDto) MultipleLoanAccountsCreationActionForm(org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with MultipleLoanAccountsCreationActionForm

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());
}
Also used : ArrayList(java.util.ArrayList) MultipleLoanCreationDto(org.mifos.accounts.loan.util.helpers.MultipleLoanCreationDto) MultipleLoanAccountsCreationActionForm(org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm) CreateLoanRequest(org.mifos.dto.domain.CreateLoanRequest) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

MultipleLoanAccountsCreationActionForm (org.mifos.accounts.loan.struts.actionforms.MultipleLoanAccountsCreationActionForm)4 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)4 MultipleLoanCreationDto (org.mifos.accounts.loan.util.helpers.MultipleLoanCreationDto)2 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)2 ArrayList (java.util.ArrayList)1 MeetingBO (org.mifos.application.meeting.business.MeetingBO)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 CustomerLevelEntity (org.mifos.customers.business.CustomerLevelEntity)1 ClientBO (org.mifos.customers.client.business.ClientBO)1 CreateLoanRequest (org.mifos.dto.domain.CreateLoanRequest)1 CustomerDto (org.mifos.dto.domain.CustomerDto)1 MultipleLoanAccountDetailsDto (org.mifos.dto.screen.MultipleLoanAccountDetailsDto)1 BusinessRuleException (org.mifos.service.BusinessRuleException)1