Search in sources :

Example 6 with CheckListBO

use of org.mifos.customers.checklist.business.CheckListBO in project head by mifos.

the class ChkListAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ChkListActionForm chkListActionForm = (ChkListActionForm) form;
    Short localeId = getUserContext(request).getLocaleId();
    Short checklistId = getShortValue(chkListActionForm.getCheckListId());
    CheckListBO checkList = new CheckListPersistence().getCheckList(checklistId);
    if (checkList.getCheckListType().equals(CheckListType.CUSTOMER_CHECKLIST)) {
        CustomerCheckListBO customerCheckList = (CustomerCheckListBO) checkList;
        SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerCheckList, request);
        SessionUtils.setAttribute(CheckListConstants.TYPE, CheckListType.CUSTOMER_CHECKLIST.getValue(), request);
    } else {
        AccountCheckListBO accountCheckList = (AccountCheckListBO) checkList;
        SessionUtils.setAttribute(Constants.BUSINESS_KEY, accountCheckList, request);
        SessionUtils.setAttribute(CheckListConstants.TYPE, CheckListType.ACCOUNT_CHECKLIST.getValue(), request);
    }
    SessionUtils.setAttribute(CheckListConstants.CREATED_BY_NAME, new PersonnelBusinessService().getPersonnel(checkList.getCreatedBy()).getDisplayName(), request);
    return mapping.findForward(ActionForwards.get_success.toString());
}
Also used : CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) ChkListActionForm(org.mifos.customers.checklist.struts.actionforms.ChkListActionForm) CheckListPersistence(org.mifos.customers.checklist.persistence.CheckListPersistence) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with CheckListBO

use of org.mifos.customers.checklist.business.CheckListBO in project head by mifos.

the class CheckListActionStrutsTest method testGetForAccountChecklist.

@Test
public void testGetForAccountChecklist() throws Exception {
    CheckListBO checkList = TestObjectFactory.createAccountChecklist(ProductType.LOAN.getValue(), AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, (short) 1);
    setRequestPathInfo("/chkListAction");
    addRequestParameter("method", "get");
    addRequestParameter("checkListId", checkList.getChecklistId().toString());
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.get_success.toString());
    Assert.assertNotNull(SessionUtils.getAttribute(Constants.BUSINESS_KEY, request));
    Assert.assertEquals(CheckListType.ACCOUNT_CHECKLIST.getValue(), SessionUtils.getAttribute(CheckListConstants.TYPE, request));
    Assert.assertNotNull(SessionUtils.getAttribute(CheckListConstants.CREATED_BY_NAME, request));
}
Also used : CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) Test(org.junit.Test)

Example 8 with CheckListBO

use of org.mifos.customers.checklist.business.CheckListBO in project head by mifos.

the class CheckListActionStrutsTest method testLoadAllChecklist.

@Test
public void testLoadAllChecklist() throws Exception {
    CheckListBO checkList1 = TestObjectFactory.createAccountChecklist(ProductType.LOAN.getValue(), AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, (short) 1);
    CheckListBO checkList2 = TestObjectFactory.createAccountChecklist(ProductType.SAVINGS.getValue(), AccountState.SAVINGS_ACTIVE, (short) 1);
    CheckListBO checkList3 = TestObjectFactory.createCustomerChecklist(CustomerLevel.CENTER.getValue(), CustomerStatus.CENTER_ACTIVE.getValue(), (short) 1);
    CheckListBO checkList4 = TestObjectFactory.createCustomerChecklist(CustomerLevel.GROUP.getValue(), CustomerStatus.GROUP_ACTIVE.getValue(), (short) 1);
    setRequestPathInfo("/chkListAction");
    addRequestParameter("method", "loadAllChecklist");
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.loadAllChecklist_success.toString());
    Assert.assertEquals(1, ((List) SessionUtils.getAttribute(CheckListConstants.LOAN_CHECKLIST, request)).size());
    Assert.assertEquals(1, ((List) SessionUtils.getAttribute(CheckListConstants.SAVINGS_CHECKLIST, request)).size());
    Assert.assertEquals(1, ((List) SessionUtils.getAttribute(CheckListConstants.CENTER_CHECKLIST, request)).size());
    Assert.assertEquals(1, ((List) SessionUtils.getAttribute(CheckListConstants.GROUP_CHECKLIST, request)).size());
    Assert.assertEquals(0, ((List) SessionUtils.getAttribute(CheckListConstants.CLIENT_CHECKLIST, request)).size());
}
Also used : CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) Test(org.junit.Test)

Example 9 with CheckListBO

use of org.mifos.customers.checklist.business.CheckListBO in project head by mifos.

the class CheckListActionStrutsTest method testManage_customerClient.

@Test
public void testManage_customerClient() throws Exception {
    CheckListBO checkList = TestObjectFactory.createCustomerChecklist(CustomerLevel.CLIENT.getValue(), CustomerStatus.CLIENT_ACTIVE.getValue(), (short) 1);
    StaticHibernateUtil.flushSession();
    setRequestPathInfo("/chkListAction");
    addRequestParameter("method", "manage");
    addRequestParameter("checkListId", checkList.getChecklistId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    StaticHibernateUtil.flushAndClearSession();
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.manage_success.toString());
    Assert.assertNotNull(request.getAttribute(Constants.CURRENTFLOWKEY));
    StaticHibernateUtil.flushSession();
    checkList = (CheckListBO) TestObjectFactory.getObject(CustomerCheckListBO.class, checkList.getChecklistId());
    checkList = null;
}
Also used : CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) Test(org.junit.Test)

Example 10 with CheckListBO

use of org.mifos.customers.checklist.business.CheckListBO in project head by mifos.

the class CheckListActionStrutsTest method testManage_accountSaving.

@Test
public void testManage_accountSaving() throws Exception {
    CheckListBO checkList = TestObjectFactory.createAccountChecklist(ProductType.SAVINGS.getValue(), AccountState.SAVINGS_ACTIVE, (short) 1);
    StaticHibernateUtil.flushSession();
    setRequestPathInfo("/chkListAction");
    addRequestParameter("method", "manage");
    addRequestParameter("checkListId", checkList.getChecklistId().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    StaticHibernateUtil.flushAndClearSession();
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.manage_success.toString());
    Assert.assertNotNull(request.getAttribute(Constants.CURRENTFLOWKEY));
    StaticHibernateUtil.flushSession();
    checkList = (CheckListBO) TestObjectFactory.getObject(AccountCheckListBO.class, checkList.getChecklistId());
    checkList = null;
}
Also used : CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) Test(org.junit.Test)

Aggregations

AccountCheckListBO (org.mifos.customers.checklist.business.AccountCheckListBO)12 CheckListBO (org.mifos.customers.checklist.business.CheckListBO)12 CustomerCheckListBO (org.mifos.customers.checklist.business.CustomerCheckListBO)12 Test (org.junit.Test)10 CheckListPersistence (org.mifos.customers.checklist.persistence.CheckListPersistence)2 ChkListActionForm (org.mifos.customers.checklist.struts.actionforms.ChkListActionForm)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 ArrayList (java.util.ArrayList)1 CheckListDetailEntity (org.mifos.customers.checklist.business.CheckListDetailEntity)1 PersonnelBusinessService (org.mifos.customers.personnel.business.service.PersonnelBusinessService)1 CheckListMasterDto (org.mifos.dto.domain.CheckListMasterDto)1 CheckListStatesView (org.mifos.dto.screen.CheckListStatesView)1