use of org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm in project head by mifos.
the class BirtAdminDocumentUploadAction method preview.
@TransactionDemarcate(joinToken = true)
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
if (uploadForm.getAccountTypeId().equals(ProductType.LOAN.getValue().toString())) {
uploadForm.setAccountTypeName("LOAN");
} else if (uploadForm.getAccountTypeId().equals(ProductType.SAVINGS.getValue().toString())) {
uploadForm.setAccountTypeName("SAVINGS");
} else {
uploadForm.setAccountTypeName("TRANSACTIONS PAYMENTS");
}
updateSelectedStatus(request, uploadForm);
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm in project head by mifos.
the class BirtAdminDocumentUploadAction method upload.
@SuppressWarnings("unchecked")
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward upload(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
FormFile formFile = uploadForm.getFile();
uploadFile(formFile);
AdminDocumentBO admindocBO = createOrUpdateAdminDocument(uploadForm.getAdminiDocumentTitle(), Short.valueOf("1"), formFile.getFileName());
AdminDocAccStateMixBO admindocaccstatemixBO = new AdminDocAccStateMixBO();
if (Short.valueOf(uploadForm.getAccountTypeId()).shortValue() <= 2) {
List<AccountStateEntity> masterList = (List<AccountStateEntity>) SessionUtils.getAttribute("SelectedStatus", request);
for (AccountStateEntity acc : masterList) {
admindocaccstatemixBO = new AdminDocAccStateMixBO();
admindocaccstatemixBO.setAccountStateID(acc);
admindocaccstatemixBO.setAdminDocumentID(admindocBO);
legacyAdminDocAccStateMixDao.createOrUpdate(admindocaccstatemixBO);
}
} else {
List<AccountActionEntity> masterList = (List<AccountActionEntity>) SessionUtils.getAttribute("SelectedStatus", request);
for (AccountActionEntity accountActionEntity : masterList) {
AdminDocAccActionMixBO adminDocAccActionMixBO = new AdminDocAccActionMixBO();
adminDocAccActionMixBO.setAccountAction(accountActionEntity);
adminDocAccActionMixBO.setAdminDocument(admindocBO);
legacyAdminDocumentDao.createOrUpdate(adminDocAccActionMixBO);
}
}
request.setAttribute("report", admindocBO);
return getViewBirtAdminDocumentPage(mapping, form, request, response);
}
use of org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm in project head by mifos.
the class BirtAdminDocumentUploadAction method editpreview.
@TransactionDemarcate(joinToken = true)
public ActionForward editpreview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
if (uploadForm.getAccountTypeId().equals(ProductType.LOAN.getValue().toString())) {
uploadForm.setAccountTypeName("LOAN");
} else if (uploadForm.getAccountTypeId().equals(ProductType.SAVINGS.getValue().toString())) {
uploadForm.setAccountTypeName("SAVINGS");
} else {
uploadForm.setAccountTypeName("TRANSACTIONS PAYMENTS");
}
updateSelectedStatus(request, uploadForm);
return mapping.findForward("edit_preview_success");
}
use of org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm in project head by mifos.
the class BirtAdminDocumentUploadActionStrutsTest method testShouldSubmitSucessWhenUploadNewAdminDocument.
@Test
public void testShouldSubmitSucessWhenUploadNewAdminDocument() throws Exception {
setRequestPathInfo("/birtAdminDocumentUploadAction.do");
BirtAdminDocumentUploadActionForm form = new BirtAdminDocumentUploadActionForm();
form.setAdminiDocumentTitle("testShouldSubmitSucessWhenUploadNewAdminDocumentWithAVeryLongNameThatExceedsOneHundredCharactersInLength");
form.setIsActive("1");
form.setFile(new MockFormFile("testFileName1.rptdesign"));
setActionForm(form);
addRequestParameter("method", "upload");
actionPerform();
AdminDocumentBO adminDocument = (AdminDocumentBO) request.getAttribute(Constants.BUSINESS_KEY);
Assert.assertNotNull(adminDocument);
ReportsPersistence rp = new ReportsPersistence();
ReportsJasperMap jasper = rp.getPersistentObject(ReportsJasperMap.class, adminDocument.getAdmindocId());
Assert.assertNotNull(jasper);
verifyNoActionErrors();
verifyForward("create_success");
removeReport(adminDocument.getAdmindocId());
}
use of org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm in project head by mifos.
the class BirtAdminDocumentUploadAction method getBirtAdminDocumentUploadPage.
@TransactionDemarcate(saveToken = true)
public ActionForward getBirtAdminDocumentUploadPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtAdminDocumentUploadActionForm uploadForm = (BirtAdminDocumentUploadActionForm) form;
uploadForm.clear();
List<ProductTypeEntity> productTypes = getProductTypes();
SessionUtils.setCollectionAttribute(ProductDefinitionConstants.PRODUCTTYPELIST, productTypes, request);
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations