List of usage examples for com.liferay.portal.kernel.util StringPool UNDERLINE
String UNDERLINE
To view the source code for com.liferay.portal.kernel.util StringPool UNDERLINE.
Click Source Link
From source file:com.liferay.mail.util.AccountLock.java
License:Open Source License
public static String getKey(long userId, long accountEntryId) { StringBundler sb = new StringBundler(7); sb.append(userId);/* ww w .jav a2 s . c o m*/ sb.append(StringPool.UNDERLINE); sb.append(accountEntryId); return sb.toString(); }
From source file:com.liferay.mail.util.ShellHook.java
License:Open Source License
protected void execute(String cmdLine[]) { for (int i = 0; i < cmdLine.length; i++) { if (cmdLine[i].trim().length() == 0) { cmdLine[i] = StringPool.UNDERLINE; }/* w ww . j a va 2 s . c o m*/ } try { Runtime rt = Runtime.getRuntime(); Process p = rt.exec(cmdLine); ProcessUtil.close(p); int exitValue = p.exitValue(); if (exitValue != 0) { StringBundler sb = new StringBundler(cmdLine.length * 2); for (int i = 0; i < cmdLine.length; i++) { sb.append(cmdLine[i]); sb.append(StringPool.SPACE); } throw new IllegalArgumentException(sb.toString()); } } catch (Exception e) { _log.error(e); } }
From source file:com.liferay.mongodb.util.MongoDBUtil.java
License:Open Source License
private DB _getDB(long companyId) { String dbName = PortletPropsValues.SERVER_DATABASE.concat(StringPool.UNDERLINE) .concat(String.valueOf(companyId)); return _mongo.getDB(dbName); }
From source file:com.liferay.nested.portlets.web.internal.portlet.action.NestedPortletsConfigurationAction.java
License:Open Source License
protected List<String> getColumnNames(String content, String portletId) { Matcher matcher = _pattern.matcher(content); Set<String> columnIds = new HashSet<>(); while (matcher.find()) { if (Validator.isNotNull(matcher.group(1))) { columnIds.add(matcher.group(1)); }//from w ww . j av a2 s. com } Set<String> columnNames = new LinkedHashSet<>(); for (String columnId : columnIds) { if (!columnId.contains(portletId)) { columnNames.add(_portal.getPortletNamespace(portletId) + StringPool.UNDERLINE + columnId); } } return new ArrayList<>(columnNames); }
From source file:com.liferay.nested.portlets.web.internal.portlet.NestedPortletsPortlet.java
License:Open Source License
@Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); String layoutTemplateId = StringPool.BLANK; try {/*from w ww . j av a2 s. co m*/ NestedPortletsDisplayContext nestedPortletsDisplayContext = new NestedPortletsDisplayContext( _portal.getHttpServletRequest(renderRequest)); layoutTemplateId = nestedPortletsDisplayContext.getLayoutTemplateId(); } catch (ConfigurationException ce) { if (_log.isWarnEnabled()) { _log.warn(ce, ce); } } String templateId = StringPool.BLANK; String templateContent = StringPool.BLANK; Map<String, String> columnIds = new HashMap<>(); if (Validator.isNotNull(layoutTemplateId)) { Theme theme = themeDisplay.getTheme(); LayoutTemplate layoutTemplate = _layoutTemplateLocalService.getLayoutTemplate(layoutTemplateId, false, theme.getThemeId()); String content = layoutTemplate.getContent(); Matcher processColumnMatcher = _processColumnPattern.matcher(content); while (processColumnMatcher.find()) { String columnId = processColumnMatcher.group(2); if (Validator.isNotNull(columnId)) { columnIds.put(columnId, renderResponse.getNamespace() + StringPool.UNDERLINE + columnId); } } processColumnMatcher.reset(); StringBundler sb = new StringBundler(4); sb.append(theme.getThemeId()); sb.append(LayoutTemplateConstants.CUSTOM_SEPARATOR); sb.append(renderResponse.getNamespace()); sb.append(layoutTemplateId); templateId = sb.toString(); content = processColumnMatcher.replaceAll("$1\\${$2}$3"); Matcher columnIdMatcher = _columnIdPattern.matcher(content); templateContent = columnIdMatcher.replaceAll("$1" + renderResponse.getNamespace() + "$2$3"); } checkLayout(themeDisplay.getLayout(), columnIds.values()); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); renderRequest.setAttribute(NestedPortletsWebKeys.TEMPLATE_ID + portletDisplay.getId(), templateId); renderRequest.setAttribute(NestedPortletsWebKeys.TEMPLATE_CONTENT + portletDisplay.getId(), templateContent); Map<String, Object> vmVariables = (Map<String, Object>) renderRequest .getAttribute(WebKeys.VM_VARIABLES + portletDisplay.getId()); if (vmVariables != null) { vmVariables.putAll(columnIds); } else { renderRequest.setAttribute(WebKeys.VM_VARIABLES + portletDisplay.getId(), columnIds); } super.include(viewTemplate, renderRequest, renderResponse); }
From source file:com.liferay.opensocial.shindig.util.ShindigUtil.java
License:Open Source License
public static com.liferay.opensocial.model.Gadget getGadget(String portletName, long companyId) throws Exception { int pos = portletName.indexOf(StringPool.UNDERLINE); String uuid = GetterUtil.getString(portletName.substring(pos + 1)); uuid = PortalUUIDUtil.fromJsSafeUuid(uuid); com.liferay.opensocial.model.Gadget gadget = GadgetLocalServiceUtil.getGadget(uuid, companyId); return gadget; }
From source file:com.liferay.portlet.assetpublisher.util.AssetPublisherUtil.java
License:Open Source License
public static long[] getGroupIds(PortletPreferences portletPreferences, long scopeGroupId, Layout layout) { boolean defaultScope = GetterUtil.getBoolean(portletPreferences.getValue("defaultScope", null), true); if (defaultScope) { return new long[] { scopeGroupId }; }//from w w w . jav a2 s . c o m long defaultScopeId = GetterUtil.getLong(portletPreferences.getValue("defaultScope", null)); if (defaultScopeId > 0) { return new long[] { defaultScopeId }; } String[] scopeIds = portletPreferences.getValues("scopeIds", new String[] { "group" + StringPool.UNDERLINE + scopeGroupId }); long[] groupIds = new long[scopeIds.length]; for (int i = 0; i < scopeIds.length; i++) { try { String[] scopeIdFragments = StringUtil.split(scopeIds[i], CharPool.UNDERLINE); if (scopeIdFragments[0].equals("Layout")) { long scopeIdLayoutId = GetterUtil.getLong(scopeIdFragments[1]); Layout scopeIdLayout = LayoutLocalServiceUtil.getLayout(scopeGroupId, layout.isPrivateLayout(), scopeIdLayoutId); Group scopeIdGroup = scopeIdLayout.getScopeGroup(); groupIds[i] = scopeIdGroup.getGroupId(); } else { if (scopeIdFragments[1].equals(GroupConstants.DEFAULT)) { groupIds[i] = scopeGroupId; } else { long scopeIdGroupId = GetterUtil.getLong(scopeIdFragments[1]); groupIds[i] = scopeIdGroupId; } } } catch (Exception e) { continue; } } return groupIds; }
From source file:com.liferay.portlet.assetpublisher.util.AssetPublisherUtil.java
License:Open Source License
private static Map<String, Long> _getRecentFolderIds(PortletRequest portletRequest) { HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest); HttpSession session = request.getSession(); ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); String key = AssetPublisherUtil.class + StringPool.UNDERLINE + themeDisplay.getScopeGroupId(); Map<String, Long> recentFolderIds = (Map<String, Long>) session.getAttribute(key); if (recentFolderIds == null) { recentFolderIds = new HashMap<String, Long>(); }/*from www . ja v a 2s.c o m*/ session.setAttribute(key, recentFolderIds); return recentFolderIds; }
From source file:com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore.java
License:Open Source License
@Override protected File getFileNameVersionFile(long companyId, long repositoryId, String fileName, String version) { String ext = StringPool.PERIOD + FileUtil.getExtension(fileName); if (ext.equals(StringPool.PERIOD)) { ext += _HOOK_EXTENSION;//from w w w. jav a 2 s . co m } int pos = fileName.lastIndexOf(CharPool.SLASH); if (pos == -1) { StringBundler sb = new StringBundler(); String fileNameFragment = FileUtil.stripExtension(fileName); if (fileNameFragment.startsWith("DLFE-")) { fileNameFragment = fileNameFragment.substring(5); sb.append("DLFE" + StringPool.SLASH); } buildPath(sb, fileNameFragment); File repositoryDir = getRepositoryDir(companyId, repositoryId); return new File(repositoryDir + StringPool.SLASH + sb.toString() + StringPool.SLASH + fileNameFragment + ext + StringPool.SLASH + fileNameFragment + StringPool.UNDERLINE + version + ext); } else { File fileNameDir = getDirNameDir(companyId, repositoryId, fileName); String fileNameFragment = FileUtil.stripExtension(fileName.substring(pos + 1)); return new File( fileNameDir + StringPool.SLASH + fileNameFragment + StringPool.UNDERLINE + version + ext); } }
From source file:com.liferay.portlet.documentlibrary.util.DLFileEntryIndexer.java
License:Open Source License
@Override public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext) throws Exception { addStatus(contextQuery, searchContext); if (searchContext.isIncludeAttachments()) { addRelatedClassNames(contextQuery, searchContext); }//ww w. j ava 2s.c om contextQuery.addRequiredTerm(Field.HIDDEN, searchContext.isIncludeAttachments()); addSearchClassTypeIds(contextQuery, searchContext); String ddmStructureFieldName = (String) searchContext.getAttribute("ddmStructureFieldName"); Serializable ddmStructureFieldValue = searchContext.getAttribute("ddmStructureFieldValue"); if (Validator.isNotNull(ddmStructureFieldName) && Validator.isNotNull(ddmStructureFieldValue)) { String[] ddmStructureFieldNameParts = StringUtil.split(ddmStructureFieldName, StringPool.SLASH); DDMStructure structure = DDMStructureLocalServiceUtil .getStructure(GetterUtil.getLong(ddmStructureFieldNameParts[1])); String fieldName = StringUtil.replaceLast(ddmStructureFieldNameParts[2], StringPool.UNDERLINE.concat(LocaleUtil.toLanguageId(searchContext.getLocale())), StringPool.BLANK); try { ddmStructureFieldValue = DDMUtil.getIndexedFieldValue(ddmStructureFieldValue, structure.getFieldType(fieldName)); } catch (StructureFieldException sfe) { } contextQuery.addRequiredTerm(ddmStructureFieldName, StringPool.QUOTE + ddmStructureFieldValue + StringPool.QUOTE); } String[] mimeTypes = (String[]) searchContext.getAttribute("mimeTypes"); if (ArrayUtil.isNotEmpty(mimeTypes)) { BooleanQuery mimeTypesQuery = BooleanQueryFactoryUtil.create(searchContext); for (String mimeType : mimeTypes) { mimeTypesQuery.addTerm("mimeType", StringUtil.replace(mimeType, CharPool.FORWARD_SLASH, CharPool.UNDERLINE)); } contextQuery.add(mimeTypesQuery, BooleanClauseOccur.MUST); } }