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.rtl.servlet.filters.dynamiccss.DynamicCSSFilter.java
License:Open Source License
protected String sterilizeQueryString(String queryString) { return StringUtil.replace(queryString, new String[] { StringPool.SLASH, StringPool.BACK_SLASH }, new String[] { StringPool.UNDERLINE, StringPool.UNDERLINE }); }
From source file:com.liferay.rtl.servlet.filters.dynamiccss.DynamicCSSUtil.java
License:Open Source License
private static Theme _getTheme(HttpServletRequest request) throws Exception { long companyId = PortalUtil.getCompanyId(request); String themeId = ParamUtil.getString(request, "themeId"); if (Validator.isNotNull(themeId)) { try {/*from www. j a v a 2 s . c o m*/ Theme theme = ThemeLocalServiceUtil.getTheme(companyId, themeId, false); return theme; } catch (Exception e) { _log.error(e, e); } } String requestURI = URLDecoder.decode(request.getRequestURI(), StringPool.UTF8); Matcher portalThemeMatcher = _portalThemePattern.matcher(requestURI); if (portalThemeMatcher.find()) { String themePathId = portalThemeMatcher.group(1); themePathId = StringUtil.replace(themePathId, StringPool.UNDERLINE, StringPool.BLANK); themeId = PortalUtil.getJsSafePortletId(themePathId); } else { Matcher pluginThemeMatcher = _pluginThemePattern.matcher(requestURI); if (pluginThemeMatcher.find()) { String themePathId = pluginThemeMatcher.group(1); themePathId = StringUtil.replace(themePathId, StringPool.UNDERLINE, StringPool.BLANK); StringBundler sb = new StringBundler(4); sb.append(themePathId); sb.append(PortletConstants.WAR_SEPARATOR); sb.append(themePathId); sb.append("theme"); themePathId = sb.toString(); themeId = PortalUtil.getJsSafePortletId(themePathId); } } if (Validator.isNull(themeId)) { return null; } try { Theme theme = ThemeLocalServiceUtil.getTheme(companyId, themeId, false); return theme; } catch (Exception e) { _log.error(e, e); } return null; }
From source file:com.liferay.staging.test.StagingImplTest.java
License:Open Source License
protected void enableLocalStagingWithContent(boolean stageJournal, boolean stageAssetCategories, boolean branching) throws Exception { // Layouts// w w w . j a v a 2 s. com LayoutTestUtil.addLayout(_group); LayoutTestUtil.addLayout(_group); // Create content JournalArticle journalArticle = JournalTestUtil.addArticle(_group.getGroupId(), "Title", "content"); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); Map<String, String[]> parameters = ExportImportConfigurationParameterMapFactory.buildParameterMap(); parameters.put( PortletDataHandlerKeys.PORTLET_CONFIGURATION + StringPool.UNDERLINE + JournalPortletKeys.JOURNAL, new String[] { String.valueOf(stageJournal) }); parameters.put(PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, new String[] { Boolean.FALSE.toString() }); parameters.put(PortletDataHandlerKeys.PORTLET_DATA + StringPool.UNDERLINE + JournalPortletKeys.JOURNAL, new String[] { String.valueOf(stageJournal) }); parameters.put(PortletDataHandlerKeys.PORTLET_DATA_ALL, new String[] { Boolean.FALSE.toString() }); parameters.put(PortletDataHandlerKeys.PORTLET_SETUP + StringPool.UNDERLINE + JournalPortletKeys.JOURNAL, new String[] { String.valueOf(stageJournal) }); serviceContext.setAttribute(StagingUtil.getStagedPortletId(JournalPortletKeys.JOURNAL), stageJournal); Map<String, Serializable> attributes = serviceContext.getAttributes(); attributes.putAll(parameters); enableLocalStaging(branching, serviceContext); Group stagingGroup = _group.getStagingGroup(); // Update content in staging JournalArticle stagingJournalArticle = JournalArticleLocalServiceUtil .getArticleByUrlTitle(stagingGroup.getGroupId(), journalArticle.getUrlTitle()); stagingJournalArticle = JournalTestUtil.updateArticle(stagingJournalArticle, "Title2", stagingJournalArticle.getContent()); // Publish to live StagingUtil.publishLayouts(TestPropsValues.getUserId(), stagingGroup.getGroupId(), _group.getGroupId(), false, parameters); // Retrieve content from live after publishing journalArticle = JournalArticleLocalServiceUtil.getArticle(_group.getGroupId(), journalArticle.getArticleId()); if (stageJournal) { for (Locale locale : _locales) { Assert.assertEquals(journalArticle.getTitle(locale), stagingJournalArticle.getTitle(locale)); } } else { for (Locale locale : _locales) { Assert.assertNotEquals(journalArticle.getTitle(locale), stagingJournalArticle.getTitle(locale)); } } }
From source file:com.liferay.sync.service.impl.SyncDLFileVersionDiffLocalServiceImpl.java
License:Open Source License
protected String getDataFileName(long fileEntryId, long sourceFileVersionId, long targetFileVersionId) { StringBundler sb = new StringBundler(5); sb.append(fileEntryId);/*from w w w . j av a 2s . c o m*/ sb.append(StringPool.UNDERLINE); sb.append(sourceFileVersionId); sb.append(StringPool.UNDERLINE); sb.append(targetFileVersionId); return sb.toString(); }
From source file:com.liferay.taglib.aui.InputTag.java
License:Open Source License
@Override protected void setAttributes(HttpServletRequest request) { super.setAttributes(request); Object bean = getBean();// w ww.j ava 2 s.co m if (bean == null) { bean = pageContext.getAttribute("aui:model-context:bean"); } String defaultLanguageId = getDefaultLanguageId(); if (Validator.isNull(defaultLanguageId)) { defaultLanguageId = (String) pageContext.getAttribute("aui:model-context:defaultLanguageId"); } if (Validator.isNull(defaultLanguageId)) { Locale defaultLocale = LocaleUtil.getDefault(); defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale); } String name = getName(); int pos = name.indexOf(StringPool.DOUBLE_DASH); if (pos != -1) { name = name.substring(pos + 2, name.length() - 2); } String field = getField(); if (Validator.isNull(field)) { field = getName(); } String formName = getFormName(); if (formName == null) { FormTag formTag = (FormTag) findAncestorWithClass(this, FormTag.class); if (formTag != null) { formName = formTag.getName(); } } String id = getId(); String type = getType(); if (Validator.isNull(id)) { if (!Validator.equals(type, "assetTags") && !Validator.equals(type, "radio")) { id = name; } else { id = PwdGenerator.getPassword(PwdGenerator.KEY3, 4); } } String label = getLabel(); if (label == null) { label = TextFormatter.format(name, TextFormatter.K); } Class<?> model = getModel(); if (model == null) { model = (Class<?>) pageContext.getAttribute("aui:model-context:model"); } _forLabel = id; _inputName = getName(); String baseType = null; if ((model != null) && Validator.isNull(type)) { baseType = ModelHintsUtil.getType(model.getName(), field); String fieldParam = getFieldParam(); if (Validator.isNotNull(fieldParam)) { _forLabel = fieldParam; _inputName = fieldParam; } if (ModelHintsUtil.isLocalized(model.getName(), field)) { _forLabel += StringPool.UNDERLINE + defaultLanguageId; _inputName += StringPool.UNDERLINE + defaultLanguageId; } } else if (Validator.isNotNull(type)) { if (Validator.equals(type, "checkbox") || Validator.equals(type, "radio")) { baseType = type; } } if (Validator.isNull(baseType)) { baseType = "text"; } setNamespacedAttribute(request, "baseType", baseType); setNamespacedAttribute(request, "bean", bean); setNamespacedAttribute(request, "defaultLanguageId", defaultLanguageId); setNamespacedAttribute(request, "field", field); setNamespacedAttribute(request, "forLabel", _forLabel); setNamespacedAttribute(request, "formName", formName); setNamespacedAttribute(request, "id", id); setNamespacedAttribute(request, "label", label); setNamespacedAttribute(request, "model", model); request.setAttribute(getAttributeNamespace() + "value", getValue()); }
From source file:com.liferay.taglib.aui.ValidatorTagImpl.java
License:Open Source License
protected String processCustom(String name) { if (name.equals("custom")) { _custom = true;/*from w ww . j a v a 2 s.c om*/ return name.concat(StringPool.UNDERLINE).concat(PwdGenerator.getPassword(PwdGenerator.KEY3, 4)); } return name; }
From source file:com.liferay.taglib.ui.AssetTagsSelectorTag.java
License:Open Source License
@Override protected void setAttributes(HttpServletRequest request) { String id = _id;/*from w w w . j a v a 2s.co m*/ if (Validator.isNull(id)) { id = PortalUtil.generateRandomKey(request, "taglib_ui_asset_tags_selector_page") + StringPool.UNDERLINE; } request.setAttribute("liferay-ui:asset-tags-selector:className", _className); request.setAttribute("liferay-ui:asset-tags-selector:classPK", String.valueOf(_classPK)); request.setAttribute("liferay-ui:asset-tags-selector:contentCallback", String.valueOf(_contentCallback)); request.setAttribute("liferay-ui:asset-tags-selector:curTags", _curTags); request.setAttribute("liferay-ui:asset-tags-selector:focus", String.valueOf(_focus)); request.setAttribute("liferay-ui:asset-tags-selector:hiddenInput", _hiddenInput); request.setAttribute("liferay-ui:asset-tags-selector:id", id); }
From source file:com.liferay.taglib.ui.IconMenuTag.java
License:Open Source License
@Override public int doStartTag() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); if (_direction == null) { if (_align.equals("left")) { _direction = "right"; } else {//from w w w. ja v a 2 s . co m _direction = "left"; } } if (_icon == null) { _icon = themeDisplay.getPathThemeImages() + "/common/tool.png"; } if (Validator.isNull(_id)) { String randomKey = PortalUtil.generateRandomKey(request, IconMenuTag.class.getName()); _id = randomKey + StringPool.UNDERLINE + "menu"; } else { PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String namespace = portletDisplay.getNamespace(); _id = namespace.concat(_id); } request.setAttribute("liferay-ui:icon-menu:icon-count", new IntegerWrapper()); request.setAttribute("liferay-ui:icon-menu:showWhenSingleIcon", String.valueOf(_showWhenSingleIcon)); return EVAL_BODY_BUFFERED; }
From source file:com.liferay.tools.sourceformatter.BaseSourceProcessor.java
License:Open Source License
protected void checkLanguageKeys(String fileName, String content, Pattern pattern) throws IOException { String fileExtension = fileUtil.getExtension(fileName); if (!portalSource || fileExtension.equals("vm")) { return;/*from ww w. j a v a 2 s .c o m*/ } if (_portalLanguageProperties == null) { _portalLanguageProperties = new Properties(); ClassLoader classLoader = BaseSourceProcessor.class.getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream("content/Language.properties"); _portalLanguageProperties.load(inputStream); } Matcher matcher = pattern.matcher(content); while (matcher.find()) { String[] languageKeys = getLanguageKeys(matcher); for (String languageKey : languageKeys) { if (Validator.isNumber(languageKey) || languageKey.endsWith(StringPool.DASH) || languageKey.endsWith(StringPool.OPEN_BRACKET) || languageKey.endsWith(StringPool.PERIOD) || languageKey.endsWith(StringPool.UNDERLINE) || languageKey.startsWith(StringPool.DASH) || languageKey.startsWith(StringPool.OPEN_BRACKET) || languageKey.startsWith(StringPool.OPEN_CURLY_BRACE) || languageKey.startsWith(StringPool.PERIOD) || languageKey.startsWith(StringPool.UNDERLINE) || _portalLanguageProperties.containsKey(languageKey)) { continue; } Properties languageProperties = getLanguageProperties(fileName); if ((languageProperties == null) || !languageProperties.containsKey(languageKey)) { processErrorMessage(fileName, "missing language key: " + languageKey + StringPool.SPACE + fileName); } } } }
From source file:com.liferay.tools.sourceformatter.JavaClass.java
License:Open Source License
protected void checkImmutableFieldType(JavaTerm javaTerm) { String oldName = javaTerm.getName(); if (oldName.equals("serialVersionUID")) { return;//from w w w.j a v a2 s. co m } Matcher matcher = _camelCasePattern.matcher(oldName); String newName = matcher.replaceAll("$1_$2"); newName = StringUtil.toUpperCase(newName); if (newName.charAt(0) != CharPool.UNDERLINE) { newName = StringPool.UNDERLINE.concat(newName); } _content = _content.replaceAll("(?<=[\\W&&[^.\"]])(" + oldName + ")\\b", newName); }