Search in sources :

Example 1 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingAction method validate.

@TransactionDemarcate(joinToken = true)
public ActionForward validate(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    String method = (String) request.getAttribute("methodCalled");
    MeetingActionForm maf = (MeetingActionForm) form;
    if (maf.getInput() == null || maf.getInput().equals(MeetingConstants.INPUT_EDIT)) {
        return mapping.findForward(method + "_failure");
    }
    return mapping.findForward(ActionForwards.createMeeting_failure.toString());
}
Also used : MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingAction method create.

@TransactionDemarcate(joinToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MeetingActionForm actionForm = (MeetingActionForm) form;
    MeetingBO meeting = createMeeting(actionForm);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, meeting, request);
    return mapping.findForward(forwardForCreate(actionForm.getCustomerLevelValue()).toString());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MeetingActionForm form1 = (MeetingActionForm) form;
    MeetingBO meeting = (MeetingBO) SessionUtils.getAttribute(CustomerConstants.CUSTOMER_MEETING, request);
    clearActionForm(form1);
    if (meeting != null) {
        setValuesInActionForm(form1, meeting);
    }
    List<WeekDay> workingDays = getLocalizedWorkingDays();
    SessionUtils.setCollectionAttribute(MeetingConstants.WEEKDAYSLIST, workingDays, request);
    SessionUtils.setCollectionAttribute(MeetingConstants.WEEKRANKLIST, RankOfDay.getRankOfDayList(), request);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : WeekDay(org.mifos.application.meeting.util.helpers.WeekDay) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingAction method update.

@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MeetingActionForm actionForm = (MeetingActionForm) form;
    MeetingBO meeting = createMeeting(actionForm);
    CustomerBO customerInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    MeetingDto meetingDto = null;
    if (meeting != null) {
        meetingDto = meeting.toDto();
    }
    meetingServiceFacade.updateCustomerMeeting(meetingDto, customerInSession.getCustomerId());
    ActionForwards forward = forwardForUpdate(actionForm.getCustomerLevelValue());
    return mapping.findForward(forward.toString());
}
Also used : ActionForwards(org.mifos.application.util.helpers.ActionForwards) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomerBO(org.mifos.customers.business.CustomerBO) MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) MeetingDto(org.mifos.dto.domain.MeetingDto) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 5 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingActionStrutsTest method testLoadForGroup.

@Test
public void testLoadForGroup() throws Exception {
    setRequestPathInfo("/meetingAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("customerLevel", CustomerLevel.GROUP.getValue().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("input", "create");
    actionPerform();
    verifyForward(ActionForwards.load_success.toString());
    Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKDAYSLIST, request));
    Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKRANKLIST, request));
    verifyNoActionErrors();
    verifyNoActionMessages();
    MeetingActionForm actionForm = (MeetingActionForm) request.getSession().getAttribute("meetingActionForm");
    Assert.assertEquals(CustomerLevel.GROUP, actionForm.getCustomerLevelValue());
}
Also used : MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) Test(org.junit.Test)

Aggregations

MeetingActionForm (org.mifos.application.meeting.struts.actionforms.MeetingActionForm)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)8 Test (org.junit.Test)7 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)5 Date (java.util.Date)4 WeekDay (org.mifos.application.meeting.util.helpers.WeekDay)2 CustomerBO (org.mifos.customers.business.CustomerBO)2 ActionForward (org.apache.struts.action.ActionForward)1 ActionForwards (org.mifos.application.util.helpers.ActionForwards)1 MeetingDto (org.mifos.dto.domain.MeetingDto)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1