Example usage for com.liferay.portal.kernel.servlet SessionMessages add

List of usage examples for com.liferay.portal.kernel.servlet SessionMessages add

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet SessionMessages add.

Prototype

public static void add(PortletRequest portletRequest, String key) 

Source Link

Usage

From source file:org.oep.cmon.portlet.thamso.action.ThamSoPortlet.java

License:Apache License

/**
* This is fucntion editOrAddThamSoRequest
* Version: 1.0//from  w  ww. j  a  va  2  s .c om
*  
* History: 
*   DATE        AUTHOR      DESCRIPTION 
*  ------------------------------------------------- 
*  3-March-2013  Nam Dinh    Create new
* @param ActionRequest actionRequest, ActionResponse actionResponse
* @return void
*/
public void editOrAddThamSoRequest(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {
    // Get params
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String keyWord = actionRequest.getParameter("searchKeyWord");
    String actionType = ParamUtil.getString(actionRequest, "actionType");
    long thamSoId = ParamUtil.getLong(actionRequest, "thamSoId");
    String tenThamSo = ParamUtil.getString(actionRequest, "tenThamSo", null);
    String giaTri = ParamUtil.getString(actionRequest, "giaTri", null);
    int kieuDuLieu = ParamUtil.getInteger(actionRequest, "kieuDuLieu");
    int trangThai = ParamUtil.getInteger(actionRequest, "trangThaiThamSo");
    Long ungDungId = ParamUtil.getLong(actionRequest, "ungDungId");
    Long heThongId = ParamUtil.getLong(actionRequest, "heThongId");
    String moTa = ParamUtil.getString(actionRequest, "moTaThamSo", null);
    ungDungId = ungDungId == 0L ? null : ungDungId;
    heThongId = heThongId == 0L ? null : heThongId;
    if (validationInput(tenThamSo, thamSoId, actionRequest)) {
        ThamSo thamSo = null;
        if (thamSoId > 0) {
            try {
                thamSo = ThamSoLocalServiceUtil.fetchThamSo(thamSoId);
                thamSo.setTen(tenThamSo);
                thamSo.setGiaTri(giaTri);
                thamSo.setKieuDuLieu(kieuDuLieu);
                thamSo.setNgaySua(new Date());
                thamSo.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                thamSo.setDaXoa(trangThai);
                thamSo.setUngDungId(ungDungId);
                thamSo.setHeThongId(heThongId);
                thamSo.setMota(moTa);
                ThamSo thamso = ThamSoLocalServiceUtil.updateThamSo(thamSo);
                if (thamso == null) {
                    SessionErrors.add(actionRequest, "errorAddThamSo");
                } else {
                    ThamSoUtils.loading();
                    actionResponse.setRenderParameter("CompletedUpdateThamSo", "CompletedUpdateThamSo");
                    actionResponse.setRenderParameter("completed", "completed");
                    SessionMessages.add(actionRequest, "successUpdateThamSo");
                }
            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(thamSo.toString());
                SessionErrors.add(actionRequest, "errorUpdateThamSo");
            }
        } else {
            try {
                thamSo = new ThamSoClp();
                thamSo.setId(CounterLocalServiceUtil.increment(ThamSo.class.getName()));
                thamSo.setTen(tenThamSo);
                thamSo.setGiaTri(giaTri);
                thamSo.setKieuDuLieu(kieuDuLieu);
                thamSo.setNgaySua(new Date());
                thamSo.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                thamSo.setNgayTao(new Date());
                thamSo.setNguoiTao(themeDisplay.getUser().getEmailAddress());
                thamSo.setDaXoa(trangThai);
                thamSo.setUngDungId(ungDungId);
                thamSo.setHeThongId(heThongId);
                thamSo.setMota(moTa);
                ThamSo thamso = ThamSoLocalServiceUtil.addThamSo(thamSo);
                if (thamso == null) {
                    SessionErrors.add(actionRequest, "errorAddThamSo");
                } else {
                    ThamSoUtils.loading();
                    actionResponse.setRenderParameter("CompletedAddThamSo", "CompletedAddThamSo");
                    actionResponse.setRenderParameter("completed", "completed");
                    SessionMessages.add(actionRequest, "successAddThamSo");
                    tenThamSo = "";
                    giaTri = "";
                    kieuDuLieu = 0;
                    trangThai = 0;
                    moTa = "";
                    ungDungId = 0L;
                    heThongId = 0L;
                }
            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(thamSo.toString());
                SessionErrors.add(actionRequest, "errorAddThamSo");
            }
        }
    }

    actionResponse.setRenderParameter("ActionType", actionType);
    actionResponse.setRenderParameter("thamSoId", String.valueOf(thamSoId));
    actionResponse.setRenderParameter("tenThamSo", tenThamSo);
    actionResponse.setRenderParameter("giaTri", giaTri);
    actionResponse.setRenderParameter("kieuDuLieu", String.valueOf(kieuDuLieu));
    actionResponse.setRenderParameter("trangThaiThamSo", String.valueOf(trangThai));
    actionResponse.setRenderParameter("ungDungId", String.valueOf(ungDungId));
    actionResponse.setRenderParameter("heThongId", String.valueOf(heThongId));
    actionResponse.setRenderParameter("moTaThamSo", moTa);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/thamso/tham_so_add.jsp");

    FormatUtil.setParameter(actionRequest, actionResponse, keyWord);
}

From source file:org.oep.cmon.portlet.thamso.action.ThamSoPortlet.java

License:Apache License

/**
* This is fucntion deleteThamSoRequest/* w  ww  . ja  va2 s.c  o  m*/
* Version: 1.0
*  
* History: 
*   DATE        AUTHOR      DESCRIPTION 
*  ------------------------------------------------- 
*  3-March-2013  Nam Dinh    Create new
* @param ActionRequest actionRequest,   ActionResponse actionResponse
* @return void
*/
public void deleteThamSoRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten
    String keyWord = actionRequest.getParameter("searchKeyWord");

    // Get search keyword, the keyword is code
    long thamSoId = ParamUtil.getLong(actionRequest, "thamSoId");
    try {
        ThamSoLocalServiceUtil.deleteThamSo(thamSoId);
        ThamSoUtils.loading();
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteThamSo");

    } catch (Exception es) {

        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteThamSo");
    }
    FormatUtil.setParameter(actionRequest, actionResponse, keyWord);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/thamso/tham_so_view.jsp");

}

From source file:org.oep.cmon.portlet.thamso.util.FormatUtil.java

License:Apache License

/**
  * This is fucntion setParameter//from   w  w  w.ja  v  a 2  s .c  o  m
  * Version: 1.0
  *  
  * History: 
  *   DATE        AUTHOR      DESCRIPTION 
  *  ------------------------------------------------- 
  *  3-March-2013  Nam Dinh    Create new
  * @param ActionRequest actionRequest, ActionResponse actionResponse, String value
  * @return void
  */
public static void setParameter(ActionRequest actionRequest, ActionResponse actionResponse, String value) {
    if (value != null) {
        actionResponse.setRenderParameter("searchKeyWord", value);
    }

    PortletConfig portletConfig = (PortletConfig) actionRequest
            .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
    SessionMessages.add(actionRequest,
            portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
}

From source file:org.oep.cmon.portlet.transaction.action.CustomConfigurationAction.java

License:Apache License

/**
  * This is fucntion processAction/*from  w  w  w.  j a v  a 2  s .  c o m*/
  * Version: 1.0
  *  
  * History: 
  *   DATE        AUTHOR      DESCRIPTION 
  *  ------------------------------------------------- 
  *  3-March-2013  Nam Dinh    Create new
  * @param PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse
  * @return void
  */
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
        ActionResponse actionResponse) throws Exception {
    String cmd = ParamUtil.getString(actionRequest, com.liferay.portal.kernel.util.Constants.CMD);
    if (!cmd.equals(com.liferay.portal.kernel.util.Constants.UPDATE)) {
        return;
    }
    String portletResource = ParamUtil.getString(actionRequest, "portletResource");
    PortletPreferences prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
    List<DanhMucUngDung> ungDungs = DanhMucUngDungLocalServiceUtil.getDSUngDung(Constants.ACTIVATED);
    if (ungDungs != null) {
        for (int i = 0; i < ungDungs.size(); i++) {
            DanhMucUngDung instance = (DanhMucUngDung) ungDungs.get(i);
            String maUngDung = instance.getMa().trim().toLowerCase();
            String paramName = maUngDung + "Name";
            String paramId = maUngDung + "Id";
            String portletId = ParamUtil.getString(actionRequest, paramId);
            String portletName = ParamUtil.getString(actionRequest, paramName);

            prefs.setValue(paramId, portletId);
            prefs.setValue(paramName, portletName);
        }
    }

    // added by phucnv 2014/03/19
    String processingProfilePrefParamName = org.oep.cmon.Constants.XuLyHoSo.PROCESSING_PROFILE_PREF_PARAM;
    String processingProfilePrefParamValue = ParamUtil.getString(actionRequest, processingProfilePrefParamName);
    prefs.setValue(processingProfilePrefParamName, processingProfilePrefParamValue);
    // end adding by phucnv 2014/03/19

    prefs.store();
    // PortletSession portletSession = actionRequest.getPortletSession();
    SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure");
}

From source file:org.oep.cmon.portlet.transaction.action.TransactionPortlet.java

License:Apache License

/**
  * This is fucntion uploadPhieu//from   www.jav a2s .c om
  * Version: 1.0
  *  
  * History: 
  *   DATE        AUTHOR      DESCRIPTION 
  *  ------------------------------------------------- 
  *  3-March-2013  Nam Dinh    Create new
  * @param ActionRequest actionRequest, ActionResponse actionResponse
  * @return void
  */
public void uploadPhieu(ActionRequest actionRequest, ActionResponse actionResponse) {
    try {
        Long hoSoId = ParamUtil.getLong(actionRequest, "hoSoId");
        Long thongTinThanhToanId = ParamUtil.getLong(actionRequest, "thongtinthanhtoanid");
        String name = ParamUtil.getString(actionRequest, "title");
        Long typePhi = ParamUtil.getLong(actionRequest, "typePhi");
        HoSoTTHCCong hoSoTTHCC = HoSoTTHCCongLocalServiceUtil.getHoSoTTHCCong(hoSoId);

        // get binary data
        String contentType = actionRequest.getContentType();
        if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
            byte dataBytes[] = FileUtil
                    .getBytes(PortalUtil.getUploadPortletRequest(actionRequest).getFileAsStream("uploadphieu"));

            GiayToDinhKem resulUpload = WebserviceFactory.getOfficerService().upload(
                    getMaUngDung(hoSoTTHCC.getThuTucHanhChinhId()), 1, null,
                    PortalUtil.getUserId(actionRequest), name, "upload phieu thu phi, le phi", dataBytes,
                    "png");

            if (thongTinThanhToanId > 0) {
                ThongTinThanhToan thongTinThanhToan = ThongTinThanhToanLocalServiceUtil
                        .getThongTinThanhToan(thongTinThanhToanId);
                thongTinThanhToan.setNgaySua(new Date());
                thongTinThanhToan.setNoiLuuTruId(resulUpload.getNoiLuuTruId());

                ThongTinThanhToanLocalServiceUtil.updateThongTinThanhToan(thongTinThanhToan, true);

            } else {
                ThongTinThanhToan thongTinThanhToan = new ThongTinThanhToanClp();
                long ttttId = CounterLocalServiceUtil.increment(ThongTinThanhToan.class.getName());
                thongTinThanhToan.setId(ttttId);
                thongTinThanhToan.setHoSoTTHCCongId(hoSoId);
                thongTinThanhToan.setNgayTao(new Date());
                thongTinThanhToan.setTenNguoiNopTien(hoSoTTHCC.getHoTenNguoiNopHoSo());
                thongTinThanhToan.setNoiLuuTruId(resulUpload.getNoiLuuTruId());
                thongTinThanhToan.setNguoiTao(PortalUtil.getUser(actionRequest).getFullName());
                thongTinThanhToan.setLoaiPhi(typePhi);
                thongTinThanhToan.setLoaiThanhToan(2);

                ThongTinThanhToanLocalServiceUtil.addThongTinThanhToan(thongTinThanhToan);
            }

            SessionMessages.add(actionRequest, "successUpdateTTTK");
            actionResponse.setRenderParameter("hoSoId", hoSoId.toString());
            actionResponse.setRenderParameter("title", name);
            actionResponse.setRenderParameter("typephi", typePhi.toString());
            actionResponse.setRenderParameter("parentUrl", ParamUtil.getString(actionRequest, "parentUrl"));
            actionResponse.setRenderParameter("jspPage", "/html/portlet/transaction/nopphi.jsp");
        } else {
            SessionErrors.add(actionRequest, "errorUpdateTTTK");
        }
    } catch (Exception e) {
        e.printStackTrace();
        SessionErrors.add(actionRequest, "errorUpdateTTTK");
    }
}

From source file:org.oep.cmon.report.portlet.action.ReportAction.java

License:Apache License

/**
 * This is function baoCaoThongKe/*from  w  w  w .  jav a  2s  .  c  o  m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param request
 * @param response
 * @throws Exception
 */
public void baoCaoThongKe(ActionRequest request, ActionResponse response) throws Exception {
    String idBaoCao = ParamUtil.getString(request, "idBaoCao");
    String viewPage = ParamUtil.getString(request, "viewPage");
    String id_coquanquanly = ParamUtil.getString(request, "id_coquanquanly");
    String report_tieuchi = ParamUtil.getString(request, "report_tieuchi");
    String thang = ParamUtil.getString(request, "thang");
    String nam = ParamUtil.getString(request, "nam");
    String selectedthang = ParamUtil.getString(request, "selectedthang");
    String selectedquy = ParamUtil.getString(request, "selectedquy");
    List<ReportThongKe> listReportThongKe = ReportThongKeLocalServiceUtil
            .getListReportThongKeGroupByIDCoQuan(id_coquanquanly, thang, nam);
    request.setAttribute("listReportThongKe", listReportThongKe);
    request.setAttribute("id_coquanquanly", id_coquanquanly);
    request.setAttribute("report_tieuchi", report_tieuchi);
    request.setAttribute("selectedthang", selectedthang);
    request.setAttribute("selectedquy", selectedquy);
    request.setAttribute("thang", thang);
    request.setAttribute("nam", nam);
    response.setRenderParameter("viewPage", viewPage);
    response.setRenderParameter("idBaoCao", idBaoCao);
    SessionMessages.add(request, "");
}

From source file:org.oep.cmon.report.portlet.action.ReportAction.java

License:Apache License

/**
 * This is function baoCaoTongHop/*from  w w w  . j  av  a2 s .  co  m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param request
 * @param response
 * @throws Exception
 */
public void baoCaoTongHop(ActionRequest request, ActionResponse response) throws Exception {
    boolean isDisplay = ParamUtil.getBoolean(request, "isDisplay");
    String idBaoCao = ParamUtil.getString(request, "idBaoCao");
    String viewPage = ParamUtil.getString(request, "viewPage");
    String report_type = ParamUtil.getString(request, "report_type");
    int id_donvi = ParamUtil.getInteger(request, "id_donvi");
    String[] id_linhvuc = ParamUtil.getParameterValues(request, "id_linhvuc");
    long[] id_loaihoso = ParamUtil.getLongValues(request, "id_loaihoso");
    String thang = ParamUtil.getString(request, "thang");
    String selectedtime = ParamUtil.getString(request, "selectedtime");
    String nam = ParamUtil.getString(request, "nam");
    String str_loaihoso = "";
    String str_linhvuc = "";
    for (int i = 0; i < id_loaihoso.length; i++) {
        str_loaihoso += id_loaihoso[i];
        if (i < (id_loaihoso.length - 1)) {
            str_loaihoso += ",";
        }
    }
    for (int i = 0; i < id_linhvuc.length; i++) {
        str_linhvuc += id_linhvuc[i];
        if (i < (id_linhvuc.length - 1)) {
            str_linhvuc += ",";
        }
    }
    if (isDisplay) {
        if (report_type.equals("tongquat")) {
            if (!str_linhvuc.equals("")) {
                List<ReportTongHop> listTongHop = new ArrayList<ReportTongHop>();
                listTongHop = ActionUtil.getListReportTongHopGroupByIDNhomThuTuc(String.valueOf(id_donvi),
                        str_linhvuc, thang, nam);
                request.setAttribute("listResult", listTongHop);
            } else {
                request.setAttribute("message",
                        "Vui lng chn nhm th tc hnh chnh");
            }
        }
        if (report_type.equals("nam")) {
            if (!str_linhvuc.equals("")) {
                Set<Long> setIDNhomThuTuc = new HashSet<Long>(0);
                List<ReportTongHop> listTongHop = new ArrayList<ReportTongHop>();
                listTongHop = ActionUtil.getListReportTongHop(String.valueOf(id_donvi), str_linhvuc, nam);
                for (int i = 0; i < listTongHop.size(); i++) {
                    setIDNhomThuTuc.add(listTongHop.get(i).getNHOMTHUTUCHANHCHINHID());
                }
                request.setAttribute("setIDNhomThuTuc", setIDNhomThuTuc);
                request.setAttribute("listResult", listTongHop);
            } else {
                request.setAttribute("message",
                        "Vui lng chn nhm th tc hnh chnh");
            }
        }
        if (report_type.equals("chitiet")) {
            if (!str_loaihoso.equals("")) {
                Set<Long> setIDNhomThuTuc = new HashSet<Long>(0);
                List<ReportTongHopChiTiet> listTongHopChiTiet = new ArrayList<ReportTongHopChiTiet>();
                listTongHopChiTiet = ReportTongHopChiTietLocalServiceUtil
                        .getListReportTongHopChiTietGroupByIDThuTuc(String.valueOf(id_donvi), str_loaihoso,
                                thang, nam);
                for (int i = 0; i < listTongHopChiTiet.size(); i++) {
                    setIDNhomThuTuc.add(listTongHopChiTiet.get(i).getNHOMTHUTUCHANHCHINHID());
                }
                request.setAttribute("setIDNhomThuTuc", setIDNhomThuTuc);
                request.setAttribute("listResult", listTongHopChiTiet);
            } else {
                request.setAttribute("message", "Vui lng chn th tc hnh chnh");
            }
        }
    }
    List<Long> listid_lhs = new ArrayList<Long>();
    List<Long> listid_lv = new ArrayList<Long>();
    for (int i = 0; i < id_linhvuc.length; i++) {
        listid_lv.add(Long.valueOf(id_linhvuc[i]));
    }
    for (int i = 0; i < id_loaihoso.length; i++) {
        listid_lhs.add(id_loaihoso[i]);
    }
    request.setAttribute("report_type", report_type);
    request.setAttribute("id_donvi", id_donvi);
    request.setAttribute("id_loaihoso", listid_lhs);
    request.setAttribute("id_linhvuc", listid_lv);
    request.setAttribute("thang", thang);
    request.setAttribute("selectedtime", selectedtime);
    request.setAttribute("nam", nam);
    request.setAttribute("isDisplay", isDisplay == true ? "1" : "0");
    response.setRenderParameter("viewPage", viewPage);
    response.setRenderParameter("idBaoCao", idBaoCao);
    SessionMessages.add(request, "");
}

From source file:org.oep.cmon.report.portlet.action.ReportAction.java

License:Apache License

/**
 * This is function baocaoLePhi//from  w ww .  j a v a2  s . c o  m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param request
 * @param response
 * @throws Exception
 */
public void baocaoLePhi(ActionRequest request, ActionResponse response) throws Exception {
    String idBaoCao = ParamUtil.getString(request, "idBaoCao");
    String viewPage = ParamUtil.getString(request, "viewPage");
    String report_type = ParamUtil.getString(request, "report_type");
    String id_donvi = ParamUtil.getString(request, "id_donvi");
    String display_result = ParamUtil.getString(request, "display_result");
    long[] id_loaihoso = ParamUtil.getLongValues(request, "id_loaihoso");
    long[] id_linhvuc = ParamUtil.getLongValues(request, "id_linhvuc");
    String str_loaihoso = "";
    String str_linhvuc = "";
    for (int i = 0; i < id_loaihoso.length; i++) {
        str_loaihoso += id_loaihoso[i];
        if (i < (id_loaihoso.length - 1)) {
            str_loaihoso += ",";
        }
    }
    for (int i = 0; i < id_linhvuc.length; i++) {
        str_linhvuc += id_linhvuc[i];
        if (i < (id_linhvuc.length - 1)) {
            str_linhvuc += ",";
        }
    }
    String ngaynhan_tungay = ParamUtil.getString(request, "tungay");
    String ngaynhan_denngay = ParamUtil.getString(request, "denngay");
    String selectedtime = ParamUtil.getString(request, "selectedtime");
    String nam = ParamUtil.getString(request, "nam");
    List<Lephi_chitiet> listlephichitiet = new ArrayList<Lephi_chitiet>();
    List<Lephi_linhvuc> listlephilinhvuc = new ArrayList<Lephi_linhvuc>();
    List<Lephi_tonghop> listlephitonghop = new ArrayList<Lephi_tonghop>();
    if (report_type.equals("lephichitiet") && display_result.equals("1")) {
        if (!str_loaihoso.equals("")) {
            listlephichitiet = Lephi_chitietLocalServiceUtil.lephichitiet(str_loaihoso, ngaynhan_tungay,
                    ngaynhan_denngay);
        }
    } else if (report_type.equals("lephilinhvuc") && display_result.equals("1")) {
        if (!str_linhvuc.equals("")) {
            listlephilinhvuc = Lephi_linhvucLocalServiceUtil.lephilinhvuc(str_linhvuc, ngaynhan_tungay,
                    ngaynhan_denngay);
        }
    } else if (report_type.equals("lephitonghop") && display_result.equals("1")) {
        if (!str_loaihoso.equals("")) {
            listlephitonghop = Lephi_tonghopLocalServiceUtil.lephitonghop(str_loaihoso, ngaynhan_tungay,
                    ngaynhan_denngay);
        }
    }
    request.setAttribute("listlephichitiet", listlephichitiet);
    request.setAttribute("listlephilinhvuc", listlephilinhvuc);
    request.setAttribute("listlephitonghop", listlephitonghop);
    response.setRenderParameter("report_type", report_type);
    response.setRenderParameter("id_loaihoso", str_loaihoso);
    response.setRenderParameter("id_linhvuc", str_linhvuc);
    response.setRenderParameter("id_donvi", id_donvi);
    response.setRenderParameter("ngaynhan_tungay", ngaynhan_tungay);
    response.setRenderParameter("ngaynhan_denngay", ngaynhan_denngay);
    response.setRenderParameter("selectedtime", selectedtime);
    response.setRenderParameter("nam", nam);
    response.setRenderParameter("display_result", display_result);
    response.setRenderParameter("viewPage", viewPage);
    response.setRenderParameter("idBaoCao", idBaoCao);
    SessionMessages.add(request, "");
}

From source file:org.oep.cmon.report.portlet.action.ReportAction.java

License:Apache License

/**
 * This is function baocaoChungThuc/* www.  j  ava 2s.c  o m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param request
 * @param response
 * @throws Exception
 */
public void baocaoChungThuc(ActionRequest request, ActionResponse response) throws Exception {
    String idBaoCao = ParamUtil.getString(request, "idBaoCao");
    String viewPage = ParamUtil.getString(request, "viewPage");
    String id_donvi = ParamUtil.getString(request, "id_donvi");
    String display_result = ParamUtil.getString(request, "display_result");
    long[] id_loaihoso = ParamUtil.getLongValues(request, "id_loaihoso");
    String str_loaihoso = "";
    for (int i = 0; i < id_loaihoso.length; i++) {
        str_loaihoso += id_loaihoso[i];
        if (i < (id_loaihoso.length - 1)) {
            str_loaihoso += ",";
        }
    }
    String tungay = ParamUtil.getString(request, "tungay");
    String denngay = ParamUtil.getString(request, "denngay");
    String selectedtime = ParamUtil.getString(request, "selectedtime");
    String nam = ParamUtil.getString(request, "nam");
    List<HoSoChungThuc> listhosochungthuc = new ArrayList<HoSoChungThuc>();
    if (display_result.equals("1")) {
        listhosochungthuc = ActionUtil.listhsct(str_loaihoso, tungay, denngay);
    }
    request.setAttribute("listhosochungthuc", listhosochungthuc);
    response.setRenderParameter("id_loaihoso", str_loaihoso);
    response.setRenderParameter("id_donvi", id_donvi);
    response.setRenderParameter("ngaynhan_tungay", tungay);
    response.setRenderParameter("ngaynhan_denngay", denngay);
    response.setRenderParameter("selectedtime", selectedtime);
    response.setRenderParameter("nam", nam);
    response.setRenderParameter("display_result", display_result);
    response.setRenderParameter("viewPage", viewPage);
    response.setRenderParameter("idBaoCao", idBaoCao);
    SessionMessages.add(request, "");
}

From source file:org.oep.cmon.report.portlet.action.ReportAction.java

License:Apache License

/**
 * This is function baocaoChiTiet//from w  w w .  j  av  a 2 s  .co m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void baocaoChiTiet(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    // lay du lieu tu form
    String idBaoCao = ParamUtil.getString(actionRequest, "idBaoCao");
    String viewPage = ParamUtil.getString(actionRequest, "viewPage");

    String[] loaihoso = null;
    String ngaynhan_tungay = "";
    String ngaynhan_denngay = "";
    String trangthai = "";
    String time = "";// cac radio button
    String year = "";// select nam
    String CoquanId = "";
    String tinh_trang = "";
    String loaidangky = "";
    String id_donvi = ParamUtil.getString(actionRequest, "chon_donvi");
    String display_result = ParamUtil.getString(actionRequest, "display_result");

    if (Validator.isNotNull(actionRequest.getParameterValues("loai-hoso"))) {
        loaihoso = actionRequest.getParameterValues("loai-hoso");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "ngaynhan_tungay"))) {
        ngaynhan_tungay = ParamUtil.getString(actionRequest, "ngaynhan_tungay");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "ngaynhan_denngay"))) {
        ngaynhan_denngay = ParamUtil.getString(actionRequest, "ngaynhan_denngay");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "trangthai_hoso"))) {
        trangthai = ParamUtil.getString(actionRequest, "trangthai_hoso");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "time"))) {
        time = ParamUtil.getString(actionRequest, "time");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "nam"))) {
        year = ParamUtil.getString(actionRequest, "nam");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "tinhtrang_hoso"))) {
        tinh_trang = ParamUtil.getString(actionRequest, "tinhtrang_hoso");
    }

    if (Validator.isNotNull(ParamUtil.getString(actionRequest, "loaidangky_hoso"))) {
        loaidangky = ParamUtil.getString(actionRequest, "loaidangky_hoso");
    }

    actionRequest.setAttribute("loaihoso", loaihoso);
    actionRequest.setAttribute("ngaynhan_tungay", ngaynhan_tungay);
    actionRequest.setAttribute("ngaynhan_denngay", ngaynhan_denngay);
    actionRequest.setAttribute("trangthai", trangthai);
    actionRequest.setAttribute("time", time);
    actionRequest.setAttribute("year", year);
    actionRequest.setAttribute("id_donvi", id_donvi);
    actionRequest.setAttribute("tinhtrang", tinh_trang);
    actionRequest.setAttribute("loaidangky", loaidangky);
    actionRequest.setAttribute("CoquanId", CoquanId);
    actionResponse.setRenderParameter("viewPage", viewPage);
    actionResponse.setRenderParameter("idBaoCao", idBaoCao);
    List<Baocaochitiet> result = new ArrayList<Baocaochitiet>();
    if (loaihoso != null && display_result.equals("1")) {

        result = BaocaochitietLocalServiceUtil.hienthiDanhsachBaocao(loaihoso, ngaynhan_tungay,
                ngaynhan_denngay, trangthai, tinh_trang, loaidangky, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
        actionResponse.setRenderParameter("viewPage", viewPage);
        actionResponse.setRenderParameter("idBaoCao", idBaoCao);

        actionRequest.setAttribute("listBaocao", result);
        SessionMessages.add(actionRequest, "");
    }

}