protected String getStatusMessageKey() { if (Validator.isNotNull(_messageKey)) { return _messageKey; } _messageKey = StringPool.BLANK; if (hasRemoteMessage()) { _messageKey = "please-wait-as-the-publication-processes-on-the-remote-site"; } else if (hasStagedModelMessage()) { _messageKey = "exporting"; if (Objects.equals(_cmd, Constants.IMPORT)) { _messageKey = "importing"; } else if (Objects.equals(_cmd, Constants.PUBLISH_TO_LIVE) || Objects.equals(_cmd, Constants.PUBLISH_TO_REMOTE)) { _messageKey = "publishing"; } } return _messageKey; }
/** * Returns the first dict item group in the ordered set where groupId = ? and dictGroupId = ?. * * @param groupId the group ID * @param dictGroupId the dict group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict item group * @throws NoSuchDictItemGroupException if a matching dict item group could not be found */ @Override public DictItemGroup findByF_dictGroupId_First(long groupId, long dictGroupId, OrderByComparator<DictItemGroup> orderByComparator) throws NoSuchDictItemGroupException { DictItemGroup dictItemGroup = fetchByF_dictGroupId_First(groupId, dictGroupId, orderByComparator); if (dictItemGroup != null) { return dictItemGroup; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", dictGroupId="); msg.append(dictGroupId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemGroupException(msg.toString()); }
/** * Returns the first dict item group in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict item group * @throws NoSuchDictItemGroupException if a matching dict item group could not be found */ @Override public DictItemGroup findByUuid_C_First(String uuid, long companyId, OrderByComparator<DictItemGroup> orderByComparator) throws NoSuchDictItemGroupException { DictItemGroup dictItemGroup = fetchByUuid_C_First(uuid, companyId, orderByComparator); if (dictItemGroup != null) { return dictItemGroup; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", companyId="); msg.append(companyId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemGroupException(msg.toString()); }
/** * This action saves the Liferay facet configuration for a given tab * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG) public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException { String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK); String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK); String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); PortletPreferences preferences = request.getPreferences(); FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences); SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration); if(targetFacet != null) { JSONObject facetConfiguration = targetFacet.getJSONData(request); targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration); this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences); SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); response.sendRedirect(redirectUrl); } }
/** * Returns the first voting result in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching voting result * @throws NoSuchVotingResultException if a matching voting result could not be found */ @Override public VotingResult findByUuid_First(String uuid, OrderByComparator<VotingResult> orderByComparator) throws NoSuchVotingResultException { VotingResult votingResult = fetchByUuid_First(uuid, orderByComparator); if (votingResult != null) { return votingResult; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchVotingResultException(msg.toString()); }
/** * Returns the last dict collection in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching dict collection * @throws NoSuchDictCollectionException if a matching dict collection could not be found */ @Override public DictCollection findByF_dictCollectionByGroup_Last(long groupId, OrderByComparator<DictCollection> orderByComparator) throws NoSuchDictCollectionException { DictCollection dictCollection = fetchByF_dictCollectionByGroup_Last(groupId, orderByComparator); if (dictCollection != null) { return dictCollection; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictCollectionException(msg.toString()); }
/** * @param jrxmlTemplate * @param jsonData * @param parameters * @param outputDestination * @param exportName * @return */ public static String createReportPDFFile(String jrxmlTemplate, String jsonData, Map<String, Object> parameters, String outputDestination, String exportName) { String sourceFileName = outputDestination + exportName; try { // fix json enter char jsonData = quoteHTML(jsonData); JasperReport reportTemplate = JRReportTemplate.getJasperReport(jrxmlTemplate); JRJSONDataSource dataSource = JRJSONDataSource.getInstance(jsonData); JasperPrint jasperPrint = getJasperPrint(reportTemplate, parameters, dataSource); return exportPdfFile(jasperPrint, sourceFileName); } catch (Exception e) { _log.error(e); return StringPool.BLANK; } }
/** * Returns the first dict item in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict item * @throws NoSuchDictItemException if a matching dict item could not be found */ @Override public DictItem findByUuid_First(String uuid, OrderByComparator<DictItem> orderByComparator) throws NoSuchDictItemException { DictItem dictItem = fetchByUuid_First(uuid, orderByComparator); if (dictItem != null) { return dictItem; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemException(msg.toString()); }
/** * @param dossierPartId * @param contentType * @return * @throws PortalException */ public String getContent(long dossierPartId, int contentType) throws PortalException { DossierPart object = dossierPartPersistence.fetchByPrimaryKey(dossierPartId); String content = StringPool.BLANK; if (contentType == 1) { content = object.getFormScript(); } if (contentType == 2) { content = object.getFormReport(); } if (contentType == 3) { content = object.getSampleData(); } return content; }
@Override protected Document doGetDocument(DictGroup dictGroup) throws Exception { Document document = getBaseModelDocument(CLASS_NAME, dictGroup); document.addKeywordSortable(Field.COMPANY_ID, String.valueOf(dictGroup.getCompanyId())); document.addDateSortable(Field.MODIFIED_DATE, dictGroup.getModifiedDate()); document.addKeywordSortable(Field.USER_ID, String.valueOf(dictGroup.getUserId())); document.addKeywordSortable(Field.USER_NAME, String.valueOf(dictGroup.getUserName())); document.addNumberSortable(DictGroupTerm.GROUP_ID, dictGroup.getGroupId()); document.addNumberSortable(DictGroupTerm.DICT_GROUPID, dictGroup.getDictGroupId()); document.addNumberSortable(DictGroupTerm.DICT_COLLECTIONID, dictGroup.getDictCollectionId()); document.addTextSortable(DictGroupTerm.GROUP_CODE, dictGroup.getGroupCode()); document.addTextSortable(DictGroupTerm.GROUP_NAME, dictGroup.getGroupName()); document.addTextSortable(DictGroupTerm.GROUP_NAME_EN, dictGroup.getGroupNameEN()); document.addTextSortable(DictGroupTerm.GROUP_DESCRIPTION, dictGroup.getGroupDescription()); DictCollection dictCollection = DictCollectionLocalServiceUtil.fetchDictCollection(dictGroup.getDictCollectionId()); String dictCollectionCode = Validator.isNotNull(dictCollection)?dictCollection.getCollectionCode():StringPool.BLANK; document.addTextSortable(DictGroupTerm.DICT_COLLECTION_CODE, dictCollectionCode); return document; }
protected String getDictItemName(long groupId, String collectionCode, String itemCode) { DictCollection dc = DictCollectionLocalServiceUtil.fetchByF_dictCollectionCode(collectionCode, groupId); String itemName = StringPool.BLANK; if (Validator.isNotNull(dc)) { DictItem it = DictItemLocalServiceUtil.fetchByF_dictItemCode(itemCode, dc.getPrimaryKey(), groupId); if (Validator.isNotNull(it)) { itemName = it.getItemName(); } else { itemName = StringPool.BLANK; } } return itemName; }
/** * Returns the first dict item in the ordered set where parentItemId = ?. * * @param parentItemId the parent item ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict item * @throws NoSuchDictItemException if a matching dict item could not be found */ @Override public DictItem findByF_parentItemId_First(long parentItemId, OrderByComparator<DictItem> orderByComparator) throws NoSuchDictItemException { DictItem dictItem = fetchByF_parentItemId_First(parentItemId, orderByComparator); if (dictItem != null) { return dictItem; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("parentItemId="); msg.append(parentItemId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemException(msg.toString()); }
/** * Returns the first dict collection in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict collection * @throws NoSuchDictCollectionException if a matching dict collection could not be found */ @Override public DictCollection findByF_dictCollectionByGroup_First(long groupId, OrderByComparator<DictCollection> orderByComparator) throws NoSuchDictCollectionException { DictCollection dictCollection = fetchByF_dictCollectionByGroup_First(groupId, orderByComparator); if (dictCollection != null) { return dictCollection; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictCollectionException(msg.toString()); }
public static DLFolder getTargetFolder( long groupId, long parentFolderId, String destination) { DLFolder dlFolder = null; String[] folderNames = StringUtil.split(destination, StringPool.FORWARD_SLASH); if (folderNames != null && folderNames.length > 0) { String name = folderNames[0]; dlFolder = getFolder(groupId, parentFolderId, name); folderNames = ArrayUtil.remove(folderNames, name); if (folderNames.length > 0) { dlFolder = getTargetFolder( groupId, dlFolder.getFolderId(), StringUtil.merge(folderNames, StringPool.FORWARD_SLASH)); } } return dlFolder; }
/** * Returns the first dict item in the ordered set where dictCollectionId = ?. * * @param dictCollectionId the dict collection ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dict item * @throws NoSuchDictItemException if a matching dict item could not be found */ @Override public DictItem findByF_dictCollectionId_First(long dictCollectionId, OrderByComparator<DictItem> orderByComparator) throws NoSuchDictItemException { DictItem dictItem = fetchByF_dictCollectionId_First(dictCollectionId, orderByComparator); if (dictItem != null) { return dictItem; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("dictCollectionId="); msg.append(dictCollectionId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemException(msg.toString()); }
/** * @param length * @return */ public static String generatorGoodCode(int length) { String tempGoodCode = _generatorUniqueString(length); String goodCode = StringPool.BLANK; while (_checkContainsGoodCode(tempGoodCode)) { tempGoodCode = _generatorUniqueString(length); } /* * while(_testCheck(tempGoodCode)) { tempGoodCode = * _generatorUniqueString(length); } */ goodCode = tempGoodCode; return goodCode; }
/** * @param pattern * @param content * @return */ private static boolean _checkcontains(String pattern, String content) { boolean isContains = false; String[] splitPattern = StringUtil.split(pattern, StringPool.SPACE); for (String element : splitPattern) { if (Validator.equals(element, content)) { isContains = true; break; } } return isContains; }
/** * Returns the last dict item in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching dict item * @throws NoSuchDictItemException if a matching dict item could not be found */ @Override public DictItem findByUuid_Last(String uuid, OrderByComparator<DictItem> orderByComparator) throws NoSuchDictItemException { DictItem dictItem = fetchByUuid_Last(uuid, orderByComparator); if (dictItem != null) { return dictItem; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemException(msg.toString()); }
/** * Returns the last dict item group in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching dict item group * @throws NoSuchDictItemGroupException if a matching dict item group could not be found */ @Override public DictItemGroup findByUuid_C_Last(String uuid, long companyId, OrderByComparator<DictItemGroup> orderByComparator) throws NoSuchDictItemGroupException { DictItemGroup dictItemGroup = fetchByUuid_C_Last(uuid, companyId, orderByComparator); if (dictItemGroup != null) { return dictItemGroup; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", companyId="); msg.append(companyId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDictItemGroupException(msg.toString()); }
/** * @param jrxmlTemplate * @param jsonData * @param parameters * @param destFileName * @return */ public static String createReportFile(String jrxmlTemplate, String jsonData, Map<String, Object> parameters, String destFileName) { try { // fix json enter char jsonData = quoteHTML(jsonData); JasperReport reportTemplate = JRReportTemplate.getJasperReport(jrxmlTemplate); JRJSONDataSource dataSource = JRJSONDataSource.getInstance(jsonData); JasperPrint jasperPrint = getJasperPrint(reportTemplate, parameters, dataSource); return exportReport(jasperPrint, destFileName, DocType.PDF); } catch (Exception e) { _log.error(e); return StringPool.BLANK; } }
@Override protected String getTitlePattern(String groupName, SocialActivity activity) { _log.info("getTitlePattern"); int activityType = activity.getType(); if (activityType == TaskRecordActivityKeys.ADD_TASK_RECORD) { if (Validator.isNull(groupName)) { return "activity-task-record-add-task-record"; } else { return "activity-task-record-add-task-record-in"; } } else if (activityType == SocialActivityConstants.TYPE_MOVE_TO_TRASH) { if (Validator.isNull(groupName)) { return "activity-task-record-move-to-trash"; } else { return "activity-task-record-move-to-trash-in"; } } else if (activityType == SocialActivityConstants.TYPE_RESTORE_FROM_TRASH) { if (Validator.isNull(groupName)) { return "activity-task-record-restore-from-trash"; } else { return "activity-task-record-restore-from-trash-in"; } } else if (activityType == TaskRecordActivityKeys.UPDATE_TASK_RECORD) { if (Validator.isNull(groupName)) { return "activity-task-record-update-task-record"; } else { return "activity-task-record-update-task-record-in"; } } return StringPool.BLANK; }
@Override public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) { long entryId = GetterUtil.getLong(primaryKey); TaskRecord entry = TaskRecordLocalServiceUtil.fetchTaskRecord(entryId); boolean showInput = false; String name = null; if (entry != null) { name = TaskRecord.class.getSimpleName(); try { if (TaskRecordPermission.contains(_permissionChecker, entry, ActionKeys.DELETE)) { showInput = true; } } catch (Exception e) { } } if (!showInput) { return StringPool.BLANK; } String checkBoxRowIds = getEntryRowIds(); String checkBoxAllRowIds = "'#" + getAllRowIds() + "'"; return getRowCheckBox(request, checked, disabled, _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds, checkBoxAllRowIds, StringPool.BLANK); }
/** * Returns the dict item group where uuid = ? and groupId = ? or throws a {@link NoSuchDictItemGroupException} if it could not be found. * * @param uuid the uuid * @param groupId the group ID * @return the matching dict item group * @throws NoSuchDictItemGroupException if a matching dict item group could not be found */ @Override public DictItemGroup findByUUID_G(String uuid, long groupId) throws NoSuchDictItemGroupException { DictItemGroup dictItemGroup = fetchByUUID_G(uuid, groupId); if (dictItemGroup == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append(StringPool.CLOSE_CURLY_BRACE); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchDictItemGroupException(msg.toString()); } return dictItemGroup; }
public static List<NotificationQueueShortModel> mapperNotificationQueueList(List<NotificationQueue> listDocument) { List<NotificationQueueShortModel> results = new ArrayList<>(); try { NotificationQueueShortModel ett = null; for (NotificationQueue notificationQueue : listDocument) { ett = new NotificationQueueShortModel(); ett.setNotificationQueueId(notificationQueue.getNotificationQueueId()); ett.setNotificationType(notificationQueue.getNotificationType()); ett.setClassName(notificationQueue.getClassName()); ett.setClassPK(notificationQueue.getClassPK()); ett.setPayload(notificationQueue.getPayload()); ett.setFromUsername(notificationQueue.getFromUsername()); ett.setToUsername(notificationQueue.getToUsername()); ett.setToUserId(String.valueOf(notificationQueue.getToUserId())); ett.setToEmail(notificationQueue.getToEmail()); ett.setToTelNo(notificationQueue.getToTelNo()); ett.setExpireDate(Validator.isNotNull(notificationQueue.getExpireDate()) ? APIDateTimeUtils.convertDateToString( notificationQueue.getExpireDate(), APIDateTimeUtils._TIMESTAMP) : StringPool.BLANK); ett.setPublicationDate(Validator.isNotNull(notificationQueue.getCreateDate()) ? APIDateTimeUtils.convertDateToString( notificationQueue.getCreateDate(), APIDateTimeUtils._TIMESTAMP) : StringPool.BLANK); results.add(ett); } } catch (Exception e) { _log.error(e); } return results; }
private File getFile(long fileEntryId) { File tempFile = null; try { FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); DLFileVersion dlFileVersion = DLFileVersionLocalServiceUtil.getLatestFileVersion(fileEntry.getFileEntryId(), true); tempFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), StringPool.PERIOD + fileEntry.getExtension()); InputStream io = DLFileEntryLocalServiceUtil.getFileAsStream(fileEntryId, dlFileVersion.getVersion()); OutputStream outStream = new FileOutputStream(tempFile); byte[] buffer = new byte[8 * 1024]; int bytesRead; while ((bytesRead = io.read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } io.close(); // flush OutputStream to write any buffered data to file outStream.flush(); outStream.close(); } catch (Exception e) { // TODO: handle exception } return tempFile; }
/** * Creates a search result JSON payload * * @param tab The search tab * @param page The tab's search page * @param givenOffset The search offset that was used during the search * @param loadMoreUrl The URL used to called "load more" * @return The search result JSON payload */ public JSONObject createJSONPayload(FlashlightSearchConfigurationTab tab, SearchPage page, int givenOffset, String loadMoreUrl) { JSONObject json = this.jsonFactory.createJSONObject(); JSONArray jsonResults = this.jsonFactory.createJSONArray(); List<SearchResult> results = page.getSearchResults(); for(SearchResult result : results) { JSONObject jsonResult = this.jsonFactory.createJSONObject(); jsonResult.put(FIELD_RESULT_TITLE, result.getTitle()); jsonResult.put(FIELD_RESULT_VIEW_URL, result.getViewUrl()); jsonResult.put(FIELD_RESULT_RENDERING, result.getRendering()); jsonResults.put(jsonResult); } json.put(FIELD_RESULTS, jsonResults); int pageSize = tab.getFullPageSize(); int loadMoreSize = tab.getLoadMorePageSize(); int totalResults = page.getTotalSearchResults(); // If, at the next offset, we still have some results to display, put the "load more" URL in place String jsonLoadMoreUrl; if(totalResults - (pageSize + loadMoreSize * givenOffset) > 0) { jsonLoadMoreUrl = loadMoreUrl; } else { jsonLoadMoreUrl = StringPool.BLANK; } json.put(FIELD_LOAD_MORE_URL, jsonLoadMoreUrl); return json; }
@Override public boolean addChangepass(long groupId, long companyId, long id, String oldPassword, String newPassword, ServiceContext serviceContext) { boolean flag = getCheckpass(groupId, companyId, id, oldPassword, serviceContext); if(flag){ try { User user = UserLocalServiceUtil.updatePassword(id, newPassword, newPassword, Boolean.FALSE); Employee employee = EmployeeLocalServiceUtil.fetchByF_mappingUserId(groupId, user.getUserId()); JSONObject payLoad = JSONFactoryUtil.createJSONObject(); payLoad.put("USERNAME", user.getScreenName()); payLoad.put("USEREMAIL", user.getEmailAddress()); payLoad.put("PASSWORD", newPassword); NotificationQueueLocalServiceUtil.addNotificationQueue(user.getUserId(), groupId, Constants.USER_04, User.class.getName(), String.valueOf(user.getUserId()), payLoad.toJSONString(), "SYSTEM", user.getFullName(), user.getUserId(), employee.getEmail(), StringPool.BLANK, new Date(), null, serviceContext); } catch (PortalException e) { flag = false; } } return flag; }
@Override protected Document doGetDocument(ResourceUser resourceUser) throws Exception { Document document = getBaseModelDocument(CLASS_NAME, resourceUser); document.addKeywordSortable(Field.COMPANY_ID, String.valueOf(resourceUser.getCompanyId())); document.addDateSortable(Field.MODIFIED_DATE, resourceUser.getModifiedDate()); document.addKeywordSortable(Field.USER_ID, String.valueOf(resourceUser.getUserId())); document.addKeywordSortable(Field.USER_NAME, String.valueOf(resourceUser.getUserName())); document.addNumberSortable(ResourceUserTerm.GROUP_ID, resourceUser.getGroupId()); document.addNumberSortable(ResourceUserTerm.RESOURCEUSER_ID, resourceUser.getResourceUserId()); document.addTextSortable(ResourceUserTerm.CLASS_NAME, resourceUser.getClassName()); document.addTextSortable(ResourceUserTerm.CLASS_PK, resourceUser.getClassPK()); document.addNumberSortable(ResourceUserTerm.TO_USERID, resourceUser.getToUserId()); document.addTextSortable("selected", Boolean.TRUE.toString()); User user = UserLocalServiceUtil.fetchUser(resourceUser.getToUserId()); String userName = StringPool.BLANK; String email = StringPool.BLANK; if(Validator.isNotNull(user)){ userName = user.getFullName(); email = user.getEmailAddress(); } document.addTextSortable(ResourceUserTerm.TO_USERNAME, userName); document.addTextSortable(ResourceUserTerm.EMAIL, email); document.addTextSortable(ResourceUserTerm.USERCLASS, Employee.class.getName()); return document; }
@Override public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) { long entryId = GetterUtil.getLong(primaryKey); Contact entry = ContactLocalServiceUtil.fetchContact(entryId); boolean showInput = false; String name = null; if (entry != null) { name = Contact.class.getSimpleName(); try { if (ContactPermission.contains(_permissionChecker, entry, ActionKeys.DELETE)) { showInput = true; } } catch (Exception e) { } } if (!showInput) { return StringPool.BLANK; } String checkBoxRowIds = getEntryRowIds(); String checkBoxAllRowIds = "'#" + getAllRowIds() + "'"; return getRowCheckBox(request, checked, disabled, _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds, checkBoxAllRowIds, StringPool.BLANK); }
public static String getTypeLabel(int type) { if (type == TYPE_EXPORT_CONTACTS) { return TYPE_EXPORT_CONTACTS_LABEL; } else if (type == TYPE_IMPORT_CONTACTS) { return TYPE_IMPORT_CONTACTS_LABEL; } else { return StringPool.BLANK; } }
private static String[] buildNewSubs(JSONObject object) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < object.names().length(); i++) { String key = object.names().getString(i); String value = (String) object.get(key); _log.info("APPLICANT notification key =========" + key); _log.info("APPLICANT notification value =========" + value); sb.append(value); sb.append(StringPool.COMMA); } return StringUtil.split(sb.toString(), StringPool.COMMA); }
public String getNickname() { StringBuilder sb = new StringBuilder(); Nickname nickname = getVCard().getNickname(); if (nickname != null) { List<String> values = nickname.getValues(); for (String value : values) { sb.append(value); sb.append(StringPool.SPACE); } } return sb.toString(); }
private static String[] buildOldSubs(JSONObject object) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < object.names().length(); i++) { String key = object.names().getString(i); // String value = (String) object.get(key); sb.append(key); sb.append(StringPool.COMMA); } return StringUtil.split(sb.toString(), StringPool.COMMA); }
@Indexable(type = IndexableType.REINDEX) @Override public JobPosWork updateJobPosWork(long userId, long jobPosWorkId, long jobPostId, String checklistCat, ServiceContext serviceContext) throws UnauthenticationException, UnauthorizationException, NoSuchUserException, NotFoundException { // authen BackendAuthImpl authImpl = new BackendAuthImpl(); boolean isAuth = authImpl.isAuth(serviceContext, StringPool.BLANK, StringPool.BLANK); if (!isAuth) { throw new UnauthenticationException(); } boolean hasPermission = authImpl.hasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER, ActionKeys.EDIT_DATA); if (!hasPermission) { throw new UnauthorizationException(); } Date now = new Date(); User user = userPersistence.findByPrimaryKey(userId); JobPosWork jobPosWork = jobPosWorkPersistence.fetchByPrimaryKey(jobPosWorkId); // Audit fields jobPosWork.setUserId(user.getUserId()); jobPosWork.setUserName(user.getFullName()); jobPosWork.setModifiedDate(serviceContext.getCreateDate(now)); // Other fields jobPosWork.setJobPostId(jobPostId); jobPosWork.setChecklistCat(checklistCat); jobPosWorkPersistence.update(jobPosWork); return jobPosWork; }
@Override public String getPreference(long id, long groupId, ServiceContext serviceContext) { Preferences preferences = PreferencesLocalServiceUtil.fetchByF_userId(groupId, id); String result = Validator.isNotNull(preferences) ? preferences.getPreferences() : StringPool.BLANK; return result; }
@Override public Response getLogo(HttpServletRequest request, HttpHeaders header, Company company, Locale locale, User user, ServiceContext serviceContext, long id) { WorkingUnitInterface actions = new WorkingUnitActions(); try { File file = actions.getLogo(id, serviceContext); FileEntry fileEntry = actions.getFileEntry(id, serviceContext); String fileName = Validator.isNotNull(fileEntry) ? fileEntry.getFileName() : StringPool.BLANK; ResponseBuilder responseBuilder = Response.ok((Object) file); responseBuilder.header("Content-Disposition", "attachment; filename=\"" + fileName + "\"") .header("Content-Type", fileEntry.getMimeType()); return responseBuilder.build(); } catch (Exception e) { ErrorMsg error = new ErrorMsg(); error.setMessage("file not found!"); error.setCode(404); error.setDescription("file not found!"); return Response.status(404).entity(error).build(); } }
/** * @param pattern * @return */ protected static List<String> getSplitIndex(String pattern) { List<String> splitIndexs = new ArrayList<String>(); int eliminateParenthesis = 0; int startIndex = 0; int endIndex = 0; for (int i = 0; i < pattern.length(); i++) { Character c = pattern.charAt(i); if (c.toString().equals(StringPool.OPEN_PARENTHESIS)) { eliminateParenthesis += 1; } else if (c.toString().equals(StringPool.CLOSE_PARENTHESIS)) { eliminateParenthesis += -1; } if (eliminateParenthesis == 1 && c.toString().equals(StringPool.OPEN_PARENTHESIS)) { startIndex = i; } if (eliminateParenthesis == 0 && c.toString().equals(StringPool.CLOSE_PARENTHESIS)) { endIndex = i; } if (!splitIndexs.contains(startIndex + StringPool.DASH + endIndex) && startIndex < endIndex) { splitIndexs.add(startIndex + StringPool.DASH + endIndex); } } return splitIndexs; }
public static List<JobposModel> mapperJobposList(List<Document> listDocument) { List<JobposModel> results = new ArrayList<>(); try { JobposModel ett = null; for (Document document : listDocument) { ett = new JobposModel(); ett.setJobPosId(Long.valueOf(document.get("entryClassPK"))); ett.setCreateDate(Validator.isNotNull(document.getDate(JobPosTerm.CREATE_DATE)) ? APIDateTimeUtils .convertDateToString(document.getDate(JobPosTerm.CREATE_DATE), APIDateTimeUtils._TIMESTAMP) : StringPool.BLANK); ett.setModifiedDate( Validator.isNotNull(document.getDate("modified")) ? APIDateTimeUtils.convertDateToString( document.getDate("modified"), APIDateTimeUtils._TIMESTAMP) : StringPool.BLANK); ett.setTitle(document.get(JobPosTerm.TITLE)); ett.setDescription(document.get(JobPosTerm.DESCRIPTION)); ett.setLeader(Integer.valueOf(document.get(JobPosTerm.LEADER))); ett.setRoleId(Long.valueOf(document.get(JobPosTerm.MAPPING_ROLE_ID))); results.add(ett); } } catch (Exception e) { _log.error(e); } return results; }
/** * Returns the dict group where uuid = ? and groupId = ? or throws a {@link NoSuchDictGroupException} if it could not be found. * * @param uuid the uuid * @param groupId the group ID * @return the matching dict group * @throws NoSuchDictGroupException if a matching dict group could not be found */ @Override public DictGroup findByUUID_G(String uuid, long groupId) throws NoSuchDictGroupException { DictGroup dictGroup = fetchByUUID_G(uuid, groupId); if (dictGroup == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append(StringPool.CLOSE_CURLY_BRACE); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchDictGroupException(msg.toString()); } return dictGroup; }