List of usage examples for com.liferay.portal.kernel.util StringPool SPACE
String SPACE
To view the source code for com.liferay.portal.kernel.util StringPool SPACE.
Click Source Link
From source file:com.liferay.document.library.web.internal.portlet.action.CompareVersionsMVCRenderCommand.java
License:Open Source License
protected void compareVersions(RenderRequest renderRequest) throws Exception { long sourceFileVersionId = ParamUtil.getLong(renderRequest, "sourceFileVersionId"); long targetFileVersionId = ParamUtil.getLong(renderRequest, "targetFileVersionId"); FileVersion sourceFileVersion = _dlAppService.getFileVersion(sourceFileVersionId); InputStream sourceIs = sourceFileVersion.getContentStream(false); String sourceExtension = sourceFileVersion.getExtension(); if (sourceExtension.equals("css") || sourceExtension.equals("htm") || sourceExtension.equals("html") || sourceExtension.equals("js") || sourceExtension.equals("txt") || sourceExtension.equals("xml")) { String sourceContent = HtmlUtil.escape(StringUtil.read(sourceIs)); sourceIs = new UnsyncByteArrayInputStream(sourceContent.getBytes(StringPool.UTF8)); }//from w ww . j a v a2 s. c o m FileVersion targetFileVersion = _dlAppLocalService.getFileVersion(targetFileVersionId); InputStream targetIs = targetFileVersion.getContentStream(false); String targetExtension = targetFileVersion.getExtension(); if (targetExtension.equals("css") || targetExtension.equals("htm") || targetExtension.equals("html") || targetExtension.equals("js") || targetExtension.equals("txt") || targetExtension.equals("xml")) { String targetContent = HtmlUtil.escape(StringUtil.read(targetIs)); targetIs = new UnsyncByteArrayInputStream(targetContent.getBytes(StringPool.UTF8)); } if (DocumentConversionUtil.isEnabled()) { if (DocumentConversionUtil.isConvertBeforeCompare(sourceExtension)) { String sourceTempFileId = DLUtil.getTempFileId(sourceFileVersion.getFileEntryId(), sourceFileVersion.getVersion()); sourceIs = new FileInputStream( DocumentConversionUtil.convert(sourceTempFileId, sourceIs, sourceExtension, "txt")); } if (DocumentConversionUtil.isConvertBeforeCompare(targetExtension)) { String targetTempFileId = DLUtil.getTempFileId(targetFileVersion.getFileEntryId(), targetFileVersion.getVersion()); targetIs = new FileInputStream( DocumentConversionUtil.convert(targetTempFileId, targetIs, targetExtension, "txt")); } } List<DiffResult>[] diffResults = DiffUtil.diff(new InputStreamReader(sourceIs), new InputStreamReader(targetIs)); renderRequest.setAttribute(WebKeys.DIFF_RESULTS, diffResults); renderRequest.setAttribute(WebKeys.SOURCE_NAME, sourceFileVersion.getTitle() + StringPool.SPACE + sourceFileVersion.getVersion()); renderRequest.setAttribute(WebKeys.TARGET_NAME, targetFileVersion.getTitle() + StringPool.SPACE + targetFileVersion.getVersion()); }
From source file:com.liferay.document.library.web.internal.template.DocumentLibraryPortletDisplayTemplateHandler.java
License:Open Source License
@Override public String getName(Locale locale) { String portletTitle = _portal.getPortletTitle(DLPortletKeys.DOCUMENT_LIBRARY, locale); return portletTitle.concat(StringPool.SPACE).concat(LanguageUtil.get(locale, "template")); }
From source file:com.liferay.document.library.web.social.DLFileEntryActivityInterpreter.java
License:Open Source License
@Override protected String getBody(SocialActivity activity, ServiceContext serviceContext) throws Exception { FileEntry fileEntry = _dlAppLocalService.getFileEntry(activity.getClassPK()); if (TrashUtil.isInTrash(DLFileEntry.class.getName(), fileEntry.getFileEntryId())) { return StringPool.BLANK; }//from w ww . ja v a 2 s . c o m StringBundler sb = new StringBundler(3); AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(DLFileEntry.class.getName()); AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(fileEntry.getFileEntryId()); String fileEntryLink = assetRenderer.getURLDownload(serviceContext.getThemeDisplay()); sb.append(wrapLink(fileEntryLink, "download-file", serviceContext)); sb.append(StringPool.SPACE); String folderLink = getFolderLink(fileEntry, serviceContext); folderLink = addNoSuchEntryRedirect(folderLink, DLFolder.class.getName(), fileEntry.getFolderId(), serviceContext); sb.append(wrapLink(folderLink, "go-to-folder", serviceContext)); return sb.toString(); }
From source file:com.liferay.dynamic.data.lists.form.web.internal.converter.DDLFormRuleToDDMFormRuleConverter.java
License:Open Source License
protected String convertConditions(String logicalOperator, List<DDLFormRuleCondition> ddlFormRuleConditions) { if (ddlFormRuleConditions.size() == 1) { return convertCondition(ddlFormRuleConditions.get(0)); }//from ww w . jav a 2 s. co m StringBundler sb = new StringBundler(ddlFormRuleConditions.size() * 4); for (DDLFormRuleCondition ddlFormRuleCondition : ddlFormRuleConditions) { sb.append(convertCondition(ddlFormRuleCondition)); sb.append(StringPool.SPACE); sb.append(logicalOperator); sb.append(StringPool.SPACE); } sb.setIndex(sb.index() - 3); return sb.toString(); }
From source file:com.liferay.dynamic.data.lists.web.internal.template.DDLDisplayTemplateHandler.java
License:Open Source License
@Override public String getName(Locale locale) { String portletTitle = _portal.getPortletTitle(DDLPortletKeys.DYNAMIC_DATA_LISTS, locale); return portletTitle.concat(StringPool.SPACE).concat(LanguageUtil.get(locale, "template")); }
From source file:com.liferay.faces.demos.bean.DocUploadBackingBean.java
License:Open Source License
protected String stripInvalidFileNameCharacters(String fileName) { String strippedFileName = fileName; if (strippedFileName != null) { strippedFileName = strippedFileName.replaceAll("[\\\\]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[/]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[:]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[*]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[?]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[\"]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[<]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[>]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[|]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[\\[]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[\\]]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[']", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll("[.][.]", StringPool.SPACE); strippedFileName = strippedFileName.replaceAll(" ", "_"); }// www . j a v a 2s .c o m return strippedFileName; }
From source file:com.liferay.faces.portal.validator.RichTextLengthValidator.java
License:Open Source License
protected int getPlainTextStringLength(Object value) { int cleanStringLenth = 0; if (value != null) { String cleanString = null; if (value instanceof String) { cleanString = (String) value; } else {//from www. j a v a 2 s. co m cleanString = value.toString(); } Matcher tagMatcher = TAG_PATTERN.matcher(cleanString); cleanString = tagMatcher.replaceAll(StringPool.BLANK); cleanString = cleanString.replaceAll(" ", StringPool.SPACE); cleanString = WHITESPACE_PATTERN.matcher(cleanString).replaceAll(StringPool.SPACE); cleanString = cleanString.trim(); cleanStringLenth = cleanString.length(); } return cleanStringLenth; }
From source file:com.liferay.google.apps.connector.GUser.java
License:Open Source License
public String getFullName() { return _firstName.concat(StringPool.SPACE).concat(_lastName); }
From source file:com.liferay.gs.hack.service.persistence.TimesheetTaskDurationPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(15); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("timesheetTaskDurationId"); sb.append(StringPool.EQUAL);// w w w .j a v a2s.c o m sb.append(timesheetTaskDurationId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("timesheetId"); sb.append(StringPool.EQUAL); sb.append(timesheetId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("timesheetTaskId"); sb.append(StringPool.EQUAL); sb.append(timesheetTaskId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.liferay.gs.hack.service.persistence.TimesheetTaskPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(15); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("timesheetTaskId"); sb.append(StringPool.EQUAL);//from ww w . j a va2 s. c o m sb.append(timesheetTaskId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("timesheetId"); sb.append(StringPool.EQUAL); sb.append(timesheetId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("projectTaskId"); sb.append(StringPool.EQUAL); sb.append(projectTaskId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }