use of org.mifos.reports.struts.actionforms.ReportsCategoryActionForm in project head by mifos.
the class ReportsCategoryAction method editPreview.
public ActionForward editPreview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsCategoryAction:editPreview Method: ");
ReportsCategoryActionForm defineCategoryForm = (ReportsCategoryActionForm) form;
String inputCategoryName = defineCategoryForm.getCategoryName();
short reportCategoryId = defineCategoryForm.getCategoryId();
ReportsCategoryBO reportCategory = new ReportsPersistence().getReportCategoryByCategoryId(reportCategoryId);
if (isReportCategoryNameNotEdit(request, inputCategoryName, reportCategory)) {
return mapping.findForward(ActionForwards.editPreview_failure.toString());
} else if (isReportCategoryNameAlreadyExist(request, inputCategoryName)) {
return mapping.findForward(ActionForwards.editPreview_failure.toString());
}
return mapping.findForward(ActionForwards.editpreview_success.toString());
}
use of org.mifos.reports.struts.actionforms.ReportsCategoryActionForm in project head by mifos.
the class ReportsCategoryAction method deleteReportsCategory.
public ActionForward deleteReportsCategory(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsCategoryAction:deleteReportsCategory Method: ");
ReportsCategoryActionForm reportsCategoryActionForm = (ReportsCategoryActionForm) form;
ReportsCategoryBO reportsCategoryBO = new ReportsPersistence().getReportCategoryByCategoryId(Short.valueOf(reportsCategoryActionForm.getCategoryId()));
if (!isValidToDelete(request, reportsCategoryBO)) {
return mapping.findForward(ActionForwards.confirm_delete.toString());
}
new ReportsPersistence().delete(reportsCategoryBO);
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTCATEGORIES, new ReportsPersistence().getAllReportCategories());
return mapping.findForward(ActionForwards.delete_success.toString());
}
use of org.mifos.reports.struts.actionforms.ReportsCategoryActionForm in project head by mifos.
the class ReportsCategoryActionStrutsTest method testCategoryNameShouldBeNullBeforeDefineNewCategory.
@Test
public void testCategoryNameShouldBeNullBeforeDefineNewCategory() throws Exception {
setRequestPathInfo("/reportsCategoryAction.do");
ReportsCategoryActionForm form = new ReportsCategoryActionForm();
String categoryName = "Not Null";
form.setCategoryName(categoryName);
setActionForm(form);
addRequestParameter("method", "loadDefineNewCategoryPage");
actionPerform();
Assert.assertNull(((ReportsCategoryActionForm) getActionForm()).getCategoryName());
}
use of org.mifos.reports.struts.actionforms.ReportsCategoryActionForm in project head by mifos.
the class ReportsCategoryActionStrutsTest method testShouldSubmitSuccessAfterEdit.
@Test
public void testShouldSubmitSuccessAfterEdit() throws Exception {
setRequestPathInfo("/reportsCategoryAction.do");
addRequestParameter("method", "editThenSubmit");
ReportsCategoryActionForm form = new ReportsCategoryActionForm();
String categoryName = "neverExist";
form.setCategoryName(categoryName);
form.setCategoryId((short) 1);
setActionForm(form);
actionPerform();
verifyForward("create_success");
verifyForwardPath("/reportsCategoryAction.do?method=viewReportsCategory");
verifyNoActionErrors();
}
use of org.mifos.reports.struts.actionforms.ReportsCategoryActionForm in project head by mifos.
the class ReportsCategoryActionStrutsTest method testShouldPreviewSuccessAfterEdit.
@Test
public void testShouldPreviewSuccessAfterEdit() throws Exception {
setRequestPathInfo("/reportsCategoryAction.do");
ReportsCategoryActionForm form = new ReportsCategoryActionForm();
String categoryName = "Not Null";
form.setCategoryName(categoryName);
form.setCategoryId((short) 1);
setActionForm(form);
addRequestParameter("method", "editPreview");
actionPerform();
verifyForwardPath("/pages/application/reports/jsp/edit_preview_reports_category.jsp");
verifyNoActionErrors();
}
Aggregations