Search in sources :

Example 1 with MaxMinInterestRate

use of org.mifos.accounts.loan.business.MaxMinInterestRate in project head by mifos.

the class LoanAccountAction method manage.

@TransactionDemarcate(joinToken = true)
public ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
    LoanAccountActionForm loanActionForm = (LoanAccountActionForm) form;
    String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
    CustomerBO customer = getCustomerFromRequest(request);
    if (isGlimEnabled() || isNewGlimEnabled()) {
        populateGlimAttributes(request, loanActionForm, globalAccountNum, customer);
    }
    String recurMonth = customer.getCustomerMeeting().getMeeting().getMeetingDetails().getRecurAfter().toString();
    handleRepaymentsIndependentOfMeetingIfConfigured(request, loanActionForm, recurMonth);
    LoanBO loanBO = new LoanDaoHibernate(new GenericDaoHibernate()).findByGlobalAccountNum(globalAccountNum);
    UserContext userContext = getUserContext(request);
    loanBO.setUserContext(userContext);
    SessionUtils.setAttribute(PROPOSED_DISBURSAL_DATE, loanBO.getDisbursementDate(), request);
    SessionUtils.removeAttribute(LOANOFFERING, request);
    LoanOfferingBO loanOffering = getLoanOffering(loanBO.getLoanOffering().getPrdOfferingId(), userContext.getLocaleId());
    loanActionForm.setInstallmentRange(loanBO.getMaxMinNoOfInstall());
    loanActionForm.setLoanAmountRange(loanBO.getMaxMinLoanAmount());
    MaxMinInterestRate interestRateRange = loanBO.getMaxMinInterestRate();
    loanActionForm.setMaxInterestRate(interestRateRange.getMaxLoanAmount());
    loanActionForm.setMinInterestRate(interestRateRange.getMinLoanAmount());
    loanActionForm.setExternalId(loanBO.getExternalId());
    if (null != loanBO.getFund()) {
        loanActionForm.setLoanOfferingFund(loanBO.getFund().getFundId().toString());
    }
    if (configService.isRepaymentIndepOfMeetingEnabled()) {
        MeetingDetailsEntity meetingDetail = loanBO.getLoanMeeting().getMeetingDetails();
        loanActionForm.setMonthDay("");
        loanActionForm.setMonthWeek("0");
        loanActionForm.setMonthRank("0");
        if (meetingDetail.getRecurrenceTypeEnum() == RecurrenceType.MONTHLY) {
            setMonthlySchedule(loanActionForm, meetingDetail);
        } else {
            setWeeklySchedule(loanActionForm, meetingDetail);
        }
    }
    setSessionAtributeForGLIM(request, loanBO);
    SessionUtils.setAttribute(LOANOFFERING, loanOffering, request);
    // Retrieve and set into the session all collateral types from the
    // lookup_value_locale table associated with the current user context
    // locale
    SessionUtils.setCollectionAttribute(MasterConstants.COLLATERAL_TYPES, legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES).getCustomValueListElements(), request);
    SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES), request);
    SessionUtils.setCollectionAttribute(CUSTOM_FIELDS, new ArrayList<CustomFieldDefinitionEntity>(), request);
    SessionUtils.setAttribute(RECURRENCEID, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceTypeEnum().getValue(), request);
    SessionUtils.setAttribute(RECURRENCENAME, loanBO.getLoanMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceName(), request);
    SessionUtils.setCollectionAttribute(LOANFUNDS, getFunds(loanOffering), request);
    setRequestAttributesForEditPage(request, loanBO);
    InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
    SessionUtils.setCollectionAttribute("detailsInformationOrder", informationOrderServiceFacade.getInformationOrder("CreateLoan"), request);
    setFormAttributes(loanBO, form, request);
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : GenericDaoHibernate(org.mifos.accounts.savings.persistence.GenericDaoHibernate) UserContext(org.mifos.security.util.UserContext) LoanBO(org.mifos.accounts.loan.business.LoanBO) MaxMinInterestRate(org.mifos.accounts.loan.business.MaxMinInterestRate) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) LoanAccountActionForm(org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm) InformationOrderServiceFacade(org.mifos.platform.questionnaire.service.InformationOrderServiceFacade) LoanDaoHibernate(org.mifos.accounts.loan.persistance.LoanDaoHibernate) MeetingDetailsEntity(org.mifos.application.meeting.business.MeetingDetailsEntity) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) CustomerBO(org.mifos.customers.business.CustomerBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

LoanBO (org.mifos.accounts.loan.business.LoanBO)1 MaxMinInterestRate (org.mifos.accounts.loan.business.MaxMinInterestRate)1 LoanDaoHibernate (org.mifos.accounts.loan.persistance.LoanDaoHibernate)1 LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)1 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)1 GenericDaoHibernate (org.mifos.accounts.savings.persistence.GenericDaoHibernate)1 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)1 MeetingDetailsEntity (org.mifos.application.meeting.business.MeetingDetailsEntity)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 InformationOrderServiceFacade (org.mifos.platform.questionnaire.service.InformationOrderServiceFacade)1 UserContext (org.mifos.security.util.UserContext)1