Search in sources :

Example 1 with MeetingType

use of org.mifos.application.meeting.util.helpers.MeetingType in project head by mifos.

the class TestObjectFactory method createLoanMeeting.

public static MeetingBO createLoanMeeting(final MeetingBO customerMeeting) {
    MeetingBO meetingToReturn = null;
    try {
        RecurrenceType recurrenceType = RecurrenceType.fromInt(customerMeeting.getMeetingDetails().getRecurrenceType().getRecurrenceId());
        MeetingType meetingType = MeetingType.fromInt(customerMeeting.getMeetingType().getMeetingTypeId());
        Short recurAfter = customerMeeting.getMeetingDetails().getRecurAfter();
        if (recurrenceType.equals(RecurrenceType.MONTHLY)) {
            if (customerMeeting.isMonthlyOnDate()) {
                meetingToReturn = new MeetingBO(customerMeeting.getMeetingDetails().getMeetingRecurrence().getDayNumber(), recurAfter, customerMeeting.getMeetingStartDate(), meetingType, "meetingPlace");
            } else {
                meetingToReturn = new MeetingBO(customerMeeting.getMeetingDetails().getWeekDay(), customerMeeting.getMeetingDetails().getWeekRank(), recurAfter, customerMeeting.getMeetingStartDate(), meetingType, "meetingPlace");
            }
        } else if (recurrenceType.equals(RecurrenceType.WEEKLY)) {
            meetingToReturn = new MeetingBO(WeekDay.getWeekDay(customerMeeting.getMeetingDetails().getMeetingRecurrence().getWeekDayValue().getValue()), recurAfter, customerMeeting.getMeetingStartDate(), meetingType, "meetingPlace");
        } else {
            meetingToReturn = new MeetingBO(recurrenceType, recurAfter, customerMeeting.getMeetingStartDate(), meetingType);
        }
        meetingToReturn.setMeetingPlace(customerMeeting.getMeetingPlace());
    } catch (MeetingException e) {
        throw new RuntimeException(e);
    }
    return meetingToReturn;
}
Also used : MifosRuntimeException(org.mifos.core.MifosRuntimeException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) MeetingBO(org.mifos.application.meeting.business.MeetingBO) RecurrenceType(org.mifos.application.meeting.util.helpers.RecurrenceType) MeetingType(org.mifos.application.meeting.util.helpers.MeetingType)

Example 2 with MeetingType

use of org.mifos.application.meeting.util.helpers.MeetingType 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)

Aggregations

MeetingBO (org.mifos.application.meeting.business.MeetingBO)2 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)2 MeetingType (org.mifos.application.meeting.util.helpers.MeetingType)2 RecurrenceType (org.mifos.application.meeting.util.helpers.RecurrenceType)2 AccountException (org.mifos.accounts.exceptions.AccountException)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1