List of usage examples for com.liferay.portal.kernel.util ParamUtil getIntegerValues
public static int[] getIntegerValues(ServiceContext serviceContext, String param)
From source file:com.liferay.calendar.portlet.CalendarPortlet.java
License:Open Source License
protected void serveCalendarBookings(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] calendarIds = ParamUtil.getLongValues(resourceRequest, "calendarIds"); long endTime = ParamUtil.getLong(resourceRequest, "endTime"); long startTime = ParamUtil.getLong(resourceRequest, "startTime"); int[] statuses = ParamUtil.getIntegerValues(resourceRequest, "statuses"); List<CalendarBooking> calendarBookings = CalendarBookingServiceUtil.search(themeDisplay.getCompanyId(), new long[0], calendarIds, new long[0], -1, null, startTime, endTime, true, statuses, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); JSONArray jsonArray = CalendarUtil.toCalendarBookingsJSONArray(themeDisplay, calendarBookings, getTimeZone(resourceRequest)); writeJSON(resourceRequest, resourceResponse, jsonArray); }
From source file:com.liferay.calendar.web.internal.portlet.CalendarPortlet.java
License:Open Source License
protected void serveCalendarBookings(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] calendarIds = ParamUtil.getLongValues(resourceRequest, "calendarIds"); java.util.Calendar endTimeJCalendar = getJCalendar(resourceRequest, "endTime"); java.util.Calendar startTimeJCalendar = getJCalendar(resourceRequest, "startTime"); int[] statuses = ParamUtil.getIntegerValues(resourceRequest, "statuses"); List<CalendarBooking> calendarBookings = Collections.<CalendarBooking>emptyList(); if (!ArrayUtil.isEmpty(calendarIds)) { calendarBookings = _calendarBookingService.search(themeDisplay.getCompanyId(), new long[0], calendarIds, new long[0], -1, null, startTimeJCalendar.getTimeInMillis(), endTimeJCalendar.getTimeInMillis(), true, statuses, QueryUtil.ALL_POS, QueryUtil.ALL_POS, new CalendarBookingStartTimeComparator(true)); int eventsPerPage = ParamUtil.getInteger(resourceRequest, "eventsPerPage"); if ((eventsPerPage > 0) && (eventsPerPage < calendarBookings.size())) { calendarBookings = calendarBookings.subList(0, eventsPerPage); }/*from www . j a v a 2 s . c o m*/ } JSONArray jsonArray = CalendarUtil.toCalendarBookingsJSONArray(themeDisplay, calendarBookings, getTimeZone(resourceRequest)); writeJSON(resourceRequest, resourceResponse, jsonArray); }
From source file:org.oep.cmon.portlet.cmon.TiepNhanHoSoPortlet.java
License:Apache License
/** * This is function upload file/*from ww w .j av a 2s .c o m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param request * @param hoSoId * @param trangThaiHoSo * @param maUngDung * @throws SystemException * @throws IOException * @throws PortalException */ protected void _upload(UploadPortletRequest request, long hoSoId, int trangThaiHoSo, String maUngDung) throws SystemException, IOException, PortalException { String email = PortalUtil.getUser(request).getEmailAddress(); Date now = DateTimeUtil.getDateTimeNow(); long canBoTiepNhanId = ParamUtil.getLong(request, HoSoFields.canBoTiepNhanId), liferayUserId = PortalUtil.getUserId(request), fileDinhKemId = 0L, noiLuuTruId = 0L; File[] files = request.getFiles(HoSoFields.fileGiayToQuyDinh); File fileToUpload = null; String[] tenGiayTos = ParamUtil.getParameterValues(request, HoSoFields.tenGiayToQuyDinh); String tenGiayTo; long[] loaiGiayToIds = ParamUtil.getLongValues(request, HoSoFields.loaiGiayToId), tt2gtIds = ParamUtil.getLongValues(request, HoSoFields.thuTuc2GiayToId), fileDinhKemIds = ParamUtil.getLongValues(request, HoSoFields.fileDinhKemId), laBanChinhs = ParamUtil.getLongValues(request, HoSoFields.banChinhGiayToQuyDinh); int[] daNhans = ParamUtil.getIntegerValues(request, HoSoFields.daNhan); FileDinhKem fileDinhKem = null; IOfficerService service = new OfficerServiceImpl(); IsUploaded uploadValidator = new IsUploaded(); boolean // Da check vao checkbox "Da nhan" daNhan // La lan` dau` tien nhan thanh` phan` ho` so , laLanDauTienNhanThanhPhanHoSo // Da upload file , daUploadFile; long thuTuc2GiayToId; for (int i = 0; i < tt2gtIds.length; ++i) { fileToUpload = Helper.fileFromArray(files, i); fileDinhKemId = Helper.numberFromArray(fileDinhKemIds, i); daNhan = Helper.inArray(daNhans, i); laLanDauTienNhanThanhPhanHoSo = ((fileDinhKemId == 0L) && daNhan); daUploadFile = uploadValidator.isValid(fileToUpload); thuTuc2GiayToId = tt2gtIds[i]; tenGiayTo = Helper.stringFromArray(tenGiayTos, i); if (laLanDauTienNhanThanhPhanHoSo) { fileDinhKem = new FileDinhKemClp(); fileDinhKem.setId(CounterLocalServiceUtil.increment(FormOfflineBusiness.FILE_UPLOAD_SEQUENCE)); fileDinhKem.setSoBanGiay(1); fileDinhKem.setBanChinh(Helper.inArray(laBanChinhs, i) ? 1L : 0L); fileDinhKem.setDaDoiChieu(1); fileDinhKem.setCanBoId(canBoTiepNhanId); fileDinhKem.setDanhMucGiayToId(Helper.numberFromArray(loaiGiayToIds, i)); fileDinhKem.setThuTuc2GiayToId(thuTuc2GiayToId); fileDinhKem.setHoSoTTHCCongId(hoSoId); fileDinhKem.setTrangThaiHoSoTaiThoiDiemDinhKem(trangThaiHoSo); fileDinhKem.setNgayUpload(now); fileDinhKem.setNguoiUpload(email); fileDinhKem.setXoa(Constants.ACTIVE); fileDinhKem.setNguoiSua(email); fileDinhKem.setNgaySua(now); // Da upload file thi setNoiLuuTruTaiLieu if (daUploadFile) { noiLuuTruId = _callWebServiceUploadAndGetNoiLuuTruId(service, fileToUpload, maUngDung, hoSoId, liferayUserId, tenGiayTo); fileDinhKem.setNoiLuuTruTaiLieuId(noiLuuTruId); } FileDinhKemLocalServiceUtil.addFileDinhKem(fileDinhKem); } else { // Neu uncheck da nhan thi xoa record FileDinhKem tuong ung va cac version cua no' // Ve nghiep vu thi co nghia la can bo chua nhan tai lieu nay if (!daNhan) { List<FileDinhKem> list = FileDinhKemLocalServiceUtil.getDSGiayToByHoSoAndThuTuc2GiayTo(hoSoId, thuTuc2GiayToId); for (FileDinhKem toBeDeleted : list) { toBeDeleted.setXoa(Constants.INACTIVE); toBeDeleted.setNgaySua(now); toBeDeleted.setNguoiSua(email); FileDinhKemLocalServiceUtil.updateFileDinhKem(toBeDeleted); } } else { fileDinhKem = FileDinhKemLocalServiceUtil.fetchFileDinhKem(fileDinhKemId); // Truong hop da upload file luc tiep nhan va khi bo sung van~ upload file tiep' // thi se tao moi record, ko ghi de`, de? giu~ lai version file da~ upload tu` truoc' if ((fileDinhKem.getNoiLuuTruTaiLieuId() != null) && daUploadFile) { fileDinhKem = new FileDinhKemClp(); fileDinhKem .setId(CounterLocalServiceUtil.increment(FormOfflineBusiness.FILE_UPLOAD_SEQUENCE)); fileDinhKem.setSoBanGiay(1); fileDinhKem.setDaDoiChieu(1); fileDinhKem.setCanBoId(canBoTiepNhanId); fileDinhKem.setDanhMucGiayToId(Helper.numberFromArray(loaiGiayToIds, i)); fileDinhKem.setThuTuc2GiayToId(thuTuc2GiayToId); fileDinhKem.setHoSoTTHCCongId(hoSoId); fileDinhKem.setTrangThaiHoSoTaiThoiDiemDinhKem(trangThaiHoSo); fileDinhKem.setXoa(Constants.ACTIVE); } if (daUploadFile) { noiLuuTruId = _callWebServiceUploadAndGetNoiLuuTruId(service, fileToUpload, maUngDung, hoSoId, liferayUserId, tenGiayTo); fileDinhKem.setNoiLuuTruTaiLieuId(noiLuuTruId); } fileDinhKem.setBanChinh(Helper.inArray(laBanChinhs, i) ? 1L : 0L); fileDinhKem.setNguoiSua(email); fileDinhKem.setNgaySua(now); fileDinhKem.setNguoiUpload(email); fileDinhKem.setNgayUpload(now); FileDinhKemLocalServiceUtil.updateFileDinhKem(fileDinhKem); } } } }
From source file:org.oep.cmon.portlet.ipmslist.business.TraKetQuaXuLy.java
License:Apache License
/** * This is contructor/*from w w w.ja v a2 s.co m*/ * Call on Controller when form is post * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param request * @param ok * @throws SystemException * @throws PortalException * @throws NumberFormatException */ public TraKetQuaXuLy(ActionRequest request, boolean ok) throws NumberFormatException, PortalException, SystemException { this._request = request; try { _hoso = HoSoTTHCCUtil.getHoSo(request); _giaytoketqua = DanhMucGiayToLocalServiceUtil .findGiayToKetQua(_hoso.getThuTucHanhChinhId().longValue()); _giaytonopbangchinh = DanhMucGiayToLocalServiceUtil.finlistGiayToBCNopDon(_hoso.getId()); } catch (Exception e) { e.printStackTrace(); } if (_giaytoketqua != null) { if (_giaytoketqua.size() > 0) { _istraketqua = new ArrayList<Boolean>(); for (int i = 0; i < _giaytoketqua.size(); i++) { _istraketqua.add(false); } _numbertraketqua = new ArrayList<Integer>(); for (int i = 0; i < _giaytoketqua.size(); i++) { _numbertraketqua.add(1); } } } if (_giaytonopbangchinh != null) { if (_giaytonopbangchinh.size() > 0) { _istragiayto = new ArrayList<Boolean>(); for (int i = 0; i < _giaytonopbangchinh.size(); i++) { _istragiayto.add(false); } } } long[] checkTraKetQuaPost = ParamUtil.getLongValues(request, "checkGTKQ"); long[] checkGTNopPost = ParamUtil.getLongValues(request, "checkGTNop"); int[] sobanPost = ParamUtil.getIntegerValues(request, "soban"); _checkTraKetQuaPost = checkTraKetQuaPost; _checkDonPost = checkGTNopPost; _sobangPost = sobanPost; List<Integer> listIndexCheckTrakq = getIndexCheckKetQua(); setListCheckKq(listIndexCheckTrakq); List<Integer> listIndexCheckGTNop = getIndexCheckGTNop(); setListCheckGTNop(listIndexCheckGTNop); setSoBangPost(sobanPost); if (Validator.isNotNull(PortalUtil.getUser(request))) _canbologin = PortalUtil.getUser(request); // set value for tinh,huyen when post data _tinhId = ParamUtil.getString(request, "tinhId"); _huyenId = ParamUtil.getString(request, "huyenId"); }