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.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function deleteUngDungRequest
 * Version: 1.0// www .  j a  v a  2  s  .c o m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param tthcId
 * @param giaidoanId
 * @return long
 */
public void deleteUngDungRequest(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
    String ungDungId = ParamUtil.getString(actionRequest, "ungDungId");

    // Process Jason feed
    try {
        //Change status
        //DanhMucUngDung ungDung = DanhMucUngDungLocalServiceUtil.fetchDanhMucUngDung(FormatUtil.convertToLong(ungDungId));
        //ungDung.setDaXoa(FormatUtil.DA_XOA_DEACTIVATE);
        //DanhMucUngDungLocalServiceUtil.updateDanhMucUngDung(ungDung);
        //Remove
        DanhMucUngDungLocalServiceUtil.deleteDanhMucUngDung(FormatUtil.convertToLong(ungDungId));
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteUngDung");
    } catch (Exception es) {
        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteUngDung");
    }

    // Hidden default error message
    setSearchParameter(actionRequest, actionResponse);
    FormatUtil.setParameter(actionRequest, actionResponse, keyWord);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/ung_dung_list.jsp");
}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function editOrAddUngDungRequest
 * Version: 1.0//from  w  ww. j a  va2s. c  o m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void editOrAddUngDungRequest(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");
    String ungDungId = ParamUtil.getString(actionRequest, "ungDungId");
    String tenUngDung = ParamUtil.getString(actionRequest, "tenUngDung").trim();
    String maUngDung = ParamUtil.getString(actionRequest, "maUngDung").trim();
    String trangThaiUngDung = ParamUtil.getString(actionRequest, "trangThaiUngDung").trim();

    if (validationUDInput(tenUngDung, ungDungId, maUngDung, actionRequest)) {
        DanhMucUngDung danhMucUngDung = null;
        if (ungDungId.trim().length() > 0) {
            try {
                danhMucUngDung = DanhMucUngDungLocalServiceUtil
                        .fetchDanhMucUngDung(FormatUtil.convertToLong(ungDungId));
                danhMucUngDung.setTen(tenUngDung);
                danhMucUngDung.setMa(maUngDung);
                danhMucUngDung.setNgaySua(new Date());
                danhMucUngDung.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                danhMucUngDung.setDaXoa(FormatUtil.convertToInt(trangThaiUngDung));
                DanhMucUngDungLocalServiceUtil.updateDanhMucUngDung(danhMucUngDung);
                actionResponse.setRenderParameter("CompletedUpdateUngDung", "CompletedUpdateUngDung");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successUpdateUngDung");
            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(danhMucUngDung.toString());
                SessionErrors.add(actionRequest, "errorUpdateUngDung");
            }
        } else {
            try {
                danhMucUngDung = new DanhMucUngDungClp();
                danhMucUngDung.setId(CounterLocalServiceUtil.increment(DanhMucUngDung.class.getName()));
                danhMucUngDung.setTen(tenUngDung);
                danhMucUngDung.setMa(maUngDung);
                danhMucUngDung.setNgaySua(new Date());
                danhMucUngDung.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                danhMucUngDung.setNgayTao(new Date());
                danhMucUngDung.setNguoiTao(themeDisplay.getUser().getEmailAddress());
                danhMucUngDung.setDaXoa(FormatUtil.convertToInt(trangThaiUngDung));
                DanhMucUngDungLocalServiceUtil.addDanhMucUngDung(danhMucUngDung);
                actionResponse.setRenderParameter("CompletedAddUngDung", "CompletedAddUngDung");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successAddUngDung");
                tenUngDung = "";
                maUngDung = "";
                trangThaiUngDung = "0";
            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(danhMucUngDung.toString());
                SessionErrors.add(actionRequest, "errorAddUngDung");
            }
        }
    }

    // Set the result back to session
    actionResponse.setRenderParameter("ActionType", actionType);
    actionResponse.setRenderParameter("ungDungId", ungDungId);
    actionResponse.setRenderParameter("maUngDung", maUngDung);
    actionResponse.setRenderParameter("tenUngDung", tenUngDung);
    actionResponse.setRenderParameter("trangThaiUngDung", trangThaiUngDung);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/ung_dung_add.jsp");
    setSearchParameter(actionRequest, actionResponse);
    FormatUtil.setParameter(actionRequest, actionResponse, keyWord);
}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function deleteNTTHCRequest/* 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 deleteNTTHCRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten
    String formGroup = ParamUtil.getString(actionRequest, "formGroup", "");

    // Get search keyword, the keyword is code
    String nTTHCId = ParamUtil.getString(actionRequest, "nTTHCId");

    // Process Jason feed
    try {

        NhomThuTucHanhChinhLocalServiceUtil.deleteNhomThuTucHanhChinh(FormatUtil.convertToLong(nTTHCId));
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteNTTHC");
    } catch (Exception es) {
        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteNTTHC");
    }

    // Hidden default error message
    //FormatUtil.setParameter(actionRequest, actionResponse, formGroup);
    actionResponse.setRenderParameter("formGroup", formGroup);
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/document/setting/nhom_thu_tuc_hanh_chinh_list.jsp");
}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function editOrAddNhomTTHCRequest
 * Version: 1.0/*  w  ww .  j  a va  2s. com*/
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void editOrAddNhomTTHCRequest(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {
    // Get params
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String formGroup = ParamUtil.getString(actionRequest, "formGroup", "");
    String actionType = ParamUtil.getString(actionRequest, "actionType");
    String nTTHCId = ParamUtil.getString(actionRequest, "nTTHCId");
    String tenNTTHC = ParamUtil.getString(actionRequest, "tenNTTHC").trim();
    String maNTTHC = ParamUtil.getString(actionRequest, "maNTTHC").trim();
    String trangThaiNTTHC = ParamUtil.getString(actionRequest, "trangThaiNTTHC").trim();
    String dmUDId = ParamUtil.getString(actionRequest, "DanhMucUDId");

    if (validationNTTHCInput(tenNTTHC, nTTHCId, maNTTHC, actionRequest)) {
        NhomThuTucHanhChinh nTTHC = null;
        if (nTTHCId.trim().length() > 0) {
            try {
                nTTHC = NhomThuTucHanhChinhLocalServiceUtil
                        .fetchNhomThuTucHanhChinh(FormatUtil.convertToLong(nTTHCId));
                nTTHC.setTen(tenNTTHC);
                nTTHC.setMa(maNTTHC);
                nTTHC.setNgaySua(new Date());
                nTTHC.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                nTTHC.setDanhMucUngDungId(FormatUtil.convertToLong(dmUDId));
                nTTHC.setDaXoa(FormatUtil.convertToInt(trangThaiNTTHC));
                NhomThuTucHanhChinhLocalServiceUtil.updateNhomThuTucHanhChinh(nTTHC);
                actionResponse.setRenderParameter("CompletedUpdateNTTHC", "CompletedUpdateNTTHC");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successUpdateNTTHC");

            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(nTTHC.toString());
                SessionErrors.add(actionRequest, "errorUpdateNTTHC");
            }
        } else {
            try {
                nTTHC = new NhomThuTucHanhChinhClp();
                nTTHC.setId(CounterLocalServiceUtil.increment(NhomThuTucHanhChinh.class.getName()));
                nTTHC.setTen(tenNTTHC);
                nTTHC.setMa(maNTTHC);
                nTTHC.setDanhMucUngDungId(FormatUtil.convertToLong(dmUDId));
                nTTHC.setDaXoa(FormatUtil.convertToInt(trangThaiNTTHC));
                nTTHC.setNgaySua(new Date());
                nTTHC.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                nTTHC.setNgayTao(new Date());
                nTTHC.setNguoiTao(themeDisplay.getUser().getEmailAddress());
                NhomThuTucHanhChinhLocalServiceUtil.addNhomThuTucHanhChinh(nTTHC);
                actionResponse.setRenderParameter("CompletedAddNTTHC", "CompletedAddNTTHC");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successAddNTTHC");

                tenNTTHC = "";
                maNTTHC = "";
                trangThaiNTTHC = "";
                dmUDId = "";
            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(nTTHC.toString());
                SessionErrors.add(actionRequest, "errorAddNTTHC");
            }
        }
    }

    // Set the result back to session
    actionResponse.setRenderParameter("ActionType", actionType);
    actionResponse.setRenderParameter("nTTHCId", nTTHCId);
    actionResponse.setRenderParameter("maNTTHC", maNTTHC);
    actionResponse.setRenderParameter("tenNTTHC", tenNTTHC);
    actionResponse.setRenderParameter("trangThaiNTTHC", trangThaiNTTHC);
    actionResponse.setRenderParameter("DanhMucUDId", dmUDId);

    actionResponse.setRenderParameter("formGroup", formGroup);
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/document/setting/nhom_thu_tuc_hanh_chinh_add.jsp");

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

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function deleteTTHCRequest/*from www .  j  a  v a2s. com*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void deleteTTHCRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten
    String formGroup = actionRequest.getParameter("formGroup");

    // Get search keyword, the keyword is code
    long tthcdId = ParamUtil.getLong(actionRequest, "tthcId");

    // Process Jason feed
    try {
        //Change status
        ThuTucHanhChinh tthc = ThuTucHanhChinhLocalServiceUtil.fetchThuTucHanhChinh(tthcdId);
        tthc.setDaXoa(FormatUtil.DA_XOA_DEACTIVATE);
        ThuTucHanhChinhLocalServiceUtil.updateThuTucHanhChinh(tthc);
        //Remove   
        //ThuTucHanhChinhLocalServiceUtil.deleteThuTucHanhChinh(tthcdId);
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteTTHC");

    } catch (Exception es) {
        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteTTHC");
    }

    // Hidden default error message
    FormatUtil.setParameter(actionRequest, actionResponse, formGroup);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/thu_tuc_hanh_chinh_list.jsp");
}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function editOrAddTTHCRequest
 * Version: 1.0//from  w  w w.j av a 2  s .c  o m
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void editOrAddTTHCRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get params
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String formGroup = actionRequest.getParameter("formGroup");
    String actionType = ParamUtil.getString(actionRequest, "actionType");
    String tthcId = ParamUtil.getString(actionRequest, "tthcId");
    String tenTTHC = ParamUtil.getString(actionRequest, "tenTTHC").trim();
    String maTTHC = ParamUtil.getString(actionRequest, "maTTHC").trim();
    String soNgayXL = ParamUtil.getString(actionRequest, "soNgayXL");
    System.err.println("soNgayXL:" + soNgayXL);
    int trangThaiTTHC = ParamUtil.getInteger(actionRequest, "trangThaiTTHC");
    int tichHop = ParamUtil.getInteger(actionRequest, "tichHop");
    long ungDungId = ParamUtil.getLong(actionRequest, "ungDungId");
    long nhomTTHCId = ParamUtil.getLong(actionRequest, "nhomTTHCId");
    String trinhTuThucHien = ParamUtil.getString(actionRequest, "trinhTuThucHien").trim();
    String cachThucHien = ParamUtil.getString(actionRequest, "cachThucHien").trim();
    String thanhPhanHoSo = ParamUtil.getString(actionRequest, "thanhPhanHoSo").trim();

    String linhVucThucHien = ParamUtil.getString(actionRequest, "linhVucThucHien").trim();
    String lePhi = ParamUtil.getString(actionRequest, "lePhi");
    String donViLePhi = ParamUtil.getString(actionRequest, "donViLePhi").trim();
    String phi = ParamUtil.getString(actionRequest, "phi");
    String donViPhi = ParamUtil.getString(actionRequest, "donViPhi").trim();
    String tenMauDonToKhai = ParamUtil.getString(actionRequest, "tenMauDonToKhai").trim();
    String yeuCauDieuKienThucHien = ParamUtil.getString(actionRequest, "yeuCauDieuKienThucHien").trim();
    String canCuPhapLy = ParamUtil.getString(actionRequest, "canCuPhapLy").trim();
    long capCQQLId = ParamUtil.getLong(actionRequest, "capCoQuanQuanLyId");
    System.err.println("capCQQLId:" + capCQQLId);
    //String doiTuongSDId = ParamUtil.getString(actionRequest, "doiTuongId");

    String[] doiTuongDest = ParamUtil.getParameterValues(actionRequest, "doiTuongId");
    List<List<DoiTuongSuDung>> configList = ThuTucHanhChinhBusiness.findAllDoiTuongByTTHC(doiTuongDest);
    if (configList != null && configList.size() > 1) {
        actionRequest.setAttribute("doiTuongList", configList.get(0));
        actionRequest.setAttribute("doiTuongConfigList", configList.get(1));
    }

    if (validationTTHCInput(tenTTHC, ungDungId, nhomTTHCId, tthcId, maTTHC, FormatUtil.convertToLong(soNgayXL),
            capCQQLId, doiTuongDest, actionRequest)) {
        ThuTucHanhChinh tthc = null;
        if (tthcId.trim().length() > 0) {
            try {
                tthc = ThuTucHanhChinhLocalServiceUtil.fetchThuTucHanhChinh(FormatUtil.convertToLong(tthcId));
                tthc.setTen(tenTTHC);
                tthc.setMa(maTTHC);
                tthc.setNgaySua(new Date());
                tthc.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                tthc.setNhomThuTucHanhChinhId(nhomTTHCId);
                tthc.setSoNgayXuLy(FormatUtil.convertToLong(soNgayXL));
                tthc.setTrangThai(trangThaiTTHC);
                tthc.setCanTichHop(tichHop);

                tthc.setTrinhTuThucHien(trinhTuThucHien + "<br>");
                tthc.setCachThucHien(cachThucHien);
                tthc.setThanhPhanHoSo(thanhPhanHoSo + "<br>");
                tthc.setLinhVucThucHien(linhVucThucHien);
                tthc.setLePhi(FormatUtil.convertToLong(lePhi));
                tthc.setDonViLePhi(donViLePhi);
                tthc.setPhi(FormatUtil.convertToLong(phi));
                tthc.setDonViPhi(donViPhi);
                tthc.setTenMauDonToKhai(tenMauDonToKhai);
                tthc.setYeuCauDieuKienThucHien(yeuCauDieuKienThucHien + "<br>");
                tthc.setCanCuPhapLy(canCuPhapLy + "<br>");
                tthc.setCapCoQuanQuanLyId(capCQQLId);
                System.err.println("tthc:" + tthc);
                ThuTucHanhChinhLocalServiceUtil.updateThuTucHanhChinh(tthc);

                //Update doi tuong
                List<TTHC2DoiTuongSuDung> tthc2dt = TTHC2DoiTuongSuDungLocalServiceUtil
                        .getDSTTHC2DoiTuongSuDungBoiTTHC(FormatUtil.convertToLong(tthcId));
                //String[] dsDoiTuong =doiTuongSDId.split(",");
                if (tthc2dt != null && tthc2dt.size() > 0) {
                    for (TTHC2DoiTuongSuDung dtsd : tthc2dt) {
                        dtsd.setDaXoa(DocumentConstants.INACTIVE);
                        TTHC2DoiTuongSuDungLocalServiceUtil.updateTTHC2DoiTuongSuDung(dtsd);
                        //TTHC2DoiTuongSuDungLocalServiceUtil.deleteTTHC2DoiTuongSuDung(dtsd);
                    }
                }
                TTHC2DoiTuongSuDung dt2Base = new TTHC2DoiTuongSuDungClp();

                if (doiTuongDest != null && doiTuongDest.length > 0) {

                    for (int i = 0; i < doiTuongDest.length; i++) {
                        long idtthc2DT = CounterLocalServiceUtil.increment(TTHC2DoiTuongSuDung.class.getName());

                        dt2Base.setId(idtthc2DT);
                        dt2Base.setNgayTao(new Date());
                        dt2Base.setNguoiTao(themeDisplay.getUser().getEmailAddress());

                        dt2Base.setDaXoa(DocumentConstants.TTHC2DT.DaXoa);
                        dt2Base.setTrangThai(DocumentConstants.TTHC2DT.TrangThai);
                        dt2Base.setNgaySua(new Date());
                        dt2Base.setNguoiSua(themeDisplay.getUser().getEmailAddress());

                        dt2Base.setLoaiDoiTuongId(FormatUtil.convertToLong(doiTuongDest[i].toString()));
                        dt2Base.setThuTucHanhChinhId(FormatUtil.convertToLong(tthcId));

                        try {

                            TTHC2DoiTuongSuDungLocalServiceUtil.addTTHC2DoiTuongSuDung(dt2Base);

                        } catch (Exception es) {
                            FormatUtil.printException(es);
                            FormatUtil.printError(dt2Base.toString());
                            SessionErrors.add(actionRequest, "errorAddTTHC2DT");
                        }

                    }
                }

                actionResponse.setRenderParameter("CompletedUpdateTTHC", "CompletedUpdateTTHC");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successUpdateTTHC");

            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(tthc.toString());
                SessionErrors.add(actionRequest, "errorUpdateTTHC");
            }
        } else {
            try {
                tthc = new ThuTucHanhChinhClp();
                long tthcID = CounterLocalServiceUtil.increment(ThuTucHanhChinh.class.getName());
                tthc.setId(tthcID);
                tthc.setTen(tenTTHC);
                tthc.setMa(maTTHC);
                tthc.setNhomThuTucHanhChinhId(nhomTTHCId);
                tthc.setTrangThai(trangThaiTTHC);
                tthc.setCanTichHop(tichHop);
                tthc.setSoNgayXuLy(FormatUtil.convertToLong(soNgayXL));
                tthc.setNgaySua(new Date());
                tthc.setNguoiSua(themeDisplay.getUser().getEmailAddress());
                tthc.setNgayTao(new Date());
                tthc.setNguoiTao(themeDisplay.getUser().getEmailAddress());

                tthc.setTrinhTuThucHien(trinhTuThucHien + "<br>");
                tthc.setCachThucHien(cachThucHien);
                tthc.setThanhPhanHoSo(thanhPhanHoSo + "<br>");
                tthc.setLinhVucThucHien(linhVucThucHien);
                tthc.setLePhi(FormatUtil.convertToLong(lePhi));
                tthc.setDonViLePhi(donViLePhi);
                tthc.setPhi(FormatUtil.convertToLong(phi));
                tthc.setDonViPhi(donViPhi);
                tthc.setTenMauDonToKhai(tenMauDonToKhai);
                tthc.setYeuCauDieuKienThucHien(yeuCauDieuKienThucHien + "<br>");
                tthc.setCanCuPhapLy(canCuPhapLy + "<br>");
                tthc.setCapCoQuanQuanLyId(capCQQLId);
                ThuTucHanhChinhLocalServiceUtil.addThuTucHanhChinh(tthc);

                //Them doi tuong
                TTHC2DoiTuongSuDung dt2Base = new TTHC2DoiTuongSuDungClp();
                //String[] dsDoiTuong =doiTuongSDId.split(",");
                if (doiTuongDest != null && doiTuongDest.length > 0) {

                    for (int i = 0; i < doiTuongDest.length; i++) {
                        long idtthc2DT = CounterLocalServiceUtil.increment(TTHC2DoiTuongSuDung.class.getName());

                        dt2Base.setId(idtthc2DT);
                        dt2Base.setNgayTao(new Date());
                        dt2Base.setNguoiTao(themeDisplay.getUser().getEmailAddress());

                        dt2Base.setDaXoa(DocumentConstants.TTHC2DT.DaXoa);
                        dt2Base.setTrangThai(DocumentConstants.TTHC2DT.TrangThai);
                        dt2Base.setNgaySua(new Date());
                        dt2Base.setNguoiSua(themeDisplay.getUser().getEmailAddress());

                        dt2Base.setLoaiDoiTuongId(FormatUtil.convertToLong(doiTuongDest[i].toString()));
                        dt2Base.setThuTucHanhChinhId(tthcID);

                        try {

                            TTHC2DoiTuongSuDungLocalServiceUtil.addTTHC2DoiTuongSuDung(dt2Base);

                        } catch (Exception es) {
                            FormatUtil.printException(es);
                            FormatUtil.printError(dt2Base.toString());
                            SessionErrors.add(actionRequest, "errorAddTTHC2DT");
                        }

                    }
                }

                actionResponse.setRenderParameter("CompletedAddTTHC", "CompletedAddTTHC");
                actionResponse.setRenderParameter("completed", "completed");
                SessionMessages.add(actionRequest, "successAddTTHC");

                tenTTHC = "";
                maTTHC = "";
                soNgayXL = "";
                trangThaiTTHC = 1;
                tichHop = 0;
                ungDungId = 0;
                nhomTTHCId = 0;
                trinhTuThucHien = "";
                cachThucHien = "";
                thanhPhanHoSo = "";
                linhVucThucHien = "";
                lePhi = "";
                donViLePhi = "";
                phi = "";
                donViPhi = "";
                tenMauDonToKhai = "";
                canCuPhapLy = "";
                yeuCauDieuKienThucHien = "";
                capCQQLId = 0;
                //doiTuongSDId = "";
                actionRequest.setAttribute("doiTuongList", null);
                actionRequest.setAttribute("doiTuongConfigList", null);

            } catch (Exception es) {
                FormatUtil.printException(es);
                FormatUtil.printError(tthc.toString());
                SessionErrors.add(actionRequest, "errorAddTTHC");
            }
        }
    }

    // Set the result back to session
    actionResponse.setRenderParameter("ActionType", actionType);
    actionResponse.setRenderParameter("tthcId", tthcId);
    actionResponse.setRenderParameter("maTTHC", maTTHC);
    actionResponse.setRenderParameter("tenTTHC", tenTTHC);
    actionResponse.setRenderParameter("tichHop", String.valueOf(tichHop));
    actionResponse.setRenderParameter("trangThaiTTHC", String.valueOf(trangThaiTTHC));
    actionResponse.setRenderParameter("soNgayXL", String.valueOf(soNgayXL));
    actionResponse.setRenderParameter("ungDungId", String.valueOf(ungDungId));
    actionResponse.setRenderParameter("nhomTTHCId", String.valueOf(nhomTTHCId));
    actionResponse.setRenderParameter("trinhTuThucHien", String.valueOf(trinhTuThucHien));
    actionResponse.setRenderParameter("cachThucHien", String.valueOf(cachThucHien));
    actionResponse.setRenderParameter("thanhPhanHoSo", String.valueOf(thanhPhanHoSo));
    actionResponse.setRenderParameter("linhVucThucHien", String.valueOf(linhVucThucHien));
    actionResponse.setRenderParameter("lePhi", String.valueOf(lePhi));
    actionResponse.setRenderParameter("donViLePhi", String.valueOf(donViLePhi));
    actionResponse.setRenderParameter("phi", String.valueOf(phi));
    actionResponse.setRenderParameter("donViPhi", String.valueOf(donViPhi));
    actionResponse.setRenderParameter("tenMauDonToKhai", String.valueOf(tenMauDonToKhai));
    actionResponse.setRenderParameter("yeuCauDieuKienThucHien", String.valueOf(yeuCauDieuKienThucHien));
    actionResponse.setRenderParameter("canCuPhapLy", String.valueOf(canCuPhapLy));
    actionResponse.setRenderParameter("capCoQuanQuanLyId", String.valueOf(capCQQLId));

    actionResponse.setRenderParameter("doiTuongList", doiTuongDest);
    actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/thu_tuc_hanh_chinh_add.jsp");

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

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function deleteGTRequest//  w  w  w  .j a v a  2s .c o m
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void deleteGTRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    // Get search keyword, the keyword can either be Ten

    String tthcId = ParamUtil.getString(actionRequest, "tthcID", null);
    String giaiDoanId = ParamUtil.getString(actionRequest, "giaiDoanId", null);

    // Get search keyword, the keyword is code
    long tt2gtId = ParamUtil.getLong(actionRequest, "tt2gtId");

    // Process Jason feed
    try {
        //Change status
        ThuTuc2GiayTo tt2gt = ThuTuc2GiayToLocalServiceUtil.fetchThuTuc2GiayTo(tt2gtId);
        tt2gt.setDaXoa(FormatUtil.DA_XOA_DEACTIVATE);
        ThuTuc2GiayToLocalServiceUtil.updateThuTuc2GiayTo(tt2gt);
        //Remove   
        //ThuTucHanhChinhLocalServiceUtil.deleteThuTucHanhChinh(tthcdId);
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteTT2GT");
    } catch (Exception es) {
        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteTTHC");
    }

    // Hidden default error message
    actionResponse.setRenderParameter("tthcID", tthcId.toString());
    actionRequest.getPortletSession().setAttribute("tthcID", tthcId.toString());

    actionResponse.setRenderParameter("giaiDoanId", giaiDoanId.toString());
    actionRequest.getPortletSession().setAttribute("giaiDoanId", giaiDoanId);

    PortletPreferences prefs = actionRequest.getPreferences();

    int cur = ParamUtil.getInteger(actionRequest, "curGT", 1);
    int delta = ParamUtil.getInteger(actionRequest, "deltaGT", 10);
    prefs.setValue("curGT", String.valueOf(cur));
    prefs.setValue("deltaGT", String.valueOf(delta));
    prefs.store();
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/document/setting/cau_hinh_danh_muc_giay_to.jsp");

}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function updateCQQL/*  www. j a v  a 2  s  .  c  o m*/
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void updateCQQL(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String giatriCQQLId = ParamUtil.getString(actionRequest, "giatriCQQLId");
    long tthcId = ParamUtil.getLong(actionRequest, "tthcID");

    String quocgiaId = ParamUtil.getString(actionRequest, "quocgiaId");
    String tinhId = ParamUtil.getString(actionRequest, "tinhId");
    String huyenId = ParamUtil.getString(actionRequest, "huyenId");
    String xaId = ParamUtil.getString(actionRequest, "xaId");
    String ungDung = ParamUtil.getString(actionRequest, "ungDung", "0");
    String nhomTTHC = ParamUtil.getString(actionRequest, "nhomTTHC", "0");

    if (Validator.isNull(giatriCQQLId)) {
        SessionErrors.add(actionRequest, "emptyCoQuanQuanLy");
    }

    //      ThuTucHanhChinh tthc = null;
    if (tthcId > 0) {
        try {
            /*tthc = ThuTucHanhChinhLocalServiceUtil.fetchThuTucHanhChinh(tthcId);                     
            tthc.setNgaySua(new Date());               
            tthc.setNguoiSua(themeDisplay.getUser().getEmailAddress());                  
            ThuTucHanhChinhLocalServiceUtil.updateThuTucHanhChinh(tthc);*/

            //Update tthc2Coquanquanly (delete logic)
            List<TTHC2CoQuanQuanLy> tt2CQQL = TTHC2CoQuanQuanLyLocalServiceUtil.getDSTTHC2CoQuanQuanLy(tthcId,
                    DocumentConstants.ACTIVE);
            if (tt2CQQL != null && tt2CQQL.size() > 0) {
                for (TTHC2CoQuanQuanLy tt2cqql : tt2CQQL) {
                    //TTHC2CoQuanQuanLy tT2CCQL= TTHC2CoQuanQuanLyLocalServiceUtil.fetchTTHC2CoQuanQuanLy(tt2cqql.getId());
                    tt2cqql.setDaXoa(DocumentConstants.INACTIVE);
                    TTHC2CoQuanQuanLyLocalServiceUtil.updateTTHC2CoQuanQuanLy(tt2cqql);
                    //TTHC2CoQuanQuanLyLocalServiceUtil.deleteTTHC2CoQuanQuanLy(tt2cqql);
                }
            }

            // add new tthc2coquanquanly
            TTHC2CoQuanQuanLy tt2Base = new TTHC2CoQuanQuanLyClp();
            String[] dsCQQL = giatriCQQLId.split(",");
            if (dsCQQL != null && dsCQQL.length > 0) {

                for (int i = 0; i < dsCQQL.length; i++) {
                    long idtthc2CQ = CounterLocalServiceUtil.increment(TTHC2CoQuanQuanLy.class.getName());

                    tt2Base.setId(idtthc2CQ);
                    tt2Base.setNgayTao(new Date());
                    tt2Base.setNguoiTao(themeDisplay.getUser().getEmailAddress());

                    tt2Base.setDaXoa(DocumentConstants.TTHC2CQQL.DaXoa);
                    tt2Base.setTrangThai(DocumentConstants.TTHC2CQQL.TrangThai);
                    tt2Base.setNgaySua(new Date());
                    tt2Base.setNguoiSua(themeDisplay.getUser().getEmailAddress());

                    tt2Base.setCoQuanQuanLyId(FormatUtil.convertToLong(dsCQQL[i].toString()));
                    tt2Base.setThuTucHanhChinhId(tthcId);

                    String soNgayXuLy = ParamUtil.getString(actionRequest, "soNgayXuLy-" + dsCQQL[i], "0");
                    String phi = ParamUtil.getString(actionRequest, "phi-" + dsCQQL[i], "0");
                    String lePhi = ParamUtil.getString(actionRequest, "lePhi-" + dsCQQL[i], "0");
                    tt2Base.setSoNgayXyLy(FormatUtil.convertToInt(soNgayXuLy));
                    tt2Base.setPhi(FormatUtil.convertToInt(phi));
                    tt2Base.setLePhi(FormatUtil.convertToInt(lePhi));

                    try {

                        TTHC2CoQuanQuanLyLocalServiceUtil.addTTHC2CoQuanQuanLy(tt2Base);

                    } catch (Exception es) {
                        FormatUtil.printException(es);
                        FormatUtil.printError(tt2Base.toString());
                        SessionErrors.add(actionRequest, "errorAddTTHC2CQQL");
                    }

                }
            }

            actionResponse.setRenderParameter("CompletedUpdateTTHC", "CompletedUpdateTTHC");
            actionResponse.setRenderParameter("completed", "completed");
            SessionMessages.add(actionRequest, "successUpdateTTHC");

        } catch (Exception es) {
            FormatUtil.printException(es);
            //            FormatUtil.printError(tthc.toString());
            SessionErrors.add(actionRequest, "errorUpdateTTHC");
        }
    }

    actionResponse.setRenderParameter("giatriCQQLId", giatriCQQLId);
    actionResponse.setRenderParameter("tthcID", String.valueOf(tthcId));
    actionRequest.setAttribute("tthcID", String.valueOf(tthcId));
    actionResponse.setRenderParameter("ungDung", ungDung);
    actionResponse.setRenderParameter("nhomTTHC", nhomTTHC);

    actionResponse.setRenderParameter("quocgiaId", quocgiaId);
    actionRequest.setAttribute("quocgiaId", quocgiaId);
    actionResponse.setRenderParameter("tinhId", tinhId);
    actionRequest.setAttribute("tinhId", tinhId);
    actionResponse.setRenderParameter("huyenId", huyenId);
    actionRequest.setAttribute("huyenId", huyenId);
    actionResponse.setRenderParameter("xaId", xaId);
    actionRequest.setAttribute("xaId", xaId);

    actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/cau_hinh_co_quan_quan_ly.jsp");

}

From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java

License:Apache License

/**
 * This is function deleteVBRequest//ww  w. j  ava  2 s  . c  om
 * Version: 1.0
 *  
 * History: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  ------------------------------------------------- 
 *  3-March-2013  Nam Dinh    Create new
 * @param actionRequest
 * @param actionResponse
 * @throws Exception
 */
public void deleteVBRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    String tthcId = ParamUtil.getString(actionRequest, "tthcID", null);
    String loaiTaiLieuId = ParamUtil.getString(actionRequest, "loaiTaiLieuId", null);

    // Get search keyword, the keyword is code
    long tt2vbId = ParamUtil.getLong(actionRequest, "tt2vbId");

    // Process Jason feed
    try {
        //Change status
        VanBanHuongDan vbhd = VanBanHuongDanLocalServiceUtil.fetchVanBanHuongDan(tt2vbId);
        vbhd.setDaXoa(FormatUtil.DA_XOA_DEACTIVATE);
        VanBanHuongDanLocalServiceUtil.updateVanBanHuongDan(vbhd);

        IDocumentStorage iDocumentStorage = new DocumentStorageImpl();
        String urlFileUpload = iDocumentStorage.getURLById(vbhd.getNoiLuuTruId());
        if (urlFileUpload != null) {
            iDocumentStorage.deleteFile(vbhd.getNoiLuuTruId());
        }
        //Remove   
        //ThuTucHanhChinhLocalServiceUtil.deleteThuTucHanhChinh(tthcdId);
        actionRequest.setAttribute("delete_success", "delete_success");
        SessionMessages.add(actionRequest, "successDeleteHDVB");
    } catch (Exception es) {
        FormatUtil.printException(es);
        SessionErrors.add(actionRequest, "errorDeleteTTHC");
    }

    actionResponse.setRenderParameter("tthcID", tthcId);
    actionRequest.getPortletSession().setAttribute("tthcID", tthcId);

    actionResponse.setRenderParameter("loaiTaiLieuId", loaiTaiLieuId);
    actionRequest.getPortletSession().setAttribute("loaiTaiLieuId", loaiTaiLieuId);

    PortletPreferences prefs = actionRequest.getPreferences();

    int cur = ParamUtil.getInteger(actionRequest, "curBM", 1);
    int delta = ParamUtil.getInteger(actionRequest, "deltaBM", 10);
    prefs.setValue("curBM", String.valueOf(cur));
    prefs.setValue("deltaBM", String.valueOf(delta));
    prefs.store();
    actionResponse.setRenderParameter("jspPage",
            "/html/portlet/document/setting/cau_hinh_huong_dan_bieu_mau.jsp");
}

From source file:org.oep.cmon.portlet.document.action.YKienTraoDoiAction.java

License:Apache License

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

    // hoso - String
    long idHoSo = FormatUtil.convertToLong(ParamUtil.getString(resourceRequest, "yKienTraoDoiId"));

    String tieuDe = ParamUtil.getString(resourceRequest, "tieuDe").trim();
    String noiDung = ParamUtil.getString(resourceRequest, "noiDung").trim();
    String back_Current_Url = ParamUtil
            .getString(resourceRequest, "/html/portlet/ykientraodoi/danh_sach_y_kien.jsp").trim();

    if (validatorsYKienTraoDoi(resourceRequest)) {
        saveYKienTraoDoiToDB(resourceRequest, httpReq, "");

        //            String emailNguoiGui= ConfigurationManager.getStrProp("vn.dtt.moh.mail.default.system", "noreply1@dtt.vn");
        //            LogFactoryMOC.getLog().debug("doanhNghiep.getEmailDoanhNghiep()doanhNghiep.getEmailDoanhNghiep()===" + doanhNghiep.getEmailDoanhNghiep());
        //            LogFactoryMOC.getLog().debug("congChuc.getHoVaTen()congChuc.getHoVaTen()===" + congChuc.getHoVaTen());
        //            try {
        //               BusinessUtils.sendEmail(doanhNghiep.getEmailDoanhNghiep(), emailNguoiGui, congChuc.getHoVaTen(), tieuDe, noiDung);
        //            } catch (Exception e) {
        //               LogFactoryMOC.getLog().error(e.toString());
        //            }

        //            if (listMail != null && listMail.length() > 0) {
        //               String[] list = listMail.split(";");
        //               for (String item : list) {
        //                  BusinessUtils.sendEmail(item,emailNguoiGui, congChuc.getHoVaTen(), tieuDe, noiDung);
        //               }
        //            }

        //            String BUOC_XU_LY = ConfigurationManager.getStrProp("vn.dtt.moh.sentemail.content.buocxuly", "");
        //            DocumentUtils.addHistory(BusinessUtils.createLichSuHoSoObject(BUOC_XU_LY,
        //                  congChuc.getHoVaTen(), idHoSo, noiDung, 0));

        httpReq.setRenderParameter("jspPage", "/html/portlet/ykientraodoi/congdan_traodoi_canbo_form.jsp");
        httpReq.setRenderParameter("sent_success", "true");

    } else {
        httpReq.setRenderParameter("jspPage", "/html/portlet/ykientraodoi/congdan_traodoi_canbo_form.jsp");
    }

    httpReq.setRenderParameter("tieuDe", tieuDe);
    httpReq.setRenderParameter("noiDung", noiDung);
    httpReq.setRenderParameter("back_Current_Url", back_Current_Url);

    httpReq.setRenderParameter("hoSoTTHCCongId", String.valueOf(idHoSo));

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

}