Search in sources :

Example 6 with MeetingException

use of org.mifos.application.meeting.exceptions.MeetingException in project head by mifos.

the class CustomerServiceImpl method updateMeeting.

private boolean updateMeeting(final MeetingBO oldMeeting, final MeetingBO updatedDetails) throws CustomerException {
    boolean isRegenerationOfSchedulesRequired = false;
    try {
        if (oldMeeting.isWeekly()) {
            oldMeeting.setMeetingStartDate(updatedDetails.getMeetingStartDate());
            WeekDay dayOfWeek = updatedDetails.getMeetingDetails().getWeekDay();
            isRegenerationOfSchedulesRequired = oldMeeting.isDayOfWeekDifferent(dayOfWeek);
            oldMeeting.update(dayOfWeek.getValue(), updatedDetails.getMeetingPlace());
            oldMeeting.update(dayOfWeek, updatedDetails.getMeetingPlace());
        } else if (oldMeeting.isDaily()) {
            isRegenerationOfSchedulesRequired = false;
            oldMeeting.update(updatedDetails.getMeetingPlace());
        } else if (oldMeeting.isMonthlyOnDate()) {
            isRegenerationOfSchedulesRequired = oldMeeting.isDayOfMonthDifferent(updatedDetails.getMeetingDetails().getDayNumber());
            oldMeeting.update(updatedDetails.getMeetingDetails().getDayNumber(), updatedDetails.getMeetingPlace());
        } else if (oldMeeting.isMonthly()) {
            RankOfDay rankOfday = updatedDetails.getMeetingDetails().getWeekRank();
            //                WeekDay weekOfMonth = WeekDay.getWeekDay(updatedDetails.getMonthWeek());
            WeekDay weekOfMonth = updatedDetails.getMeetingDetails().getWeekDay();
            isRegenerationOfSchedulesRequired = oldMeeting.isWeekOfMonthDifferent(rankOfday, weekOfMonth);
            oldMeeting.update(weekOfMonth, rankOfday, updatedDetails.getMeetingPlace());
        }
    } catch (MeetingException me) {
        throw new CustomerException(me);
    }
    return isRegenerationOfSchedulesRequired;
}
Also used : WeekDay(org.mifos.application.meeting.util.helpers.WeekDay) CustomerException(org.mifos.customers.exceptions.CustomerException) RankOfDay(org.mifos.application.meeting.util.helpers.RankOfDay) MeetingException(org.mifos.application.meeting.exceptions.MeetingException)

Example 7 with MeetingException

use of org.mifos.application.meeting.exceptions.MeetingException in project head by mifos.

the class LoanAccountActionForm method validateRedoLoanPayments.

private void validateRedoLoanPayments(HttpServletRequest request, ActionErrors errors, MifosCurrency currency) {
    Locale locale = getUserContext(request).getPreferredLocale();
    try {
        CustomerBO customer = getCustomer(request);
        List<PaymentDataHtmlBean> validPaymentBeans = getValidatablePaymentBeans();
        for (PaymentDataHtmlBean bean : validPaymentBeans) {
            validatePaymentDataHtmlBean(errors, currency, locale, customer, bean);
        }
        validatePaymentDatesOrdering(validPaymentBeans, errors);
        validateMaxPayableAmount(request, errors);
    } catch (InvalidDateException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (FrameworkRuntimeException invalidDate) {
        errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
    } catch (MeetingException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    } catch (PageExpiredException e) {
        errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
    } catch (PersistenceException e) {
        errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
    }
}
Also used : Locale(java.util.Locale) FrameworkRuntimeException(org.mifos.framework.exceptions.FrameworkRuntimeException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) PaymentDataHtmlBean(org.mifos.accounts.loan.struts.uihelpers.PaymentDataHtmlBean) InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) ActionMessage(org.apache.struts.action.ActionMessage) PageExpiredException(org.mifos.framework.exceptions.PageExpiredException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) CustomerBO(org.mifos.customers.business.CustomerBO)

Example 8 with MeetingException

use of org.mifos.application.meeting.exceptions.MeetingException in project head by mifos.

the class LoanBO method buildLoanMeeting.

private MeetingBO buildLoanMeeting(final MeetingBO customerMeeting, final MeetingBO loanOfferingMeeting, final Date disbursementDate) throws AccountException {
    // this is called from 'proper constructor' only if LSIM is disabled
    if (customerMeeting != null && loanOfferingMeeting != null && customerMeeting.hasSameRecurrenceAs(loanOfferingMeeting) && customerMeeting.recursOnMultipleOf(loanOfferingMeeting)) {
        RecurrenceType meetingFrequency = customerMeeting.getMeetingDetails().getRecurrenceTypeEnum();
        MeetingType meetingType = MeetingType.fromInt(customerMeeting.getMeetingType().getMeetingTypeId());
        Short recurAfter = loanOfferingMeeting.getMeetingDetails().getRecurAfter();
        try {
            MeetingBO meetingToReturn;
            if (meetingFrequency.equals(RecurrenceType.MONTHLY)) {
                if (customerMeeting.isMonthlyOnDate()) {
                    meetingToReturn = new MeetingBO(customerMeeting.getMeetingDetails().getDayNumber(), recurAfter, disbursementDate, meetingType, customerMeeting.getMeetingPlace());
                } else {
                    meetingToReturn = new MeetingBO(customerMeeting.getMeetingDetails().getWeekDay(), customerMeeting.getMeetingDetails().getWeekRank(), recurAfter, disbursementDate, meetingType, customerMeeting.getMeetingPlace());
                }
            } else if (meetingFrequency.equals(RecurrenceType.WEEKLY)) {
                meetingToReturn = new MeetingBO(customerMeeting.getMeetingDetails().getMeetingRecurrence().getWeekDayValue(), recurAfter, disbursementDate, meetingType, customerMeeting.getMeetingPlace());
            } else {
                meetingToReturn = new MeetingBO(meetingFrequency, recurAfter, disbursementDate, meetingType);
            }
            return meetingToReturn;
        } catch (MeetingException me) {
            throw new AccountException(me);
        }
    }
    throw new AccountException(AccountExceptionConstants.CHANGEINLOANMEETING);
}
Also used : MeetingException(org.mifos.application.meeting.exceptions.MeetingException) AccountException(org.mifos.accounts.exceptions.AccountException) MeetingBO(org.mifos.application.meeting.business.MeetingBO) RecurrenceType(org.mifos.application.meeting.util.helpers.RecurrenceType) MeetingType(org.mifos.application.meeting.util.helpers.MeetingType)

Example 9 with MeetingException

use of org.mifos.application.meeting.exceptions.MeetingException in project head by mifos.

the class LoanOfferingBO method createNew.

public static LoanOfferingBO createNew(Integer userId, String globalProductId, String name, String shortName, String description, ProductCategoryBO productCategory, DateTime startDate, DateTime endDate, PrdApplicableMasterEntity applicableToEntity, MifosCurrency currency, InterestTypesEntity interestTypeEntity, Double minRate, Double maxRate, Double defaultRate, RecurrenceType recurrence, Integer recurEvery, GLCodeEntity interestGlCode, GLCodeEntity principalGlCode, PrdStatusEntity activeStatus, PrdStatusEntity inActiveStatus, GracePeriodTypeEntity gracePeriodTypeEntity, Integer gracePeriodDuration, boolean waiverInterest, boolean loanCycleCounter, LoanAmountCalculation loanAmountCalculation, LoanInstallmentCalculation loanInstallmentCalculation, List<FeeBO> applicableFees, List<FundBO> applicableFunds, List<PenaltyBO> applicablePenalties) {
    PrdStatusEntity status = inActiveStatus;
    if (new LocalDate(startDate).isEqual(new LocalDate())) {
        status = activeStatus;
    }
    try {
        MeetingBO meeting = new MeetingBO(recurrence, recurEvery.shortValue(), startDate.toDate(), MeetingType.LOAN_INSTALLMENT);
        PrdOfferingMeetingEntity meetingEntity = new PrdOfferingMeetingEntity(meeting, null, MeetingType.LOAN_INSTALLMENT);
        LoanOfferingBO loanProduct = new LoanOfferingBO(userId, globalProductId, name, shortName, productCategory, status, applicableToEntity, startDate, currency, interestTypeEntity, minRate, maxRate, defaultRate, interestGlCode, principalGlCode, gracePeriodTypeEntity, gracePeriodDuration, loanCycleCounter, meetingEntity, waiverInterest);
        loanProduct.setDescription(description);
        if (endDate != null) {
            loanProduct.setEndDate(endDate.toDate());
        }
        for (FundBO fund : applicableFunds) {
            loanProduct.addLoanOfferingFund(new LoanOfferingFundEntity(fund, loanProduct));
        }
        for (FeeBO fee : applicableFees) {
            loanProduct.addPrdOfferingFee(new LoanOfferingFeesEntity(loanProduct, fee));
        }
        for (PenaltyBO penalty : applicablePenalties) {
            loanProduct.addPrdOfferingPenalty(new PrdOfferingPenaltiesEntity(loanProduct, penalty));
        }
        loanProduct.setLoanAmountSameForAllLoan(loanAmountCalculation.getSameForAll());
        for (LoanAmountFromLastLoanAmountBO loanAmountFromLastLoanAmount : loanAmountCalculation.getFromLastLoan()) {
            loanProduct.addLoanAmountFromLastLoanAmount(loanAmountFromLastLoanAmount);
        }
        for (LoanAmountFromLoanCycleBO loanAmountFromLoanCycle : loanAmountCalculation.getFromLoanCycle()) {
            loanProduct.addLoanAmountFromLoanCycle(loanAmountFromLoanCycle);
        }
        loanProduct.setNoOfInstallSameForAllLoan(loanInstallmentCalculation.getSameForAll());
        for (NoOfInstallFromLastLoanAmountBO noOfInstallFromLastLoanAmount : loanInstallmentCalculation.getFromLastLoan()) {
            loanProduct.addNoOfInstallFromLastLoanAmount(noOfInstallFromLastLoanAmount);
        }
        for (NoOfInstallFromLoanCycleBO noOfInstallFromLoanCycle : loanInstallmentCalculation.getFromLoanCycle()) {
            loanProduct.addNoOfInstallFromLoanCycle(noOfInstallFromLoanCycle);
        }
        return loanProduct;
    } catch (MeetingException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : PenaltyBO(org.mifos.accounts.penalties.business.PenaltyBO) FundBO(org.mifos.accounts.fund.business.FundBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) LocalDate(org.joda.time.LocalDate) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) FeeBO(org.mifos.accounts.fees.business.FeeBO) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

MeetingException (org.mifos.application.meeting.exceptions.MeetingException)9 MeetingBO (org.mifos.application.meeting.business.MeetingBO)6 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 WeekDay (org.mifos.application.meeting.util.helpers.WeekDay)4 Date (java.util.Date)3 LocalDate (org.joda.time.LocalDate)3 RecurrenceType (org.mifos.application.meeting.util.helpers.RecurrenceType)3 BusinessRuleException (org.mifos.service.BusinessRuleException)3 MeetingType (org.mifos.application.meeting.util.helpers.MeetingType)2 RankOfDay (org.mifos.application.meeting.util.helpers.RankOfDay)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 BigDecimal (java.math.BigDecimal)1 Locale (java.util.Locale)1 ActionMessage (org.apache.struts.action.ActionMessage)1 DateTime (org.joda.time.DateTime)1 AccountException (org.mifos.accounts.exceptions.AccountException)1 FeeBO (org.mifos.accounts.fees.business.FeeBO)1 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)1 FundBO (org.mifos.accounts.fund.business.FundBO)1 PaymentDataHtmlBean (org.mifos.accounts.loan.struts.uihelpers.PaymentDataHtmlBean)1