List of usage examples for com.liferay.portal.kernel.servlet SessionErrors isEmpty
public static boolean isEmpty(PortletRequest portletRequest)
From source file:org.oep.cmon.admin.portlet.action.DanhMucDonViHanhChinhAction.java
License:Apache License
/** * This is function validate input/* w w w. j a v a 2s.co m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param maDonViHanhChinh * @param tenDonViHanhChinh * @param DonViHanhChinhId * @param actionRequest * @return boolean */ private boolean validationInput(String maDonViHanhChinh, String tenDonViHanhChinh, String DonViHanhChinhId, ActionRequest actionRequest) { if (maDonViHanhChinh.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyMaDanhMucDonViHanhChinh"); } if (tenDonViHanhChinh.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyTenDanhMucDonViHanhChinh"); } // Neu thong tin nhap khac rong if (SessionErrors.isEmpty(actionRequest)) { DonViHanhChinh capDonViHanhChinh = null; try { // Kieam tra theo Ma try { capDonViHanhChinh = DonViHanhChinhLocalServiceUtil.findByMaDVHC(maDonViHanhChinh); } catch (NoSuchDonViHanhChinhException es) { } if (capDonViHanhChinh != null) { if (capDonViHanhChinh.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { return true; } if (DonViHanhChinhId.trim().length() > 0) { if (ConvertUtil.convertToLong(DonViHanhChinhId) != capDonViHanhChinh.getId()) { SessionErrors.add(actionRequest, "exitMaDanhMucDonViHanhChinh"); } } else { SessionErrors.add(actionRequest, "exitMaDanhMucDonViHanhChinh"); } } // Kiem tra theo Ten // try { // capDonViHanhChinh = null; // capDonViHanhChinh = DonViHanhChinhLocalServiceUtil.findByTenDVHC(tenDonViHanhChinh); // } catch (NoSuchDonViHanhChinhException es) { // } // if (capDonViHanhChinh != null) { // if (DonViHanhChinhId.trim().length() > 0) { // if (ConvertUtil.convertToLong(DonViHanhChinhId) != capDonViHanhChinh.getId()) { // SessionErrors.add(actionRequest, "exitTenDanhMucDonViHanhChinh"); // } // } else { // SessionErrors.add(actionRequest, "exitTenDanhMucDonViHanhChinh"); // } // } } catch (Exception es) { } } if (SessionErrors.isEmpty(actionRequest)) { return true; } return false; }
From source file:org.oep.cmon.admin.portlet.action.DichVuCongAction.java
License:Apache License
/** * This is function add DichVuCong/*from ww w.ja v a2s. 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 addDichVuCong(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get the required parameters @SuppressWarnings("unchecked") Map<String, String> userRequest = (Map<String, String>) actionRequest.getPortletSession() .getAttribute("USER_REQUEST_DVC_OBJECT"); if (userRequest == null) { userRequest = new HashMap<String, String>(); } String ma = ParamUtil.getString(actionRequest, "ma"); userRequest.put("ma", ma); String ten = ParamUtil.getString(actionRequest, "ten"); userRequest.put("ten", ten); String groupId = ParamUtil.getString(actionRequest, "groupId"); userRequest.put("groupId", groupId); String coQuanQuanLy = ParamUtil.getString(actionRequest, "coQuanQuanLy"); userRequest.put("coQuanQuanLy", coQuanQuanLy); // Check login name if (Validator.isNull(ma)) { SessionErrors.add(actionRequest, "err.ma"); } // Check full name if (Validator.isNull(ten)) { SessionErrors.add(actionRequest, "err.ten"); } // Check password if (Validator.isNull(groupId)) { SessionErrors.add(actionRequest, "err.groupId"); } // Check email if (Validator.isNull(coQuanQuanLy)) { SessionErrors.add(actionRequest, "err.coQuanQuanLy"); } // Redirect String redirectUrl = ParamUtil.getString(actionRequest, "redirectUrl"); if (!SessionErrors.isEmpty(actionRequest)) { actionResponse.sendRedirect(redirectUrl); return; } // Process the data here String coQuanId = coQuanQuanLy.substring(0, coQuanQuanLy.indexOf("-")); // Insert thu tuc hanh chinh to DB ThuTucHanhChinh thuTuc = new ThuTucHanhChinhClp(); thuTuc.setId(CounterLocalServiceUtil.increment("cmon_thutuchanhchinh")); thuTuc.setMa(ma); thuTuc.setTen(ten); thuTuc.setSoNgayXuLy(10); thuTuc.setTrangThai(1); thuTuc.setPhienBan(1); thuTuc.setNhomThuTucHanhChinhId(Long.parseLong(groupId)); Date currentDate = new Date(); thuTuc.setNgayTao(currentDate); thuTuc.setNgaySua(currentDate); User currentUser = PortalUtil.getUser(actionRequest); if (currentUser != null) { thuTuc.setNguoiTao(currentUser.getFullName()); thuTuc.setNguoiSua(currentUser.getFullName()); } else { // This is for test without logging in thuTuc.setNguoiTao("DUMMY"); thuTuc.setNguoiSua("DUMMY"); } thuTuc.setDaXoa(0); ThuTucHanhChinhLocalServiceUtil.addThuTucHanhChinh(thuTuc); // Assign dich vu to co quan quan ly this.assignDichVuToCoQuanQuanLy(thuTuc.getId(), Long.parseLong(coQuanId), actionRequest); //Redirect userRequest.put("ma", ""); userRequest.put("ten", ""); SessionMessages.add(actionRequest, "success"); actionResponse.sendRedirect(redirectUrl); }
From source file:org.oep.cmon.admin.portlet.action.DichVuCongAction.java
License:Apache License
/** * This is function add DichVuCong Only/* w w w .jav 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 addDichVuCongOnly(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { @SuppressWarnings("unchecked") Map<String, String> userRequest = (Map<String, String>) actionRequest.getPortletSession() .getAttribute("USER_REQUEST_DVC_ONLY_OBJECT"); if (userRequest == null) { userRequest = new HashMap<String, String>(); } String ma = ParamUtil.getString(actionRequest, "ma"); userRequest.put("ma", ma); String ten = ParamUtil.getString(actionRequest, "ten"); userRequest.put("ten", ten); String groupId = ParamUtil.getString(actionRequest, "groupId"); userRequest.put("groupId", groupId); // Check login name if (Validator.isNull(ma)) { SessionErrors.add(actionRequest, "err.ma"); } // Check full name if (Validator.isNull(ten)) { SessionErrors.add(actionRequest, "err.ten"); } // Check password if (Validator.isNull(groupId)) { SessionErrors.add(actionRequest, "err.groupId"); } // Redirect String redirectUrl = ParamUtil.getString(actionRequest, "redirectUrl"); if (!SessionErrors.isEmpty(actionRequest)) { actionResponse.sendRedirect(redirectUrl); return; } // Insert thu tuc hanh chinh to DB ThuTucHanhChinh thuTuc = new ThuTucHanhChinhClp(); thuTuc.setId(CounterLocalServiceUtil.increment("cmon_thutuchanhchinh")); thuTuc.setMa(ma); thuTuc.setTen(ten); thuTuc.setSoNgayXuLy(10); thuTuc.setTrangThai(1); thuTuc.setPhienBan(1); thuTuc.setNhomThuTucHanhChinhId(Long.parseLong(groupId)); Date currentDate = new Date(); thuTuc.setNgayTao(currentDate); thuTuc.setNgaySua(currentDate); User currentUser = PortalUtil.getUser(actionRequest); if (currentUser != null) { thuTuc.setNguoiTao(currentUser.getFullName()); thuTuc.setNguoiSua(currentUser.getFullName()); } else { // This is for test without logging in thuTuc.setNguoiTao("DUMMY"); thuTuc.setNguoiSua("DUMMY"); } thuTuc.setDaXoa(0); ThuTucHanhChinhLocalServiceUtil.addThuTucHanhChinh(thuTuc); //Redirect userRequest.put("ma", ""); userRequest.put("ten", ""); SessionMessages.add(actionRequest, "success"); actionResponse.sendRedirect(redirectUrl); }
From source file:org.oep.cmon.admin.portlet.action.DichVuCongAction.java
License:Apache License
/** * This is function assign to DichVuCong * Version: 1.0//from www . ja va 2s .c o m * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void assignDichVuCong(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { @SuppressWarnings("unchecked") Map<String, String> userRequest = (Map<String, String>) actionRequest.getPortletSession() .getAttribute("USER_REQUEST_DVC_DONVI_OBJECT"); if (userRequest == null) { userRequest = new HashMap<String, String>(); } String ma = ParamUtil.getString(actionRequest, "ma"); userRequest.put("ma", ma); String coQuanQuanLy = ParamUtil.getString(actionRequest, "coQuanQuanLy"); userRequest.put("coQuanQuanLy", coQuanQuanLy); // Check login name if (Validator.isNull(ma)) { SessionErrors.add(actionRequest, "err.ma"); } // Check co quan quan ly if (Validator.isNull(coQuanQuanLy)) { SessionErrors.add(actionRequest, "err.coQuanQuanLy"); } // Redirect String redirectUrl = ParamUtil.getString(actionRequest, "redirectUrl"); if (!SessionErrors.isEmpty(actionRequest)) { actionResponse.sendRedirect(redirectUrl); return; } // Extrach co quan quan ly id String coQuanId = coQuanQuanLy.substring(0, coQuanQuanLy.indexOf("-")); // Split array of dich vu cong String[] maDvcArray = ma.split(","); List<String> errList = new ArrayList<String>(); // Check the existence of dich vu cong for (String maDichVu : maDvcArray) { // Delete the existence relation first ThuTucHanhChinh thuTuc = ThuTucHanhChinhLocalServiceUtil.getThuTucHanhChinhBoiMa(maDichVu); if (thuTuc == null) { errList.add(maDichVu); continue; } // Insert to DB this.assignDichVuToCoQuanQuanLy(thuTuc.getId(), Long.parseLong(coQuanId), actionRequest); } if (errList.size() > 0) { actionRequest.getPortletSession().setAttribute("MA_DICH_VU_ERR", errList); } else { actionRequest.getPortletSession().removeAttribute("MA_DICH_VU_ERR"); } // Redirect SessionMessages.add(actionRequest, "success"); actionResponse.sendRedirect(redirectUrl); }
From source file:org.oep.cmon.admin.portlet.action.GioiTinhAction.java
License:Apache License
/** * This is function validation input//from ww w . j av a2 s . c o m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param maQuocGia * @param tenQuocGia * @param quocGiaId * @param actionRequest * @return boolean */ private boolean validationInput(String maQuocGia, String tenQuocGia, String quocGiaId, ActionRequest actionRequest) { if (maQuocGia.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyMaGioiTinh"); } if (tenQuocGia.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyTenGioiTinh"); } // Neu thong tin nhap khac rong if (SessionErrors.isEmpty(actionRequest)) { GioiTinh quocGia = null; try { // Kieam tra theo Ma try { quocGia = GioiTinhLocalServiceUtil.findByMa(maQuocGia); } catch (NoSuchGioiTinhException es) { } if (quocGia != null) { if (quocGia.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { return true; } if (quocGiaId.trim().length() > 0) { if (ConvertUtil.convertToLong(quocGiaId) != quocGia.getId()) { SessionErrors.add(actionRequest, "exitMaGioiTinh"); } } else { SessionErrors.add(actionRequest, "exitMaGioiTinh"); } } // // Kiem tra theo Ten // try { // quocGia = null; // quocGia = GioiTinhLocalServiceUtil.findByTen(tenQuocGia); // } catch (NoSuchGioiTinhException es) { // } // if (quocGia != null) { // if (quocGiaId.trim().length() > 0) { // if (ConvertUtil.convertToLong(quocGiaId) != quocGia.getId()) { // SessionErrors.add(actionRequest, "exitTenGioiTinh"); // } // } else { // SessionErrors.add(actionRequest, "exitTenGioiTinh"); // } // } } catch (Exception es) { } } if (SessionErrors.isEmpty(actionRequest)) { return true; } return false; }
From source file:org.oep.cmon.admin.portlet.action.HeThongAction.java
License:Apache License
/** * This is function validation input//w w w.ja v a2s . co m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param tenDoiTuongSuDung * @param doiTuongSuDungId * @param maDoiTuongSuDung * @param actionRequest * @return boolean */ private boolean validationInput(String tenDoiTuongSuDung, String doiTuongSuDungId, String maDoiTuongSuDung, ActionRequest actionRequest) { if (maDoiTuongSuDung.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyMaHeThong"); } if (tenDoiTuongSuDung.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyTenHeThong"); } // Neu thong tin nhap khac rong if (SessionErrors.isEmpty(actionRequest)) { HeThong doiTuongSuDung = null; try { // Kiem tra theo Ma try { doiTuongSuDung = null; doiTuongSuDung = HeThongLocalServiceUtil.findTheoMa(maDoiTuongSuDung); } catch (Exception es) { } if (doiTuongSuDung != null) { if (doiTuongSuDung.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { return true; } if (doiTuongSuDungId.trim().length() > 0) { if (ConvertUtil.convertToLong(doiTuongSuDungId) != doiTuongSuDung.getId()) { SessionErrors.add(actionRequest, "exitMaHeThong"); } } else { SessionErrors.add(actionRequest, "exitMaHeThong"); } } // Kiem tra theo Ten // try { // doiTuongSuDung = null; // doiTuongSuDung = HeThongLocalServiceUtil.findTheoTen(tenDoiTuongSuDung); // } catch (Exception es) { // } // if (doiTuongSuDung != null) { // if (doiTuongSuDungId.trim().length() > 0) { // if (ConvertUtil.convertToLong(doiTuongSuDungId) != doiTuongSuDung.getId()) { // SessionErrors.add(actionRequest, "exitTenHeThong"); // } // } else { // SessionErrors.add(actionRequest, "exitTenHeThong"); // } // } } catch (Exception es) { } } if (SessionErrors.isEmpty(actionRequest)) { return true; } return false; }
From source file:org.oep.cmon.admin.portlet.action.HoSoTicHopAction.java
License:Apache License
/** * This is function edit TrangThaiHoSo/* ww w . ja 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 editTrangThaiHoSo(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get parameters from request HashMap<String, String> props = (HashMap<String, String>) actionRequest.getPortletSession() .getAttribute("TRANGTHAIHOSO_REQUEST_OBJ"); if (props == null) { props = new HashMap<String, String>(); } String id = ParamUtil.getString(actionRequest, "id"); String onlineId = ParamUtil.getString(actionRequest, "onlineId"); String maSoHoSo = ParamUtil.getString(actionRequest, "maSoHoSo"); String ngayHenTra = ParamUtil.getString(actionRequest, "ngayHenTra"); String maNguoiXuLyHienTai = ParamUtil.getString(actionRequest, "maNguoiXuLyHienTai"); String tenNguoiXuLyHienTai = ParamUtil.getString(actionRequest, "tenNguoiXuLyHienTai"); String tenPhongBanXuLyHienTai = ParamUtil.getString(actionRequest, "tenPhongBanXuLyHienTai"); String ngayGioLuanChuyen = ParamUtil.getString(actionRequest, "ngayGioLuanChuyen"); String soGioThucHien = ParamUtil.getString(actionRequest, "soGioThucHien"); String maNguoiXuLyKeTiep = ParamUtil.getString(actionRequest, "maNguoiXuLyKeTiep"); String tenNguoiXuLyKeTiep = ParamUtil.getString(actionRequest, "tenNguoiXuLyKeTiep"); String tenPhongBanXuLyKeTiep = ParamUtil.getString(actionRequest, "tenPhongBanXuLyKeTiep"); String soGioYeuCauXuLy = ParamUtil.getString(actionRequest, "soGioYeuCauXuLy"); String noiDungYeuCauXuLy = ParamUtil.getString(actionRequest, "noiDungYeuCauXuLy"); String trangThaiKeTiep = ParamUtil.getString(actionRequest, "trangThaiKeTiep"); String trangThaiHienTai = ParamUtil.getString(actionRequest, "trangThaiHienTai"); String trangThaiXuLy = ParamUtil.getString(actionRequest, "trangThaiXuLy"); props.put("id", id); props.put("onlineId", onlineId); props.put("maSoHoSo", maSoHoSo); props.put("ngayHenTra", ngayHenTra); props.put("maNguoiXuLyHienTai", maNguoiXuLyHienTai); props.put("tenNguoiXuLyHienTai", tenNguoiXuLyHienTai); props.put("tenPhongBanXuLyHienTai", tenPhongBanXuLyHienTai); props.put("ngayGioLuanChuyen", ngayGioLuanChuyen); props.put("soGioThucHien", soGioThucHien); props.put("maNguoiXuLyKeTiep", maNguoiXuLyKeTiep); props.put("tenNguoiXuLyKeTiep", tenNguoiXuLyKeTiep); props.put("tenPhongBanXuLyKeTiep", tenPhongBanXuLyKeTiep); props.put("soGioYeuCauXuLy", soGioYeuCauXuLy); props.put("noiDungYeuCauXuLy", noiDungYeuCauXuLy); props.put("trangThaiKeTiep", trangThaiKeTiep); props.put("trangThaiHienTai", trangThaiHienTai); props.put("trangThaiXuLy", trangThaiXuLy); // Validate parameter if (!Validator.isNumber(onlineId)) { SessionErrors.add(actionRequest, "err.onlineId"); } // Validate ngay gio luan chuyen if (!DateUtil.isDateTime(ngayGioLuanChuyen)) { SessionErrors.add(actionRequest, "err.ngayGioLuanChuyen"); } // Validate so gio thuc hien if (!Validator.isNumber(soGioThucHien)) { SessionErrors.add(actionRequest, "err.soGioThucHien"); } // Validate so gio yeu cau xu ly if (!Validator.isNumber(soGioYeuCauXuLy)) { SessionErrors.add(actionRequest, "err.soGioYeuCauXuLy"); } // Validate trang thai hien tai if (Integer.parseInt(trangThaiHienTai) < 0) { SessionErrors.add(actionRequest, "err.trangThaiHienTai"); } // Validate trang thai ke tiep if (Integer.parseInt(trangThaiKeTiep) < 0) { SessionErrors.add(actionRequest, "err.trangThaiKeTiep"); } // Validate trang thai xu ly if (Integer.parseInt(trangThaiXuLy) < 0) { SessionErrors.add(actionRequest, "err.trangThaiXuLy"); } // Store to session actionRequest.getPortletSession().setAttribute("TRANGTHAIHOSO_REQUEST_OBJ", props); // Redirect String redirectUrl = ParamUtil.getString(actionRequest, "redirectUrl"); if (!SessionErrors.isEmpty(actionRequest)) { actionResponse.sendRedirect(redirectUrl); return; } // Update to DB TrangThaiHoso trangThaiHoSo = TrangThaiHosoLocalServiceUtil.getTrangThaiHoso(Long.parseLong(id)); // Online ID trangThaiHoSo.setOnlineId(Long.parseLong(onlineId)); // Ma so ho so trangThaiHoSo.setMaSoHoSo(maSoHoSo.trim()); // Ngay hen tra trangThaiHoSo.setNgayHenTra(ngayHenTra); // Ma nguoi xu ly hien tai trangThaiHoSo.setMaNguoiXuLyHienTai(maNguoiXuLyHienTai.trim()); // Ten nguoi xu ly hien tai trangThaiHoSo.setTenNguoiXuLyHienTai(tenNguoiXuLyHienTai.trim()); // Ten phong ban xu ly hien tai trangThaiHoSo.setTenPhongBanXuLyHienTai(tenPhongBanXuLyHienTai.trim()); // Trang thai hien tai trangThaiHoSo.setTrangThaiHienTai(Integer.parseInt(trangThaiHienTai)); // Ngay gio luan chuyen trangThaiHoSo.setNgayGioLuanChuyen(ngayGioLuanChuyen); // So gio thuc hien trangThaiHoSo.setSoGioThucHien(Integer.parseInt(soGioThucHien)); // Ma nguoi xu ly ke tiep trangThaiHoSo.setMaNguoiXuLyKeTiep(maNguoiXuLyKeTiep.trim()); // Ten nguoi xu ly ke tiep trangThaiHoSo.setTenNguoiXuLyKeTiep(tenNguoiXuLyKeTiep.trim()); // Ten phong ban xu ly ke tiep trangThaiHoSo.setTenPhongBanXuLyKeTiep(tenPhongBanXuLyKeTiep.trim()); // So gio yeu cau xu ly trangThaiHoSo.setSoGioYeuCauXuLy(Integer.parseInt(soGioYeuCauXuLy)); // Noi dung yeu cau xu ly trangThaiHoSo.setNoiDungYeuCauXuLy(noiDungYeuCauXuLy.trim()); // Trang thai xu ly trangThaiHoSo.setTrangThaiXuLy(Integer.parseInt(trangThaiXuLy)); // Update data to DB TrangThaiHosoLocalServiceUtil.updateTrangThaiHoso(trangThaiHoSo); // Redirect to Success page actionRequest.getPortletSession().removeAttribute("TRANGTHAIHOSO_REQUEST_OBJ"); String successUrl = ParamUtil.getString(actionRequest, "successUrl"); actionResponse.sendRedirect(successUrl); }
From source file:org.oep.cmon.admin.portlet.action.HoSoTicHopAction.java
License:Apache License
/** * This is function edit KetQuaHoSo//from w ww .ja va 2s. co m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void editKetQuaHoSo(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { // Get parameters from request HashMap<String, String> props = (HashMap<String, String>) actionRequest.getPortletSession() .getAttribute("KETQUAHOSO_REQUEST_OBJ"); if (props == null) { props = new HashMap<String, String>(); } String id = ParamUtil.getString(actionRequest, "id"); String maSoHoSo = ParamUtil.getString(actionRequest, "maSoHoSo"); String tenNguoiNhanKetQua = ParamUtil.getString(actionRequest, "tenNguoiNhanKetQua"); String ngayNhanKetQua = ParamUtil.getString(actionRequest, "ngayNhanKetQua"); String lePhiHoSo = ParamUtil.getString(actionRequest, "lePhiHoSo"); String phiXuLyHoSo = ParamUtil.getString(actionRequest, "phiXuLyHoSo"); String ngayHoanThanh = ParamUtil.getString(actionRequest, "ngayHoanThanh"); String maCanBoTraKetQua = ParamUtil.getString(actionRequest, "maCanBoTraKetQua"); String tenCanBoTraKetQua = ParamUtil.getString(actionRequest, "tenCanBoTraKetQua"); String trangThaiXuLy = ParamUtil.getString(actionRequest, "trangThaiXuLy"); // ID props.put("id", id); // Ma so ho so props.put("maSoHoSo", maSoHoSo); // Ten nguoi nhan ket qua props.put("tenNguoiNhanKetQua", tenNguoiNhanKetQua); // Ngay nhan ket qua props.put("ngayNhanKetQua", ngayNhanKetQua); // Le Phi Ho so props.put("lePhiHoSo", lePhiHoSo); // Phi Xu ly ho so props.put("phiXuLyHoSo", phiXuLyHoSo); // Ngay hoan thanh props.put("ngayHoanThanh", ngayHoanThanh); // Ma can bo tra ket qua props.put("maCanBoTraKetQua", maCanBoTraKetQua); // Ten can bo tra ket qua props.put("tenCanBoTraKetQua", tenCanBoTraKetQua); // Trang thai xu ly props.put("trangThaiXuLy", trangThaiXuLy); // Check parameters // Le phi ho so if (!Validator.isNumber(lePhiHoSo)) { SessionErrors.add(actionRequest, "err.lePhiHoSo"); } // Phi xu ly ho so if (!Validator.isNumber(phiXuLyHoSo)) { SessionErrors.add(actionRequest, "err.lePhiHoSo"); } // Validate trang thai xu ly if (Integer.parseInt(trangThaiXuLy) < 0) { SessionErrors.add(actionRequest, "err.trangThaiXuLy"); } String redirectUrl = ParamUtil.getString(actionRequest, "redirectUrl"); if (!SessionErrors.isEmpty(actionRequest)) { actionResponse.sendRedirect(redirectUrl); return; } KetQuaHoso ketQuaHoSo = KetQuaHosoLocalServiceUtil.getKetQuaHoso(Long.parseLong(id)); ketQuaHoSo.setMaSoHoSo(maSoHoSo.trim()); ketQuaHoSo.setTenNguoiNhanKetQua(tenNguoiNhanKetQua.trim()); ketQuaHoSo.setNgayNhanKetQua(ngayNhanKetQua); ketQuaHoSo.setLePhiHoSo(Integer.parseInt(lePhiHoSo)); ketQuaHoSo.setPhiXuLyHoSo(Integer.parseInt(phiXuLyHoSo)); ketQuaHoSo.setNgayHoanThanh(ngayHoanThanh); ketQuaHoSo.setMaCanBoTraKetQua(maCanBoTraKetQua.trim()); ketQuaHoSo.setTenCanBoTraKetQua(tenCanBoTraKetQua.trim()); ketQuaHoSo.setTrangThaiXuLy(Integer.parseInt(trangThaiXuLy)); // Update to DB KetQuaHosoLocalServiceUtil.updateKetQuaHoso(ketQuaHoSo); // Redirect to Success page actionRequest.getPortletSession().removeAttribute("KETQUAHOSO_REQUEST_OBJ"); String successUrl = ParamUtil.getString(actionRequest, "successUrl"); actionResponse.sendRedirect(successUrl); }
From source file:org.oep.cmon.admin.portlet.action.LoaiDoiTuongAction.java
License:Apache License
/** * This is function validation input//from w ww. j ava 2s. c o m * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param tenDoiTuongSuDung * @param doiTuongSuDungId * @param maDoiTuongSuDung * @param actionRequest * @return boolean */ private boolean validationInput(String tenDoiTuongSuDung, String doiTuongSuDungId, String maDoiTuongSuDung, ActionRequest actionRequest) { if (maDoiTuongSuDung.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyMaDoiTuongSuDung"); } if (tenDoiTuongSuDung.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyTenDoiTuongSuDung"); } // Neu thong tin nhap khac rong if (SessionErrors.isEmpty(actionRequest)) { DoiTuongSuDung doiTuongSuDung = null; try { // Kiem tra theo Ma try { doiTuongSuDung = null; doiTuongSuDung = DoiTuongSuDungLocalServiceUtil.findByMa(maDoiTuongSuDung); } catch (Exception es) { } if (doiTuongSuDung != null) { if (doiTuongSuDung.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { return true; } if (doiTuongSuDungId.trim().length() > 0) { if (ConvertUtil.convertToLong(doiTuongSuDungId) != doiTuongSuDung.getId()) { SessionErrors.add(actionRequest, "exitMaDoiTuongSuDung"); } } else { SessionErrors.add(actionRequest, "exitMaDoiTuongSuDung"); } } // Kiem tra theo Ten // try { // doiTuongSuDung = null; // doiTuongSuDung = DoiTuongSuDungLocalServiceUtil.findByTen(tenDoiTuongSuDung); // } catch (Exception es) { // } // if (doiTuongSuDung != null) { // if (doiTuongSuDung.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { // return true; // } // if (doiTuongSuDungId.trim().length() > 0) { // if (ConvertUtil.convertToLong(doiTuongSuDungId) != doiTuongSuDung.getId()) { // SessionErrors.add(actionRequest, "exitTenDoiTuongSuDung"); // } // } else { // SessionErrors.add(actionRequest, "exitTenDoiTuongSuDung"); // } // } } catch (Exception es) { } } if (SessionErrors.isEmpty(actionRequest)) { return true; } return false; }
From source file:org.oep.cmon.admin.portlet.action.QuocGiaAction.java
License:Apache License
/** * This is function validation input// w w w . j a v a 2s . c om * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param maQuocGia * @param tenQuocGia * @param quocGiaId * @param actionRequest * @return boolean */ private boolean validationInput(String maQuocGia, String tenQuocGia, String quocGiaId, ActionRequest actionRequest) { if (maQuocGia.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyMaQuocGia"); } if (tenQuocGia.trim().length() == 0) { SessionErrors.add(actionRequest, "emptyTenQuocGia"); } // Neu thong tin nhap khac rong if (SessionErrors.isEmpty(actionRequest)) { QuocGia quocGia = null; try { // Kieam tra theo Ma try { quocGia = QuocGiaLocalServiceUtil.findByMaQuocGia(maQuocGia); } catch (NoSuchQuocGiaException es) { } if (quocGia != null) { if (quocGia.getDaXoa() == SetParamUtil.DA_XOA_DEACTIVATE) { return true; } if (quocGiaId.trim().length() > 0) { if (ConvertUtil.convertToLong(quocGiaId) != quocGia.getId()) { SessionErrors.add(actionRequest, "exitMaQuocGia"); } } else { SessionErrors.add(actionRequest, "exitMaQuocGia"); } } // Kiem tra theo Ten // try { // quocGia = null; // quocGia = QuocGiaLocalServiceUtil.findByTen(tenQuocGia); // } catch (NoSuchQuocGiaException es) { // } // if (quocGia != null) { // if (quocGiaId.trim().length() > 0) { // if (ConvertUtil.convertToLong(quocGiaId) != quocGia.getId()) { // SessionErrors.add(actionRequest, "exitTenQuocGia"); // } // } else { // SessionErrors.add(actionRequest, "exitTenQuocGia"); // } // } } catch (Exception es) { } } if (SessionErrors.isEmpty(actionRequest)) { return true; } return false; }