List of usage examples for com.liferay.portal.kernel.servlet SessionMessages add
public static void add(PortletRequest portletRequest, String key)
From source file:org.oep.cmon.portlet.admin.congchuc.action.CongChucPortlet.java
License:Apache License
/** * This is function save role popup/* ww w .j a v 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 searchVaiTroPopup(ActionRequest request, ActionResponse response) throws Exception { String congChucId = ParamUtil.getString(request, "congChucId", ""); String searchInputText = ParamUtil.getString(request, "searchInputText", ""); String[] strVaiTroIds = request.getParameterValues("strVaiTroIds[]"); if (strVaiTroIds != null) { boolean insertOk = true; User user = PortalUtil.getUser(request); CongChuc congChuc = CongChucLocalServiceUtil.fetchCongChuc(Long.valueOf(congChucId)); TaiKhoanNguoiDung taiKhoanNguoiDung = TaiKhoanNguoiDungLocalServiceUtil .fetchTaiKhoanNguoiDung(congChuc.getTaiKhoanNguoiDungId()); long[] vaitroids = new long[strVaiTroIds.length]; for (int i = 0; i < strVaiTroIds.length; i++) { vaitroids[i] = Long.valueOf(strVaiTroIds[i]); } for (int i = 0; i < vaitroids.length; i++) { NguoiDung2VaiTro nguoiDung2VaiTro = new NguoiDung2VaiTroClp(); nguoiDung2VaiTro.setId(CounterLocalServiceUtil.increment(NguoiDung2VaiTro.class.getName())); nguoiDung2VaiTro.setNgayTao(new Date()); if (user != null) { nguoiDung2VaiTro.setNguoiTao(user.getFullName()); } else { nguoiDung2VaiTro.setNguoiTao("ADMIN"); } nguoiDung2VaiTro.setDaXoa(0); nguoiDung2VaiTro.setVaiTroId(vaitroids[i]); nguoiDung2VaiTro.setTaiKhoanNguoiDungId(taiKhoanNguoiDung.getId()); NguoiDung2VaiTroLocalServiceUtil.addNguoiDung2VaiTro(nguoiDung2VaiTro); } insertOk = CongChucUtils.ganQuyenToCanBo(congChuc, vaitroids); if (insertOk) { SessionMessages.add(request, "addVaiTroSuccess"); request.setAttribute("submited", 1); } else { for (int i = 0; i < vaitroids.length; i++) { NguoiDung2VaiTro nguoiDung2VaiTro = NguoiDung2VaiTroLocalServiceUtil .findByVaiTroIDAndTaiKhoanNguoiDungId(vaitroids[i], taiKhoanNguoiDung.getId(), 0); NguoiDung2VaiTroLocalServiceUtil.deleteNguoiDung2VaiTro(nguoiDung2VaiTro); } SessionErrors.add(request, "addVaiTroError"); } } List<VaiTro> listVaiTro = new ArrayList<VaiTro>(); listVaiTro = CongChucUtils.searchVaiTroByTen(searchInputText, 0); request.setAttribute("congChucId", congChucId); request.setAttribute("listVaiTro", listVaiTro); request.setAttribute("searchInputText", searchInputText); response.setRenderParameter("jspPage", "/html/portlet/admin/congchuc/congchuc/addvaitrotocanbo.jsp"); }
From source file:org.oep.cmon.portlet.admin.congchuc.action.CongChucPortlet.java
License:Apache License
/** * This is function delete VaiTro to CanBo * Version: 1.0// ww w . j av a 2s . c om * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param request * @param response * @throws Exception */ public void deleteVaiTroToCanBo(ActionRequest request, ActionResponse response) throws Exception { String coQuanQuanLyId = ParamUtil.getString(request, "coQuanQuanLyId", ""); String maOrTenOrEmail = ParamUtil.getString(request, "maOrTenOrEmail", ""); boolean deleteOk = false; long congChucId = ParamUtil.getLong(request, "congChucId", 0); long vaiTroId = ParamUtil.getLong(request, "vaiTroId", 0); CongChuc congChuc = CongChucLocalServiceUtil.fetchCongChuc(congChucId); TaiKhoanNguoiDung taiKhoanNguoiDung = null; try { taiKhoanNguoiDung = TaiKhoanNguoiDungLocalServiceUtil .getTaiKhoanNguoiDung(congChuc.getTaiKhoanNguoiDungId()); } catch (Exception e) { } NguoiDung2VaiTro nguoiDung2VaiTro = NguoiDung2VaiTroLocalServiceUtil .findByVaiTroIDAndTaiKhoanNguoiDungId(vaiTroId, taiKhoanNguoiDung.getId(), 0); if (nguoiDung2VaiTro != null) { deleteOk = CongChucUtils.xoaQuyenToCanBo(congChuc, vaiTroId); if (deleteOk) { NguoiDung2VaiTroLocalServiceUtil.deleteNguoiDung2VaiTro(nguoiDung2VaiTro); } } List<ChucVu2VaiTro> listChucVu2VaiTro = null; if (congChuc.getChucVuId() != 0) { listChucVu2VaiTro = ChucVu2VaiTroLocalServiceUtil .findByIdChucVuAndIdCoQuanQuanLy(congChuc.getChucVuId(), congChuc.getCoQuanQuanLyId(), 0); } List<NguoiDung2VaiTro> listNguoiDung2VaiTro = NguoiDung2VaiTroLocalServiceUtil .findByTaiKhoanNguoiDungID(taiKhoanNguoiDung.getId(), Constants.ACTIVATED); if (deleteOk) { SessionMessages.add(request, "deleteVaiTroSuccess"); } else { SessionErrors.add(request, "deleteVaiTroError"); } request.setAttribute("congChucId", congChucId); request.setAttribute("maOrTenOrEmail", maOrTenOrEmail); request.setAttribute("coQuanQuanLyId", coQuanQuanLyId); request.setAttribute("listChucVu2VaiTro", listChucVu2VaiTro); request.setAttribute("listNguoiDung2VaiTro", listNguoiDung2VaiTro); response.setRenderParameter("jspPage", pageQuyenCongChuc); }
From source file:org.oep.cmon.portlet.document.action.CitizenDocumentPortlet.java
License:Apache License
/** * This is function delete ChungThucCongDan * Version: 1.0/*from w w w . j av a 2 s . com*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void deleteChungThucCongDan(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // set parameters for search setSearchParameter(actionRequest, actionResponse); // Get search keyword, the keyword is code String taiLieuId = ParamUtil.getString(actionRequest, "id", ""); try { //Change status TaiLieuChungThuc taiLieuChungThuc = TaiLieuChungThucLocalServiceUtil .fetchTaiLieuChungThuc(FormatUtil.convertToLong(taiLieuId)); String documentTypeCode = DanhMucGiayToLocalServiceUtil .fetchDanhMucGiayTo(taiLieuChungThuc.getDanhMucGiayToId()).getMa(); IDocumentService service = new DocumentServiceImpl(); boolean result = service.doDelete(PortalUtil.getUser(actionRequest).getUserId(), documentTypeCode); if (result) { SessionMessages.add(actionRequest, "successDelete"); } else { SessionErrors.add(actionRequest, "errorDelete"); } //taiLieuChungThuc.setTrangThai(Constants.Citizen.TrangThai_XoaTam); //TaiLieuChungThucLocalServiceUtil.updateTaiLieuChungThuc(taiLieuChungThuc); //SessionMessages.add(actionRequest, "successDelete"); } catch (Exception es) { FormatUtil.printException(es); SessionErrors.add(actionRequest, "errorDelete"); } actionResponse.setRenderParameter("jspPage", "/html/portlet/document/citizen/citizen_document_list.jsp"); }
From source file:org.oep.cmon.portlet.document.action.CitizenDocumentPortlet.java
License:Apache License
/** * This is function edit or add ChungThucCongDan * Version: 1.0//from ww w .j a v a 2 s. co m * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void editOrAddChungThucRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get params ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); String modeView = ParamUtil.getString(uploadRequest, "modeView"); String luuTruId = ParamUtil.getString(uploadRequest, "luuTruId"); String danhMucGiayToId = ParamUtil.getString(uploadRequest, "danhMucGiayToId"); //String file = ParamUtil.getString(uploadRequest, "file"); long doiTuongId = ParamUtil.getLong(uploadRequest, "doiTuongId"); long congDanId = ParamUtil.getLong(uploadRequest, "congDanId"); //long noiLuuTruId=0L; File fileUpload = uploadRequest.getFile("file"); String sourceFileName = uploadRequest.getFileName("file"); byte[] bytes = FileUtil.getBytes(fileUpload); if (validationInput(danhMucGiayToId, sourceFileName, actionRequest)) { TaiLieuChungThuc taiLieu = null; if (!Helpers.isEmpty(luuTruId)) { try { DanhMucGiayTo danhmuc = DanhMucGiayToLocalServiceUtil .fetchDanhMucGiayTo(FormatUtil.convertToLong(danhMucGiayToId)); String documentTypeCode = danhmuc.getMa(); //String documentName = DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(FormatUtil.convertToLong(danhMucGiayToId)).getTen(); IDocumentService service = new DocumentServiceImpl(); ResultUpload result = service.doUpload(PortalUtil.getUser(actionRequest).getUserId(), null, documentTypeCode, bytes, sourceFileName, false, false); if (result.getCode().compareTo(Constants.UPLOAD_OK) == 0 && result != null) { SessionMessages.add(actionRequest, "successUpdate"); } else { SessionErrors.add(actionRequest, "errorUploadFile"); } } catch (Exception es) { _log.error(es.getMessage(), es); SessionErrors.add(actionRequest, "errorAddOrUpdate"); } } else { try { DanhMucGiayTo danhmuc = DanhMucGiayToLocalServiceUtil .fetchDanhMucGiayTo(FormatUtil.convertToLong(danhMucGiayToId)); String documentTypeCode = danhmuc.getMa(); //String documentName = DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(FormatUtil.convertToLong(danhMucGiayToId)).getTen(); IDocumentService service = new DocumentServiceImpl(); long userId = PortalUtil.getUser(actionRequest).getUserId(); ResultUpload result = service.doUpload(userId, null, documentTypeCode, bytes, sourceFileName, false, false); if (result.getCode().compareTo(Constants.UPLOAD_OK) == 0 && result != null) { SessionMessages.add(actionRequest, "successAdd"); //file = ""; sourceFileName = ""; danhMucGiayToId = ""; } else { String fileType = danhmuc.getKieuTaiLieu(); long fileSize = danhmuc.getGioiHanDungLuong(); actionResponse.setRenderParameter("fileType", String.valueOf(fileType)); actionResponse.setRenderParameter("fileSize", String.valueOf(fileSize)); //SessionErrors.add(actionRequest, "errorUploadFile"); actionResponse.setRenderParameter("errorUploadFile", "errorUploadFile"); } } catch (Exception es) { _log.error(es.getMessage(), es); SessionErrors.add(actionRequest, "errorAddOrUpdate"); } } } //set parameters setSearchParameter(actionRequest, actionResponse); // Set the result back to session actionResponse.setRenderParameter("modeView", modeView); actionResponse.setRenderParameter("luuTruId", luuTruId); actionResponse.setRenderParameter("doiTuongId", String.valueOf(doiTuongId)); actionResponse.setRenderParameter("congDanId", String.valueOf(congDanId)); actionResponse.setRenderParameter("danhMucGiayToId", danhMucGiayToId); actionResponse.setRenderParameter("file", sourceFileName); actionResponse.setRenderParameter("jspPage", "/html/portlet/document/citizen/citizen_document_form.jsp"); }
From source file:org.oep.cmon.portlet.document.action.SettingPortlet.java
License:Apache License
/** * This is function editOrAddDMGTRequest * Version: 1.0// w w w .j ava 2s. com * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void editOrAddDMGTRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get params ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String keyWord = ParamUtil.getString(actionRequest, "searchKeyWord", ""); String doituongGroup = ParamUtil.getString(actionRequest, "doituongGroup", ""); String actionType = ParamUtil.getString(actionRequest, "actionType"); String dMGTId = ParamUtil.getString(actionRequest, "dMGTId"); String tenDMGT = ParamUtil.getString(actionRequest, "tenDMGT").trim(); String maDMGT = ParamUtil.getString(actionRequest, "maDMGT").trim(); String taiLieu = ParamUtil.getString(actionRequest, "kieuTaiLieu").trim(); String dungLuong = ParamUtil.getString(actionRequest, "gioiHanDL").trim(); Long taiLieuTTId = ParamUtil.getLong(actionRequest, "TaiLieuTTId"); if (taiLieuTTId.intValue() == -1) taiLieuTTId = null; int trangThaiDMGT = ParamUtil.getInteger(actionRequest, "trangThaiDMGT", DocumentConstants.ACTIVE); String doiTuongSDId = ParamUtil.getString(actionRequest, "giatridoituongId"); //String gtDoiTuongSDId = ParamUtil.getString(actionRequest, "giatridoituongId"); // String doiTuongSDId=actionRequest.getParameter("doituongId"); String moTa = ParamUtil.getString(actionRequest, "moTaDMGT").trim(); if (validationInput(tenDMGT, dMGTId, maDMGT, taiLieu, dungLuong, doiTuongSDId, actionRequest)) { DanhMucGiayTo dMGT = null; if (dMGTId.trim().length() > 0) { try { dMGT = DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(FormatUtil.convertToLong(dMGTId)); dMGT.setTen(tenDMGT); dMGT.setMa(maDMGT); dMGT.setNgaySua(new Date()); dMGT.setNguoiSua(themeDisplay.getUser().getEmailAddress()); dMGT.setKieuTaiLieu(taiLieu); dMGT.setTailieuThayTheId(taiLieuTTId); dMGT.setGioiHanDungLuong(FormatUtil.convertToLong(dungLuong)); dMGT.setMota(moTa); dMGT.setDaXoa(trangThaiDMGT); DanhMucGiayToLocalServiceUtil.updateDanhMucGiayTo(dMGT); List<DanhMucGiayTo2DoiTuongSuDung> gt2DT = DanhMucGiayTo2DoiTuongSuDungLocalServiceUtil .getTheoLoaiGT_DSDMGT2DTSD(FormatUtil.convertToLong(dMGTId)); String[] dsDoiTuong = doiTuongSDId.split(","); //Xoa het, vi co truong hop them doi tuong, hoac xoa bot doi tuong if (gt2DT != null && gt2DT.size() > 0) { for (DanhMucGiayTo2DoiTuongSuDung doiTuongSD2GT : gt2DT) { doiTuongSD2GT.setDaXoa(DocumentConstants.INACTIVE); DanhMucGiayTo2DoiTuongSuDungLocalServiceUtil .updateDanhMucGiayTo2DoiTuongSuDung(doiTuongSD2GT); //DanhMucGiayTo2DoiTuongSuDungLocalServiceUtil.deleteDanhMucGiayTo2DoiTuongSuDung(doiTuongSD2GT); } } //Them Doi tuong DanhMucGiayTo2DoiTuongSuDung gt2DTBase = new DanhMucGiayTo2DoiTuongSuDungClp(); if (dsDoiTuong != null && dsDoiTuong.length > 0) { for (int i = 0; i < dsDoiTuong.length; i++) { long idGT2DT = CounterLocalServiceUtil .increment(DanhMucGiayTo2DoiTuongSuDung.class.getName()); gt2DTBase.setId(idGT2DT); gt2DTBase.setNgayTao(new Date()); gt2DTBase.setNguoiTao(themeDisplay.getUser().getEmailAddress()); gt2DTBase.setDaXoa(DocumentConstants.GT2DT.DaXoa); gt2DTBase.setTrangThai(DocumentConstants.GT2DT.TrangThai); gt2DTBase.setNgaySua(new Date()); gt2DTBase.setNguoiSua(themeDisplay.getUser().getEmailAddress()); gt2DTBase.setLoaiDoiTuongId(FormatUtil.convertToLong(dsDoiTuong[i].toString())); gt2DTBase.setLoaiGiayToId(FormatUtil.convertToLong(dMGTId)); try { DanhMucGiayTo2DoiTuongSuDungLocalServiceUtil .addDanhMucGiayTo2DoiTuongSuDung(gt2DTBase); } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(gt2DT.toString()); SessionErrors.add(actionRequest, "errorAddGT2DT"); } } } actionResponse.setRenderParameter("CompletedUpdateDMGT", "CompletedUpdateDMGT"); actionResponse.setRenderParameter("completed", "completed"); SessionMessages.add(actionRequest, "successUpdateDMGT"); } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(dMGT.toString()); SessionErrors.add(actionRequest, "errorUpdateDMGT"); } } else { try { dMGT = new DanhMucGiayToClp(); long loaiGiayToId = CounterLocalServiceUtil.increment(DanhMucGiayTo.class.getName()); dMGT.setId(loaiGiayToId); dMGT.setTen(tenDMGT); dMGT.setMa(maDMGT); dMGT.setKieuTaiLieu(taiLieu); dMGT.setTailieuThayTheId(taiLieuTTId); dMGT.setGioiHanDungLuong(FormatUtil.convertToLong(dungLuong)); dMGT.setDaXoa(trangThaiDMGT); dMGT.setNgaySua(new Date()); dMGT.setNguoiSua(themeDisplay.getUser().getEmailAddress()); dMGT.setNgayTao(new Date()); dMGT.setNguoiTao(themeDisplay.getUser().getEmailAddress()); dMGT.setPhienBan(1); dMGT.setMota(moTa); DanhMucGiayToLocalServiceUtil.addDanhMucGiayTo(dMGT); //Them Doi tuong DanhMucGiayTo2DoiTuongSuDung gt2DT = new DanhMucGiayTo2DoiTuongSuDungClp(); String[] dsDoiTuong = doiTuongSDId.split(","); if (dsDoiTuong != null && dsDoiTuong.length > 0) { for (int i = 0; i < dsDoiTuong.length; i++) { long idGT2DT = CounterLocalServiceUtil .increment(DanhMucGiayTo2DoiTuongSuDung.class.getName()); gt2DT.setId(idGT2DT); gt2DT.setNgayTao(new Date()); gt2DT.setNguoiTao(themeDisplay.getUser().getEmailAddress()); gt2DT.setDaXoa(DocumentConstants.GT2DT.DaXoa); gt2DT.setTrangThai(DocumentConstants.GT2DT.TrangThai); gt2DT.setNgaySua(new Date()); gt2DT.setNguoiSua(themeDisplay.getUser().getEmailAddress()); gt2DT.setLoaiDoiTuongId(FormatUtil.convertToLong(dsDoiTuong[i].toString())); gt2DT.setLoaiGiayToId(loaiGiayToId); try { DanhMucGiayTo2DoiTuongSuDungLocalServiceUtil.addDanhMucGiayTo2DoiTuongSuDung(gt2DT); } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(gt2DT.toString()); SessionErrors.add(actionRequest, "errorAddGT2DT"); } } } actionResponse.setRenderParameter("CompletedAddDMGT", "CompletedAddDMGT"); actionResponse.setRenderParameter("completed", "completed"); SessionMessages.add(actionRequest, "successAddDMGT"); tenDMGT = ""; maDMGT = ""; doiTuongSDId = ""; taiLieu = ""; dungLuong = ""; moTa = ""; } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(dMGT.toString()); SessionErrors.add(actionRequest, "errorAddDMGT"); } } } String strTaiLieuTTId = String.valueOf(taiLieuTTId); // Set the result back to session actionResponse.setRenderParameter("ActionType", actionType); actionResponse.setRenderParameter("dMGTId", dMGTId); actionResponse.setRenderParameter("maDMGT", maDMGT); actionResponse.setRenderParameter("tenDMGT", tenDMGT); actionResponse.setRenderParameter("doituongId", doiTuongSDId); actionResponse.setRenderParameter("kieuTaiLieu", taiLieu); actionResponse.setRenderParameter("TaiLieuTTId", strTaiLieuTTId != null ? strTaiLieuTTId : "-1"); actionResponse.setRenderParameter("gioiHanDL", dungLuong); actionResponse.setRenderParameter("moTaDMGT", moTa); actionResponse.setRenderParameter("searchKeyWord", keyWord); actionResponse.setRenderParameter("doituongGroup", doituongGroup); actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/dm_giayto_add.jsp"); FormatUtil.setParameter(actionRequest, actionResponse, keyWord); }
From source file:org.oep.cmon.portlet.document.action.SettingPortlet.java
License:Apache License
/** * This is function delete document//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 deleteDMGTRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get search keyword, the keyword can either be Ten String keyWord = ParamUtil.getString(actionRequest, "searchKeyWord", ""); String doituongGroup = ParamUtil.getString(actionRequest, "doituongGroup", ""); // Get search keyword, the keyword is code String dmgtId = ParamUtil.getString(actionRequest, "dMGTId"); // Process Jason feed try { //update if used DanhMucGiayTo dMGT = DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(FormatUtil.convertToLong(dmgtId)); dMGT.setDaXoa(FormatUtil.DA_XOA_DEACTIVATE); DanhMucGiayToLocalServiceUtil.updateDanhMucGiayTo(dMGT); //delete if not used //DanhMucGiayToLocalServiceUtil.deleteDanhMucGiayTo(FormatUtil.convertToLong(dmgtId)); actionRequest.setAttribute("delete_success", "delete_success"); SessionMessages.add(actionRequest, "successDeleteDMGT"); } catch (Exception es) { // TODO: handle exception FormatUtil.printException(es); SessionErrors.add(actionRequest, "errorDeleteGMGT"); } // Hidden default error message actionResponse.setRenderParameter("searchKeyWord", keyWord); actionResponse.setRenderParameter("doituongGroup", doituongGroup); //FormatUtil.setParameter(actionRequest, actionResponse, keyWord); // Redirect to document list jsp actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/dm_giayto_list.jsp"); }
From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java
License:Apache License
/** * This is function save CauHinhLienThong * Version: 1.0//w w w . ja va 2s . com * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param request * @param response * @throws SystemException * @throws IOException */ public void luuCauHinhLienThong(ActionRequest request, ActionResponse response) throws SystemException, IOException { long thuTucId = ParamUtil.getLong(request, "thuTucId"); long thuTucLienThongId = ParamUtil.getLong(request, "thuTucLienThongId"); ThuTucHanhChinh thuTuc = ThuTucHanhChinhLocalServiceUtil.fetchThuTucHanhChinh(thuTucId); thuTuc.setThuTucLienThongId((thuTucLienThongId == 0L) ? null : thuTucLienThongId); ThuTucHanhChinhLocalServiceUtil.updateThuTucHanhChinh(thuTuc); SessionMessages.add(request, "luuCauHinhLienThongThanhCong"); response.sendRedirect(ParamUtil.getString(request, "redirectURl")); }
From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java
License:Apache License
/** * This is function updatePortlet2TTHC// w w w . ja va 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 updatePortlet2TTHC(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String portletName = ParamUtil.getString(actionRequest, "portletName"); String tthcId = ParamUtil.getString(actionRequest, "tthcId"); CauHinhPortlet2ThuTuc cauHinhPortlet2ThuTuc = CauHinhPortlet2ThuTucLocalServiceUtil .fetchCauHinhPortlet2ThuTuc(ConvertUtil.convertToLong(tthcId)); //CauHinhPortlet2ThuTuc cauHinhPortlet2ThuTuc = CauHinhPortlet2ThuTucLocalServiceUtil.getCauHinhPortlet2ThuTuc(ConvertUtil.convertToLong(tthcId)); if (cauHinhPortlet2ThuTuc != null) { cauHinhPortlet2ThuTuc.setPortletName(portletName); CauHinhPortlet2ThuTucLocalServiceUtil.updateCauHinhPortlet2ThuTuc(cauHinhPortlet2ThuTuc); } else { cauHinhPortlet2ThuTuc = new CauHinhPortlet2ThuTucClp(); cauHinhPortlet2ThuTuc.setThuTucHanhChinhId(ConvertUtil.convertToLong(tthcId)); cauHinhPortlet2ThuTuc.setPortletName(portletName); CauHinhPortlet2ThuTucLocalServiceUtil.addCauHinhPortlet2ThuTuc(cauHinhPortlet2ThuTuc); } actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/thu_tuc_hanh_chinh_list.jsp"); actionResponse.setRenderParameter("CompletedUpdatePortlet2TTHC", "CompletedUpdatePortlet2TTHC"); actionRequest.setAttribute("CompletedUpdatePortlet2TTHC", "CompletedUpdatePortlet2TTHC"); SessionMessages.add(actionRequest, "CompletedUpdatePortlet2TTHC"); }
From source file:org.oep.cmon.portlet.document.action.ThuTucHanhChinhPortlet.java
License:Apache License
/** * This is function searchCHDMGT/*w ww.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 searchCHDMGT(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Long tthcId = ParamUtil.getLong(actionRequest, "tthcID", 0L); Integer giaiDoanId = ParamUtil.getInteger(actionRequest, "giaiDoanId", 0); String ghilai = ParamUtil.getString(actionRequest, "ghilai"); String ungDung = ParamUtil.getString(actionRequest, "ungDung", "0"); String nhomTTHC = ParamUtil.getString(actionRequest, "nhomTTHC", "0"); //Update if (ghilai != null && ghilai.length() > 0) { //Update Bat Buoc List<ThuTuc2GiayTo> tt2GTList = ThuTuc2GiayToLocalServiceUtil.getDSGiayToTheoThuTuc(tthcId, DocumentConstants.ACTIVE, giaiDoanId); if (tt2GTList != null) { for (ThuTuc2GiayTo tt2gt : tt2GTList) { try { int yeucau = ParamUtil.getInteger(actionRequest, tt2gt.getId() + "_batbuoc", 0); long thutu = ParamUtil.getLong(actionRequest, tt2gt.getId() + "_thutu", tt2gt.getThuTuHienThi()); tt2gt.setBatBuoc(yeucau); tt2gt.setNgaySua(new Date()); tt2gt.setNguoiSua(themeDisplay.getUser().getEmailAddress()); tt2gt.setNgayTao(new Date()); tt2gt.setNguoiTao(themeDisplay.getUser().getEmailAddress()); tt2gt.setThuTuHienThi(thutu); ThuTuc2GiayToLocalServiceUtil.updateThuTuc2GiayTo(tt2gt); actionRequest.setAttribute("update_success", "update_success"); SessionMessages.add(actionRequest, "successUpdateTT2GT"); } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(tt2gt.toString()); SessionErrors.add(actionRequest, "errorUpdateTT2GT"); } } } } actionResponse.setRenderParameter("tthcID", tthcId.toString()); actionRequest.getPortletSession().setAttribute("tthcID", tthcId.toString()); actionResponse.setRenderParameter("giaiDoanId", giaiDoanId.toString()); actionRequest.getPortletSession().setAttribute("giaiDoanId", giaiDoanId); actionResponse.setRenderParameter("ungDung", ungDung); actionResponse.setRenderParameter("nhomTTHC", nhomTTHC); 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 searchPopupDocument//ww w . j a v a2 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 searchPopupDocument(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String keyWord = ParamUtil.getString(actionRequest, "searchKeyWord"); String group = ParamUtil.getString(actionRequest, "selectedGT"); String[] selectedGroup = actionRequest.getParameterValues("selectedGT"); long gtID = 0; // Get document group String doituongGroup = ParamUtil.getString(actionRequest, "doituongSuDung"); Long tthcId = ParamUtil.getLong(actionRequest, "tthcId"); Integer giaiDoanId = ParamUtil.getInteger(actionRequest, "giaiDoanId"); String selectButton = ParamUtil.getString(actionRequest, "selectButton", null); if (selectedGroup != null) { actionRequest.setAttribute("action", "save"); } else { actionRequest.setAttribute("action", null); } //if (selectButton != null && selectButton.length() > 0) { if (selectedGroup != null) { //Insert into Thutuc2GT ThuTuc2GiayTo tt2gt = null; for (int tl = 0; tl < selectedGroup.length; tl++) { gtID = Long.parseLong(selectedGroup[tl]); try { tt2gt = new ThuTuc2GiayToClp(); long tt2gtID = CounterLocalServiceUtil.increment(ThuTuc2GiayTo.class.getName()); tt2gt.setId(tt2gtID); tt2gt.setDaXoa(DocumentConstants.TTHC2DT.DaXoa); tt2gt.setTrangThai(DocumentConstants.TTHC2DT.TrangThai); tt2gt.setGiaidoan(giaiDoanId); tt2gt.setNgaySua(new Date()); tt2gt.setNguoiSua(themeDisplay.getUser().getEmailAddress()); tt2gt.setNgayTao(new Date()); tt2gt.setNguoiTao(themeDisplay.getUser().getEmailAddress()); tt2gt.setThuTucHanhChinhId(tthcId); tt2gt.setDanhMucGiayToId(gtID); tt2gt.setBatBuoc(DocumentConstants.TTHC2DT.Default_BatBuoc); //tt2gt.setThuTuHienThi(gtID);//mac dinh lay id long ttHienThi = this.getMaxTTHT(tthcId, giaiDoanId) + tl + 1; tt2gt.setThuTuHienThi(ttHienThi); ThuTuc2GiayToLocalServiceUtil.addThuTuc2GiayTo(tt2gt); actionRequest.setAttribute("update_success", "update_success"); //actionResponse.setRenderParameter("update_success", "update_success"); SessionMessages.add(actionRequest, "successUpdateTT2GT"); } catch (Exception es) { FormatUtil.printException(es); FormatUtil.printError(tt2gt.toString()); SessionErrors.add(actionRequest, "errorUpdateTT2GT"); } } } //}// end if neu nhan nut them moi thi tao chung chi giay phep // Set the result back to session actionResponse.setRenderParameter("doituongSuDung", doituongGroup); actionResponse.setRenderParameter("tthcId", String.valueOf(tthcId)); actionResponse.setRenderParameter("giaiDoanId", String.valueOf(giaiDoanId)); actionResponse.setRenderParameter("searchKeyWord", keyWord); PortletPreferences prefs = actionRequest.getPreferences(); int cur = ParamUtil.getInteger(actionRequest, "cur2pop", 1); int delta = ParamUtil.getInteger(actionRequest, "delta2pop", 10); prefs.setValue("cur2pop", String.valueOf(cur)); prefs.setValue("delta2pop", String.valueOf(delta)); prefs.store(); actionResponse.setWindowState(LiferayWindowState.NORMAL); actionResponse.setRenderParameter("jspPage", "/html/portlet/document/setting/cau_hinh_danh_muc_giay_to.jsp"); }