List of usage examples for com.liferay.portal.kernel.util FileUtil getBytes
public static byte[] getBytes(InputStream is) throws IOException
From source file:it.smc.calendar.sync.caldav.CalDAVMethodFactory.java
License:Open Source License
public Method create(HttpServletRequest request) throws WebDAVException { String method = request.getMethod(); if (_log.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); sb.append("Serving CalDAV request: "); sb.append(PortalUtil.getCurrentCompleteURL(request)); sb.append(StringPool.RETURN_NEW_LINE); sb.append(method);/*ww w.j ava 2 s.c om*/ sb.append(StringPool.RETURN_NEW_LINE); sb.append("User: "); sb.append(PrincipalThreadLocal.getUserId()); Enumeration<String> headerNames = request.getHeaderNames(); String headerName; while (headerNames.hasMoreElements()) { headerName = headerNames.nextElement(); sb.append(headerName); sb.append(StringPool.COLON); sb.append(StringPool.SPACE); sb.append(request.getHeader(headerName)); sb.append(StringPool.RETURN_NEW_LINE); } _log.debug(sb.toString()); } Method methodImpl = (Method) _methods.get(StringUtil.toUpperCase(method)); if (methodImpl == null) { throw new WebDAVException("Method " + method + " is not implemented"); } try { String content = new String(FileUtil.getBytes(request.getInputStream())); if (Validator.isNotNull(content)) { CalDAVRequestThreadLocal.setRequestContent(content); if (_log.isDebugEnabled()) { String formattedContent = content; if (CalDAVUtil.isRequestContentXML(request)) { Document document = CalDAVRequestThreadLocal.getRequestDocument(); formattedContent = document.formattedString(StringPool.FOUR_SPACES); } _log.debug("Request content: \n" + formattedContent); } } } catch (Exception e) { _log.error(e, e); } return methodImpl; }
From source file:m.omarh.liferay.resources.importer.generator.util.tree.DocumentUtil.java
License:Open Source License
public static Object getDLFileContent(ThemeDisplay themeDisplay, String uuid) { JSONObject htmlJSONObject = JSONFactoryUtil.createJSONObject(); try {// w ww .j av a2 s.co m DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(uuid, themeDisplay.getScopeGroupId()); String content = new String(FileUtil.getBytes(dlFileEntry.getContentStream())); htmlJSONObject.put("content", content); } catch (PortalException e) { _log.error(e.getMessage()); } catch (SystemException e) { _log.error(e.getMessage()); } catch (IOException e) { _log.error(e.getMessage()); } return htmlJSONObject; }
From source file:m.omarh.liferay.resources.importer.generator.util.tree.DocumentUtil.java
License:Open Source License
public static byte[] getDLFileBytes(ThemeDisplay themeDisplay, String uuid) { byte[] bytes = null; try {// w w w. j av a 2 s . c o m DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(uuid, themeDisplay.getScopeGroupId()); bytes = FileUtil.getBytes(dlFileEntry.getContentStream()); } catch (PortalException e) { _log.error(e.getMessage()); } catch (SystemException e) { _log.error(e.getMessage()); } catch (IOException e) { _log.error(e.getMessage()); } return bytes; }
From source file:m.omarh.liferay.resources.importer.generator.util.tree.DocumentUtil.java
License:Open Source License
public static byte[] getDLFileBytes(long groupId, String uuid) { byte[] bytes = null; try {/*from ww w. ja va2s .com*/ DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(uuid, groupId); bytes = FileUtil.getBytes(dlFileEntry.getContentStream()); } catch (PortalException e) { _log.error(e.getMessage()); } catch (SystemException e) { _log.error(e.getMessage()); } catch (IOException e) { _log.error(e.getMessage()); } return bytes; }
From source file:ma.omarh.liferay.portlet.assetpublisher.action.ViewAction.java
License:Open Source License
@SuppressWarnings("serial") private void addDefaultADT(RenderRequest renderRequest) throws PortalException, SystemException, ReadOnlyException, ValidatorException, IOException { if (ADTThreadLocal.isImported()) { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); long classNameId = ClassNameLocalServiceUtil.getClassNameId(AssetEntry.class); long scopeGroupId = themeDisplay.getScopeGroupId(); // adding adt template DDMTemplate ddmTemplate = null;/*from w ww. j av a 2s.co m*/ try { ddmTemplate = DDMTemplateLocalServiceUtil.getTemplate(scopeGroupId, classNameId, DEFAULT_TEMPLATE_KEY); } catch (NoSuchTemplateException nste) { ServiceContext serviceContext = ServiceContextFactory.getInstance(DDMTemplate.class.getName(), renderRequest); Map<Locale, String> nameMap = new HashMap<Locale, String>() { { put(LocaleUtil.getSiteDefault(), "Infinite Scroll Template"); } }; Map<Locale, String> descriptionMap = new HashMap<Locale, String>() { { put(LocaleUtil.getSiteDefault(), "Infinite Scroll Template"); } }; ; InputStream inputStream = getClass() .getResourceAsStream("dependencies/infinitescroll-assetpublisher-sample.ftl"); String script = new String(FileUtil.getBytes(inputStream)); ddmTemplate = DDMTemplateLocalServiceUtil.addTemplate(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), classNameId, 0, DEFAULT_TEMPLATE_KEY, nameMap, descriptionMap, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, StringPool.BLANK, "ftl", script, false, false, StringPool.BLANK, null, serviceContext); PortletPreferences portletPreferences = renderRequest.getPreferences(); portletPreferences.setValue("displayStyle", String.valueOf(PortletDisplayTemplate.DISPLAY_STYLE_PREFIX + ddmTemplate.getUuid())); portletPreferences.store(); ADTThreadLocal.setImported(true); } } }
From source file:org.oep.cmon.portlet.cmon.TiepNhanHoSoPortlet.java
License:Apache License
/** * This is function call WebService upload and get NoiLuuTru * Version: 1.0/* ww w .j a va2 s . c o m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param service * @param fileToUpload * @param maUngDung * @param hoSoId * @param liferayUserId * @param tenGiayTo * @throws IOException * @throws SystemException */ private long _callWebServiceUploadAndGetNoiLuuTruId(IOfficerService service, File fileToUpload, String maUngDung, long hoSoId, long liferayUserId, String tenGiayTo) throws IOException, SystemException { GiayToDinhKem result = service.upload(maUngDung, 0, hoSoId, liferayUserId, tenGiayTo, tenGiayTo, FileUtil.getBytes(fileToUpload), fileToUpload.getName()); if (result == null || !result.isResult()) { throw new SystemException("LOI KHI GOI WEB SERVICE UPLOAD FILE" + "<br>MA LOI:" + result.getCode() + "<br>_____UPLOAD PARAMETERS_____" + "<br>maUngDung:" + maUngDung + "<br>type:" + 0 + "<br>hoSoId:" + hoSoId + "<br>liferayUserId:" + liferayUserId + "<br>tenGiayTo:" + tenGiayTo + "<br>Byte length:" + FileUtil.getBytes(fileToUpload).length + "<br>File name:" + fileToUpload.getName()); } return result.getId(); }
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 2s .com * * 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.ipmslist.action.IPMSListPortlet.java
License:Apache License
/** * This is function dungXuLyHoSo/*from w w w.j a v a 2 s. c o m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void dungXuLyHoSo(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String ykiencanbo = ""; String idHoSo = ""; HoSoTTHCCong hoso = null; String fileName = ""; UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); idHoSo = uploadRequest.getParameter("idHoSoTTHCC"); fileName = uploadRequest.getFileName("upLoadDungXuLy"); if (!idHoSo.isEmpty()) { hoso = HoSoTTHCCongLocalServiceUtil.fetchHoSoTTHCCong(Long.valueOf(idHoSo).intValue()); if (hoso != null) { hoso.setDungXuLy(true); hoso.setTrangThaiHoSo(Constants.TRANGTHAIHOSO.HO_SO_DA_XU_LY_XONG); hoso.setNgaySua(new Date()); HoSoTTHCCongLocalServiceUtil.updateHoSoTTHCCong(hoso); // dung xu ly UE HoSoBusinessUtil.dungXuLyHoSo(hoso, PortalUtil.getUser(actionRequest).getEmailAddress()); } } // urlQuaylai = ParamUtil.getString(actionRequest, "urlQuayLai"); ykiencanbo = uploadRequest.getParameter("ykiencanbo"); String contentType = actionRequest.getContentType(); GiayToDinhKem resulUpload = null; byte dataBytes[] = null; if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { dataBytes = FileUtil.getBytes(uploadRequest.getFileAsStream("upLoadDungXuLy")); if (dataBytes != null) { resulUpload = WebserviceFactory.getOfficerService().upload( getMaUngDung(hoso.getThuTucHanhChinhId()), 1, null, PortalUtil.getUserId(uploadRequest), fileName, "Hoan tat dung xu ly", dataBytes, fileName); } } // Get y kien trao doi YKienTraoDoi yKienTraoDoi = new YKienTraoDoiClp(); yKienTraoDoi.setId(CounterLocalServiceUtil.increment(YKienTraoDoi.class.getName())); yKienTraoDoi.setHoSoTTHCCongId(hoso.getId()); yKienTraoDoi.setNoiDungYKien(ykiencanbo); yKienTraoDoi.setThoiGianGuiYKien(new Date()); yKienTraoDoi.setTieuDe("Dung xu ly ho so"); if (resulUpload != null) yKienTraoDoi.setNoiLuuTruId(resulUpload.getId()); yKienTraoDoi.setLoai(Constants.LOAI_Y_KIEN_TRAO_DOI.LOAI_DUNG_XU_LY_HO_SO); // get tai khoan cong dan nop ho so if (PortalUtil.getUser(actionRequest) != null) { TaiKhoanNguoiDung taikhoan = TaiKhoanNguoiDungLocalServiceUtil .findByTaiKhoanNguoiDungId(PortalUtil.getUser(actionRequest).getUserId()); if (taikhoan != null) { yKienTraoDoi.setNguoiGuiId(taikhoan.getId()); } } CongChuc congChuc = CongChucLocalServiceUtil.getCongChuc(hoso.getCanBoTiepNhanId()); TaiKhoanNguoiDung taiKhoanNguoiDungCD = TaiKhoanNguoiDungLocalServiceUtil .fetchTaiKhoanNguoiDung(congChuc.getTaiKhoanNguoiDungId()); yKienTraoDoi.setNguoiNhanId(taiKhoanNguoiDungCD.getId()); yKienTraoDoi.setChaiId(null); //yKienTraoDoi.setNguoiNhanId(hoso.getCongDanNopId());//Dung trong du lieu that // yKienTraoDoi.setChaiId(null); // y kien chua doc yKienTraoDoi.setTrangThai(0); // Add y kien dung xu li YKienTraoDoiLocalServiceUtil.addYKienTraoDoi(yKienTraoDoi); // Add giay to dinh kem ho so /* FileDinhKem giayToDinhKem = new FileDinhKemClp(); // vn.dtt.cmon.dao.hosohcc.FileDinhKem giayToDinhKem.setId(CounterLocalServiceUtil .increment(FileDinhKem.class.getName())); giayToDinhKem.setHoSoTTHCCongId(Long.valueOf(idHoSo)); giayToDinhKem.setSoBanGiay(1L); if (PortalUtil.getUser(actionRequest) != null) giayToDinhKem.setCanBoId(Long.valueOf(PortalUtil .getUserId(actionRequest))); giayToDinhKem .setTrangThaiHoSoTaiThoiDiemDinhKem(Constants.TRANGTHAIHOSO.HO_SO_DA_XU_LY_XONG); if (resulUpload.getNoiLuuTruId() != 0) giayToDinhKem.setNoiLuuTruTaiLieuId(Long.valueOf(resulUpload .getId())); if (PortalUtil.getUser(actionRequest) != null) giayToDinhKem.setNguoiUpload(String.valueOf(PortalUtil .getUserId(actionRequest))); giayToDinhKem.setNgayUpload(new Date()); FileDinhKemLocalServiceUtil.addFileDinhKem(giayToDinhKem);*/ // } }
From source file:org.oep.cmon.portlet.ipmslist.action.IPMSListPortlet.java
License:Apache License
/** * This is function tuChoiHoSoSaveToDB/* w w w . jav a 2 s . c o m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse */ public void tuChoiHoSoSaveToDB(ActionRequest actionRequest, ActionResponse actionResponse) { try { UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); long hoSoTTHCCongId = ConvertUtil.convertToLong(ParamUtil.getString(uploadRequest, "hoSoTTHCCongId")); String yKien = ParamUtil.getString(uploadRequest, "yKien"); String filename = uploadRequest.getFileName("vanbantuchoi"); HoSoTTHCCong hoSoTTHCC = HoSoTTHCCongLocalServiceUtil.getHoSoTTHCCong(hoSoTTHCCongId); String nguoiGuiId = ParamUtil.getString(actionRequest, "nguoiGuiId"); // get binary data String contentType = actionRequest.getContentType(); if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { byte dataBytes[] = FileUtil.getBytes(uploadRequest.getFileAsStream("vanbantuchoi")); GiayToDinhKem resulUpload = WebserviceFactory.getOfficerService().upload( getMaUngDung(hoSoTTHCC.getThuTucHanhChinhId()), 1, null, PortalUtil.getUserId(uploadRequest), filename, "upload van ban tu choi", dataBytes, filename); // add new record to the table "ThongTinThanhToan" YKienTraoDoi yKienTraoDoi = new YKienTraoDoiClp(); yKienTraoDoi.setId(CounterLocalServiceUtil.increment("vn.dtt.cmon.dao.hosohcc.model.YKienTraoDoi")); yKienTraoDoi.setHoSoTTHCCongId(hoSoTTHCCongId); yKienTraoDoi.setTieuDe("Tu choi ho so"); yKienTraoDoi.setNoiDungYKien(yKien); yKienTraoDoi.setThoiGianGuiYKien(new Date()); long noiLuuTruId = resulUpload.getNoiLuuTruId(); if (noiLuuTruId == 0) { yKienTraoDoi.setNoiLuuTruId(null); } else { yKienTraoDoi.setNoiLuuTruId(resulUpload.getNoiLuuTruId()); } yKienTraoDoi.setNoiLuuTruId(resulUpload.getNoiLuuTruId()); yKienTraoDoi.setLoai(3); yKienTraoDoi.setNguoiGuiId(FormatUtil.convertToLong(nguoiGuiId)); if (hoSoTTHCC.getCongDanNopId() != null && hoSoTTHCC.getCongDanNopId() > 0) { CongDan congDan = CongDanLocalServiceUtil.fetchCongDan(hoSoTTHCC.getCongDanNopId()); TaiKhoanNguoiDung taiKhoanNguoiDungCD = TaiKhoanNguoiDungLocalServiceUtil .fetchTaiKhoanNguoiDung(congDan.getTaiKhoanNguoiDungId()); // +taiKhoanNguoiDung.toString() ); if (taiKhoanNguoiDungCD != null) { yKienTraoDoi.setNguoiNhanId(taiKhoanNguoiDungCD.getId()); } } yKienTraoDoi.setChaiId(null); yKienTraoDoi.setTrangThai(1); YKienTraoDoiLocalServiceUtil.addYKienTraoDoi(yKienTraoDoi); // response data } else { SessionErrors.add(actionRequest, "errorUpdateTTTK"); } } catch (Exception e) { e.printStackTrace(); // SessionErrors.add(actionRequest, "errorUpdateTTTK"); } }
From source file:org.oep.cmon.portlet.ipmslist.action.IPMSListPortlet.java
License:Apache License
/** * This is function boSungHoSoSaveToDB/*ww w . j a va 2 s.c o m*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @param PortalException * @param SystemException * @param IOException */ public void boSungHoSoSaveToDB(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException, IOException { UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); long hoSoTTHCCongId = ParamUtil.getLong(actionRequest, "hoSoTTHCCongId"); String yKien = ParamUtil.getString(uploadRequest, "yKien1"); String nguoiGuiId = ParamUtil.getString(actionRequest, "nguoiGuiId"); String filename = uploadRequest.getFileName("vanbanbosung"); HoSoTTHCCong hoSoTTHCC = HoSoTTHCCongLocalServiceUtil.getHoSoTTHCCong(hoSoTTHCCongId); // get binary data String contentType = actionRequest.getContentType(); if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { byte dataBytes[] = FileUtil.getBytes(uploadRequest.getFileAsStream("vanbanbosung")); GiayToDinhKem resulUpload = null; if (dataBytes != null) { resulUpload = WebserviceFactory.getOfficerService().upload( getMaUngDung(hoSoTTHCC.getThuTucHanhChinhId()), 1, null, PortalUtil.getUserId(uploadRequest), filename, "upload van ban yeu cau bo sung", dataBytes, filename); } // add new record to the table "ThongTinThanhToan" YKienTraoDoi yKienTraoDoi = new YKienTraoDoiClp(); yKienTraoDoi.setId(CounterLocalServiceUtil.increment(YKienTraoDoiImpl.class.getName())); yKienTraoDoi.setHoSoTTHCCongId(hoSoTTHCCongId); yKienTraoDoi.setTieuDe("Yu cu b sung"); yKienTraoDoi.setNoiDungYKien(yKien); yKienTraoDoi.setThoiGianGuiYKien(new Date()); long noiLuuTruId = 0; if (resulUpload != null) { noiLuuTruId = resulUpload.getNoiLuuTruId(); } if (noiLuuTruId == 0) { yKienTraoDoi.setNoiLuuTruId(null); } else { yKienTraoDoi.setNoiLuuTruId(resulUpload.getNoiLuuTruId()); } // loai bo sung ho so yKienTraoDoi.setLoai(2); yKienTraoDoi.setNguoiGuiId(FormatUtil.convertToLong(nguoiGuiId)); // if (hoSoTTHCC.getCongDanNopId() != null // && hoSoTTHCC.getCongDanNopId() > 0) { // // CongDan congDan = CongDanLocalServiceUtil // .fetchCongDan(hoSoTTHCC.getCongDanNopId()); // // TaiKhoanNguoiDung taiKhoanNguoiDungCD = null; // if (congDan != null && congDan.getTaiKhoanNguoiDungId() != null) { // taiKhoanNguoiDungCD = TaiKhoanNguoiDungLocalServiceUtil // .fetchTaiKhoanNguoiDung(congDan // .getTaiKhoanNguoiDungId()); // } // // if (taiKhoanNguoiDungCD != null) { // yKienTraoDoi // .setNguoiNhanId(taiKhoanNguoiDungCD.getId()); // } else { CongChuc congChuc = CongChucLocalServiceUtil.getCongChuc(hoSoTTHCC.getCanBoTiepNhanId()); TaiKhoanNguoiDung taiKhoanNguoiDungCD = TaiKhoanNguoiDungLocalServiceUtil .fetchTaiKhoanNguoiDung(congChuc.getTaiKhoanNguoiDungId()); yKienTraoDoi.setNguoiNhanId(taiKhoanNguoiDungCD.getId()); // } // } yKienTraoDoi.setChaiId(null); // not read yet yKienTraoDoi.setTrangThai(0); YKienTraoDoiLocalServiceUtil.addYKienTraoDoi(yKienTraoDoi); // response data } else { SessionErrors.add(actionRequest, "errorUpdateTTTK"); } }