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.portlet.journal.util.VelocityTemplateParser.java
License:Open Source License
@Override protected void populateTemplateContext(TemplateContext templateContext) throws Exception { super.populateTemplateContext(templateContext); templateContext.put("journalTemplatesPath", getJournalTemplatesPath()); String randomNamespace = PwdGenerator.getPassword(PwdGenerator.KEY3, 4) + StringPool.UNDERLINE; templateContext.put("randomNamespace", randomNamespace); }
From source file:com.liferay.portlet.nestedportlets.action.ConfigurationActionImpl.java
License:Open Source License
protected List<String> getColumnNames(String content, String portletId) { Matcher matcher = _pattern.matcher(content); Set<String> columnIds = new HashSet<String>(); while (matcher.find()) { if (Validator.isNotNull(matcher.group(1))) { columnIds.add(matcher.group(1)); }/* ww w .j ava 2 s.c o m*/ } List<String> columnNames = new UniqueList<String>(); for (String columnId : columnIds) { if (columnId.indexOf(portletId) == -1) { columnNames.add(portletId + StringPool.UNDERLINE + columnId); } } return columnNames; }
From source file:com.liferay.portlet.nestedportlets.action.ViewAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); Portlet portlet = (Portlet) renderRequest.getAttribute(WebKeys.RENDER_PORTLET); PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(renderRequest, portlet.getPortletId());/*from w w w . j a v a 2s . c om*/ String layoutTemplateId = preferences.getValue("layoutTemplateId", PropsValues.NESTED_PORTLETS_LAYOUT_TEMPLATE_DEFAULT); String velocityTemplateId = StringPool.BLANK; String velocityTemplateContent = StringPool.BLANK; Map<String, String> columnIds = new HashMap<String, String>(); if (Validator.isNotNull(layoutTemplateId)) { Theme theme = themeDisplay.getTheme(); LayoutTemplate layoutTemplate = LayoutTemplateLocalServiceUtil.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); velocityTemplateId = sb.toString(); content = processColumnMatcher.replaceAll("$1\\${$2}$3"); Matcher columnIdMatcher = _columnIdPattern.matcher(content); velocityTemplateContent = columnIdMatcher.replaceAll("$1" + renderResponse.getNamespace() + "$2$3"); } checkLayout(themeDisplay.getLayout(), columnIds.values()); renderRequest.setAttribute(WebKeys.NESTED_PORTLET_VELOCITY_TEMPLATE_ID, velocityTemplateId); renderRequest.setAttribute(WebKeys.NESTED_PORTLET_VELOCITY_TEMPLATE_CONTENT, velocityTemplateContent); Map<String, Object> vmVariables = (Map<String, Object>) renderRequest.getAttribute(WebKeys.VM_VARIABLES); if (vmVariables != null) { vmVariables.putAll(columnIds); } else { renderRequest.setAttribute(WebKeys.VM_VARIABLES, columnIds); } return mapping.findForward("portlet.nested_portlets.view"); }
From source file:com.liferay.portlet.PortletBagFactory.java
License:Open Source License
protected InputStream getResourceBundleInputStream(String resourceBundleName, Locale locale) { resourceBundleName = resourceBundleName.replace(StringPool.PERIOD, StringPool.SLASH); Locale newLocale = locale;/*ww w . ja va 2 s . c om*/ InputStream inputStream = null; while (inputStream == null) { locale = newLocale; StringBundler sb = new StringBundler(4); sb.append(resourceBundleName); if (locale != null) { String localeName = locale.toString(); if (localeName.length() > 0) { sb.append(StringPool.UNDERLINE); sb.append(localeName); } } if (!resourceBundleName.endsWith(".properties")) { sb.append(".properties"); } String localizedResourceBundleName = sb.toString(); if (_log.isInfoEnabled()) { _log.info("Attempting to load " + localizedResourceBundleName); } inputStream = _classLoader.getResourceAsStream(localizedResourceBundleName); if (locale == null) { break; } newLocale = LanguageResources.getSuperLocale(locale); if (newLocale == null) { break; } if (newLocale.equals(locale)) { break; } } return inputStream; }
From source file:com.liferay.portlet.PortletQNameImpl.java
License:Open Source License
public String getPublicRenderParameterName(QName qName) { StringBundler sb = new StringBundler(4); sb.append(PUBLIC_RENDER_PARAMETER_NAMESPACE); sb.append(qName.getNamespaceURI().hashCode()); sb.append(StringPool.UNDERLINE); sb.append(qName.getLocalPart());/*from w ww .j av a2s.co m*/ String publicRenderParameterName = sb.toString(); if (!_qNames.containsKey(publicRenderParameterName)) { _qNames.put(publicRenderParameterName, qName); } return publicRenderParameterName; }
From source file:com.liferay.portlet.PortletQNameImpl.java
License:Open Source License
public String getRemovePublicRenderParameterName(QName qName) { StringBundler sb = new StringBundler(4); sb.append(REMOVE_PUBLIC_RENDER_PARAMETER_NAMESPACE); sb.append(qName.getNamespaceURI().hashCode()); sb.append(StringPool.UNDERLINE); sb.append(qName.getLocalPart());/*from ww w . jav a 2 s. co m*/ String removePublicRenderParameterName = sb.toString(); if (!_qNames.containsKey(removePublicRenderParameterName)) { _qNames.put(removePublicRenderParameterName, qName); } return removePublicRenderParameterName; }
From source file:com.liferay.portlet.social.model.BaseSocialAchievement.java
License:Open Source License
public void setName(String name) { name = StringUtil.replace(name, StringPool.SPACE, StringPool.UNDERLINE); name = name.toLowerCase(); _name = StringUtil.extract(name, _NAME_SUPPORTED_CHARS); }
From source file:com.liferay.portlet.wiki.translators.MediaWikiToCreoleTranslator.java
License:Open Source License
@Override protected String postProcess(String content) { // LEP-6118/*from w w w. j a v a 2 s.c o m*/ Matcher matcher = Pattern.compile("^=([^=]+)=", Pattern.MULTILINE).matcher(content); if (matcher.find()) { content = runRegexp(content, "^===([^=]+)===", "====$1===="); content = runRegexp(content, "^==([^=]+)==", "===$1==="); content = runRegexp(content, "^=([^=]+)=", "==$1=="); } // Remove HTML tags for (int i = 0; i < _HTML_TAGS.length; i++) { content = content.replaceAll(_HTML_TAGS[i], StringPool.BLANK); } // Images matcher = Pattern.compile("\\[{2}Image:([^\\]]*)\\]{2}", Pattern.DOTALL).matcher(content); StringBuffer sb = new StringBuffer(content); int offset = 0; while (matcher.find()) { String image = "{{" + MediaWikiImporter.SHARED_IMAGES_TITLE + "/" + matcher.group(1).toLowerCase() + "}}"; sb.replace(matcher.start(0) + offset, matcher.end(0) + offset, image); offset += MediaWikiImporter.SHARED_IMAGES_TITLE.length() - 5; } content = sb.toString(); // Remove underscores from links matcher = Pattern.compile("\\[{2}([^\\]]*)\\]{2}", Pattern.DOTALL).matcher(content); sb = new StringBuffer(content); while (matcher.find()) { String link = matcher.group(1).replace(StringPool.UNDERLINE, StringPool.SPACE); sb.replace(matcher.start(1), matcher.end(1), link); } return TABLE_OF_CONTENTS + super.postProcess(sb.toString()); }
From source file:com.liferay.resourcesimporter.util.FileSystemImporter.java
License:Open Source License
protected void addLayoutColumnPortlet(Layout layout, String columnId, JSONObject portletJSONObject) throws Exception { LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType(); String rootPortletId = portletJSONObject.getString("portletId"); if (Validator.isNull(rootPortletId)) { throw new ImporterException("portletId is not specified"); }// ww w . ja va2 s. c o m String portletId = layoutTypePortlet.addPortletId(userId, rootPortletId, columnId, -1, false); JSONObject portletPreferencesJSONObject = portletJSONObject.getJSONObject("portletPreferences"); if ((portletPreferencesJSONObject == null) || (portletPreferencesJSONObject.length() == 0)) { return; } PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletId); Iterator<String> iterator = portletPreferencesJSONObject.keys(); while (iterator.hasNext()) { String key = iterator.next(); String value = portletPreferencesJSONObject.getString(key); if (rootPortletId.equals(PortletKeys.JOURNAL_CONTENT) && key.equals("articleId")) { value = getJournalId(value); } portletSetup.setValue(key, value); } portletSetup.store(); if (rootPortletId.equals(PortletKeys.NESTED_PORTLETS)) { JSONArray columnsJSONArray = portletPreferencesJSONObject.getJSONArray("columns"); StringBundler sb = new StringBundler(4); sb.append(StringPool.UNDERLINE); sb.append(portletId); sb.append(StringPool.DOUBLE_UNDERLINE); sb.append(LayoutTypePortletConstants.COLUMN_PREFIX); addLayoutColumns(layout, sb.toString(), columnsJSONArray); } }
From source file:com.liferay.rtl.servlet.filters.dynamiccss.DynamicCSSFilter.java
License:Open Source License
protected String getCacheFileName(HttpServletRequest request) { CacheKeyGenerator cacheKeyGenerator = CacheKeyGeneratorUtil .getCacheKeyGenerator(DynamicCSSFilter.class.getName()); cacheKeyGenerator.append(HttpUtil.getProtocol(request.isSecure())); cacheKeyGenerator.append(StringPool.UNDERLINE); cacheKeyGenerator.append(request.getRequestURI()); String queryString = request.getQueryString(); if (queryString != null) { cacheKeyGenerator.append(sterilizeQueryString(queryString)); }// ww w . j a v a 2 s. c o m return String.valueOf(cacheKeyGenerator.finish()); }