Search in sources :

Example 1 with BirtAdminDocumentUploadActionForm

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());
}
Also used : BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with BirtAdminDocumentUploadActionForm

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);
}
Also used : AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) ArrayList(java.util.ArrayList) List(java.util.List) AdminDocAccActionMixBO(org.mifos.reports.admindocuments.business.AdminDocAccActionMixBO) AdminDocAccStateMixBO(org.mifos.reports.admindocuments.business.AdminDocAccStateMixBO) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) AccountActionEntity(org.mifos.accounts.business.AccountActionEntity) FormFile(org.apache.struts.upload.FormFile) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with BirtAdminDocumentUploadActionForm

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");
}
Also used : BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 4 with BirtAdminDocumentUploadActionForm

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());
}
Also used : MockFormFile(org.mifos.reports.business.MockFormFile) ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) ReportsJasperMap(org.mifos.reports.business.ReportsJasperMap) Test(org.junit.Test)

Example 5 with BirtAdminDocumentUploadActionForm

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());
}
Also used : BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) ProductTypeEntity(org.mifos.accounts.productdefinition.business.ProductTypeEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

BirtAdminDocumentUploadActionForm (org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm)8 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)7 AdminDocumentBO (org.mifos.reports.admindocuments.business.AdminDocumentBO)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)3 AdminDocAccActionMixBO (org.mifos.reports.admindocuments.business.AdminDocAccActionMixBO)3 AdminDocAccStateMixBO (org.mifos.reports.admindocuments.business.AdminDocAccStateMixBO)3 FormFile (org.apache.struts.upload.FormFile)2 AccountActionEntity (org.mifos.accounts.business.AccountActionEntity)2 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)2 Test (org.junit.Test)1 ProductTypeEntity (org.mifos.accounts.productdefinition.business.ProductTypeEntity)1 MockFormFile (org.mifos.reports.business.MockFormFile)1 ReportsJasperMap (org.mifos.reports.business.ReportsJasperMap)1 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)1