use of org.mifos.application.meeting.util.helpers.WeekDay in project head by mifos.
the class MeetingFactory method create.
public MeetingBO create(MeetingDto meetingDto) {
try {
MeetingDetailsDto meetingDetailsDto = meetingDto.getMeetingDetailsDto();
MeetingBO meeting = new MeetingBO(RecurrenceType.fromInt(meetingDetailsDto.getRecurrenceTypeId().shortValue()), meetingDetailsDto.getEvery().shortValue(), meetingDto.getMeetingStartDate().toDateMidnight().toDate(), MeetingType.CUSTOMER_MEETING);
RankOfDay rank = null;
Integer weekOfMonth = meetingDetailsDto.getRecurrenceDetails().getWeekOfMonth();
if (weekOfMonth != null && weekOfMonth > 0) {
rank = RankOfDay.getRankOfDay(meetingDetailsDto.getRecurrenceDetails().getWeekOfMonth());
}
WeekDay weekDay = null;
Integer weekDayNum = meetingDetailsDto.getRecurrenceDetails().getDayOfWeek();
if (weekDayNum != null && weekDayNum > 0) {
weekDay = WeekDay.getWeekDay(meetingDetailsDto.getRecurrenceDetails().getDayOfWeek());
}
if (meetingDetailsDto.getRecurrenceDetails().getDayNumber() > 0) {
meeting.update(meetingDetailsDto.getRecurrenceDetails().getDayNumber().shortValue(), meetingDto.getMeetingPlace());
}
if (rank != null && weekDay != null) {
meeting = new MeetingBO(weekDay, rank, meetingDetailsDto.getEvery().shortValue(), meetingDto.getMeetingStartDate().toDateMidnight().toDate(), MeetingType.CUSTOMER_MEETING, meetingDto.getMeetingPlace());
} else if (weekDay != null) {
meeting = new MeetingBO(weekDay, meetingDetailsDto.getEvery().shortValue(), meetingDto.getMeetingStartDate().toDateMidnight().toDate(), MeetingType.CUSTOMER_MEETING, meetingDto.getMeetingPlace());
}
if (meetingDetailsDto.getRecurrenceTypeId().equals(new Integer(RecurrenceType.DAILY.getValue().shortValue()))) {
meeting = new MeetingBO(meetingDetailsDto.getEvery().shortValue(), meetingDto.getMeetingStartDate().toDateTimeAtStartOfDay().toDate(), MeetingType.CUSTOMER_MEETING, meetingDto.getMeetingPlace());
}
return meeting;
} catch (MeetingException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.application.meeting.util.helpers.WeekDay in project head by mifos.
the class GroupLoanAccountServiceFacadeWebTier method createNewMeetingForRepaymentDay.
private MeetingBO createNewMeetingForRepaymentDay(LocalDate disbursementDate, RecurringSchedule recurringSchedule, CustomerBO customer) {
MeetingBO newMeetingForRepaymentDay = null;
final int minDaysInterval = configurationPersistence.getConfigurationValueInteger(MIN_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT_DAY);
final Date repaymentStartDate = disbursementDate.plusDays(minDaysInterval).toDateMidnight().toDateTime().toDate();
try {
if (recurringSchedule.isWeekly()) {
WeekDay weekDay = WeekDay.getWeekDay(recurringSchedule.getDay().shortValue());
Short recurEvery = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(weekDay, recurEvery, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
} else if (recurringSchedule.isMonthly()) {
if (recurringSchedule.isMonthlyOnDayOfMonth()) {
Short dayOfMonth = recurringSchedule.getDay().shortValue();
Short dayRecurMonth = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(dayOfMonth, dayRecurMonth, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
} else {
Short weekOfMonth = recurringSchedule.getDay().shortValue();
Short monthRank = recurringSchedule.getWeek().shortValue();
Short everyMonth = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(weekOfMonth, everyMonth, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace(), monthRank);
}
} else {
Short recurEvery = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(recurEvery, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
}
return newMeetingForRepaymentDay;
} catch (NumberFormatException nfe) {
throw new MifosRuntimeException(nfe);
} catch (MeetingException me) {
throw new BusinessRuleException(me.getKey(), me);
}
}
use of org.mifos.application.meeting.util.helpers.WeekDay in project head by mifos.
the class LoanAccountServiceFacadeWebTier method createNewMeetingForRepaymentDay.
private MeetingBO createNewMeetingForRepaymentDay(LocalDate disbursementDate, RecurringSchedule recurringSchedule, CustomerBO customer) {
MeetingBO newMeetingForRepaymentDay = null;
final int minDaysInterval = configurationPersistence.getConfigurationValueInteger(MIN_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT_DAY);
final Date repaymentStartDate = disbursementDate.plusDays(minDaysInterval).toDateMidnight().toDateTime().toDate();
try {
if (recurringSchedule.isWeekly()) {
WeekDay weekDay = WeekDay.getWeekDay(recurringSchedule.getDay().shortValue());
Short recurEvery = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(weekDay, recurEvery, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
} else if (recurringSchedule.isMonthly()) {
if (recurringSchedule.isMonthlyOnDayOfMonth()) {
Short dayOfMonth = recurringSchedule.getDay().shortValue();
Short dayRecurMonth = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(dayOfMonth, dayRecurMonth, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
} else {
Short weekOfMonth = recurringSchedule.getDay().shortValue();
Short monthRank = recurringSchedule.getWeek().shortValue();
Short everyMonth = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(weekOfMonth, everyMonth, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace(), monthRank);
}
} else {
Short recurEvery = recurringSchedule.getEvery().shortValue();
newMeetingForRepaymentDay = new MeetingBO(recurEvery, repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace());
}
return newMeetingForRepaymentDay;
} catch (NumberFormatException nfe) {
throw new MifosRuntimeException(nfe);
} catch (MeetingException me) {
throw new BusinessRuleException(me.getKey(), me);
}
}
use of org.mifos.application.meeting.util.helpers.WeekDay in project head by mifos.
the class MeetingAction method getLocalizedWorkingDays.
private List<WeekDay> getLocalizedWorkingDays() {
List<WeekDay> workingDays = new FiscalCalendarRules().getWorkingDays();
for (WeekDay workDay : workingDays) {
String weekdayName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(workDay.getPropertiesKey());
workDay.setWeekdayName(weekdayName);
}
return workingDays;
}
use of org.mifos.application.meeting.util.helpers.WeekDay in project head by mifos.
the class MeetingAction method edit.
@TransactionDemarcate(conditionToken = true)
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MeetingActionForm actionForm = (MeetingActionForm) form;
clearActionForm(actionForm);
CustomerBO customerInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerBO customer = this.customerDao.findCustomerById(customerInSession.getCustomerId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customer, request);
List<WeekDay> workingDays = getLocalizedWorkingDays();
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKDAYSLIST, workingDays, request);
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKRANKLIST, RankOfDay.getRankOfDayList(), request);
ActionForward forward = null;
if (customer.getCustomerMeeting() != null) {
MeetingBO meeting = customer.getCustomerMeeting().getMeeting();
setValuesInActionForm(actionForm, meeting);
forward = mapping.findForward(ActionForwards.edit_success.toString());
actionForm.setInput(MeetingConstants.INPUT_EDIT);
} else {
actionForm.setInput(MeetingConstants.INPUT_CREATE);
forward = mapping.findForward(ActionForwards.createMeeting_success.toString());
}
return forward;
}
Aggregations