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());
}
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));
}
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());
}
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;
}
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;
}
Aggregations