List of usage examples for com.liferay.portal.kernel.util StringPool DOUBLE_DASH
String DOUBLE_DASH
To view the source code for com.liferay.portal.kernel.util StringPool DOUBLE_DASH.
Click Source Link
From source file:au.com.permeance.liferay.portal.documentlibrary.util.DLFileNameNormalizerImpl.java
License:Open Source License
public String normalize(String fileName, char[] replaceChars) { if (Validator.isNull(fileName)) { return fileName; }//from w w w . j ava 2 s . c om fileName = GetterUtil.getString(fileName); fileName = fileName.toLowerCase(); fileName = Normalizer.normalizeToAscii(fileName); StringBuilder sb = null; int index = 0; for (int i = 0; i < fileName.length(); i++) { char c = fileName.charAt(i); if ((Arrays.binarySearch(_REPLACE_CHARS, c) >= 0) || ((replaceChars != null) && ArrayUtil.contains(replaceChars, c))) { if (sb == null) { sb = new StringBuilder(); } if (i > index) { sb.append(fileName.substring(index, i)); } sb.append(CharPool.DASH); // sb.append(CharPool.UNDERLINE); index = i + 1; } } if (sb != null) { if (index < fileName.length()) { sb.append(fileName.substring(index)); } fileName = sb.toString(); } while (fileName.indexOf(StringPool.DOUBLE_DASH) >= 0) { fileName = StringUtil.replace(fileName, StringPool.DOUBLE_DASH, StringPool.DASH); } return fileName; }
From source file:com.liferay.calendar.test.util.CalendarStagingTestUtil.java
License:Open Source License
protected static void addStagingAttribute(ServiceContext serviceContext, String key, Object value) { String affixedKey = StagingConstants.STAGED_PREFIX + key + StringPool.DOUBLE_DASH; serviceContext.setAttribute(affixedKey, String.valueOf(value)); }
From source file:com.liferay.portlet.layoutsadmin.action.EditLayoutsAction.java
License:Open Source License
protected void setThemeSettingProperties(ActionRequest actionRequest, UnicodeProperties typeSettingsProperties, String device, Map<String, ThemeSetting> themeSettings) throws PortalException, SystemException { long groupId = ParamUtil.getLong(actionRequest, "groupId"); boolean privateLayout = ParamUtil.getBoolean(actionRequest, "privateLayout"); long layoutId = ParamUtil.getLong(actionRequest, "layoutId"); Layout layout = LayoutLocalServiceUtil.getLayout(groupId, privateLayout, layoutId); LayoutSet layoutSet = layout.getLayoutSet(); for (String key : themeSettings.keySet()) { ThemeSetting themeSetting = themeSettings.get(key); String type = GetterUtil.getString(themeSetting.getType(), "text"); String property = device + "ThemeSettingsProperties--" + key + StringPool.DOUBLE_DASH; String value = ParamUtil.getString(actionRequest, property); if (type.equals("checkbox")) { value = String.valueOf(GetterUtil.getBoolean(value)); }// ww w . j a v a2 s. com if (!value.equals(layoutSet.getThemeSetting(key, device))) { typeSettingsProperties.setProperty(ThemeSettingImpl.namespaceProperty(device, key), value); } } }
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();// ww w . ja v a2 s . com 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.SelectTag.java
License:Open Source License
@Override protected void setAttributes(HttpServletRequest request) { super.setAttributes(request); Object bean = getBean();//from w ww . j ava2 s .c o m if (bean == null) { bean = pageContext.getAttribute("aui:model-context:bean"); } String name = getName(); int pos = name.indexOf(StringPool.DOUBLE_DASH); if (pos != -1) { name = name.substring(pos + 2, name.length() - 2); } String id = getId(); if (Validator.isNull(id)) { id = name; } String label = getLabel(); if (label == null) { label = TextFormatter.format(name, TextFormatter.K); } String listType = getListType(); String listTypeFieldName = getListTypeFieldName(); if (Validator.isNotNull(listType) && Validator.isNull(listTypeFieldName)) { listTypeFieldName = "typeId"; } String value = StringPool.BLANK; if (Validator.isNull(listType)) { if (bean != null) { value = BeanPropertiesUtil.getStringSilent(bean, name, value); } if (!getIgnoreRequestValue()) { value = ParamUtil.getString(request, name, value); } } setNamespacedAttribute(request, "bean", bean); setNamespacedAttribute(request, "id", id); setNamespacedAttribute(request, "label", label); setNamespacedAttribute(request, "listTypeFieldName", listTypeFieldName); setNamespacedAttribute(request, "value", value); }
From source file:org.gfbio.ContactFormToHelpdeskPortlet.java
License:Open Source License
public String getParameter(PortletRequest portletRequest, String name) { name = PREFERENCES_PREFIX.concat(name).concat(StringPool.DOUBLE_DASH); return ParamUtil.getString(portletRequest, name); }