List of usage examples for com.liferay.portal.kernel.util StringPool PERIOD
String PERIOD
To view the source code for com.liferay.portal.kernel.util StringPool PERIOD.
Click Source Link
From source file:com.liferay.document.library.internal.instance.lifecycle.AddDefaultDocumentLibraryStructuresPortalInstanceLifecycleListener.java
License:Open Source License
protected String buildDLRawMetadataElementXML(Field field, Locale locale) { StringBundler sb = new StringBundler(14); sb.append("<dynamic-element dataType=\"string\" indexType=\"text\" "); sb.append("name=\""); Class<?> fieldClass = field.getDeclaringClass(); sb.append(fieldClass.getSimpleName()); sb.append(StringPool.UNDERLINE);//from w ww .j a v a 2 s .c o m sb.append(field.getName()); sb.append("\" localizable=\"false\" required=\"false\" "); sb.append("showLabel=\"true\" type=\"text\"><meta-data locale=\""); sb.append(locale); sb.append("\"><entry name=\"label\"><![CDATA[metadata."); sb.append(fieldClass.getSimpleName()); sb.append(StringPool.PERIOD); sb.append(field.getName()); sb.append("]]></entry><entry name=\"predefinedValue\">"); sb.append("<![CDATA[]]></entry></meta-data></dynamic-element>"); return sb.toString(); }
From source file:com.liferay.document.library.repository.cmis.internal.CMISRepositoryDetector.java
License:Open Source License
/** * Detects the version number for the Nuxeo repository. * * @param repositoryInfo the repository description *//* w ww .j a v a2s. c o m*/ protected void detectNuxeo(RepositoryInfo repositoryInfo) { String productVersion = repositoryInfo.getProductVersion(); String[] versionParts = StringUtil.split(productVersion, StringPool.PERIOD); int major = GetterUtil.getInteger(versionParts[0]); int minor = GetterUtil.getInteger(versionParts[1]); if (major > 5) { _nuxeo5_8OrHigher = true; _nuxeo5_5OrHigher = true; } else if (major == 5) { if (minor >= 8) { _nuxeo5_8OrHigher = true; } if (minor >= 5) { _nuxeo5_5OrHigher = true; } if (minor == 4) { _nuxeo5_4 = true; } } }
From source file:com.liferay.document.library.web.asset.DLFileEntryAssetRenderer.java
License:Open Source License
@Override public String getNewName(String oldName, String token) { String extension = FileUtil.getExtension(oldName); if (Validator.isNull(extension)) { return super.getNewName(oldName, token); }//from w w w .j a va 2s .c om StringBundler sb = new StringBundler(5); int index = oldName.lastIndexOf(CharPool.PERIOD); sb.append(oldName.substring(0, index)); sb.append(StringPool.SPACE); sb.append(token); sb.append(StringPool.PERIOD); sb.append(extension); return sb.toString(); }
From source file:com.liferay.document.library.web.internal.portlet.action.GetFileActionHelper.java
License:Open Source License
protected void getFile(long fileEntryId, long folderId, String name, String title, String version, long fileShortcutId, String uuid, long groupId, String targetExtension, HttpServletRequest request, HttpServletResponse response) throws Exception { if (name.startsWith("DLFE-")) { name = name.substring(5);//ww w. j ava 2 s . co m } name = FileUtil.stripExtension(name); FileEntry fileEntry = null; if (Validator.isNotNull(uuid) && (groupId > 0)) { fileEntry = DLAppServiceUtil.getFileEntryByUuidAndGroupId(uuid, groupId); folderId = fileEntry.getFolderId(); } if (fileEntryId > 0) { fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId); } else if (fileShortcutId <= 0) { if (Validator.isNotNull(title)) { fileEntry = DLAppServiceUtil.getFileEntry(groupId, folderId, title); } else if (Validator.isNotNull(name)) { DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.fetchFileEntryByName(groupId, folderId, name); if (dlFileEntry == null) { // LPS-30374 List<DLFileEntry> dlFileEntries = DLFileEntryLocalServiceUtil.getFileEntries(folderId, name); if (!dlFileEntries.isEmpty()) { dlFileEntry = dlFileEntries.get(0); } } if (dlFileEntry != null) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); DLFileEntryPermission.check(permissionChecker, dlFileEntry, ActionKeys.VIEW); fileEntry = new LiferayFileEntry(dlFileEntry); } } } else { FileShortcut fileShortcut = DLAppServiceUtil.getFileShortcut(fileShortcutId); fileEntryId = fileShortcut.getToFileEntryId(); fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId); } if (Validator.isNull(version)) { if ((fileEntry != null) && Validator.isNotNull(fileEntry.getVersion())) { version = fileEntry.getVersion(); } else { throw new NoSuchFileEntryException("{fileEntryId=" + fileEntryId + "}"); } } FileVersion fileVersion = fileEntry.getFileVersion(version); InputStream is = fileVersion.getContentStream(true); String fileName = fileVersion.getTitle(); String sourceExtension = fileVersion.getExtension(); if (Validator.isNotNull(sourceExtension) && !fileName.endsWith(StringPool.PERIOD + sourceExtension)) { fileName += StringPool.PERIOD + sourceExtension; } long contentLength = fileVersion.getSize(); String contentType = fileVersion.getMimeType(); if (Validator.isNotNull(targetExtension)) { String id = DLUtil.getTempFileId(fileEntry.getFileEntryId(), version); File convertedFile = DocumentConversionUtil.convert(id, is, sourceExtension, targetExtension); if (convertedFile != null) { fileName = FileUtil.stripExtension(fileName).concat(StringPool.PERIOD).concat(targetExtension); is = new FileInputStream(convertedFile); contentLength = convertedFile.length(); contentType = MimeTypesUtil.getContentType(fileName); } } FlashMagicBytesUtil.Result flashMagicBytesUtilResult = FlashMagicBytesUtil.check(is); if (flashMagicBytesUtilResult.isFlash()) { fileName = FileUtil.stripExtension(fileName) + ".swf"; } is = flashMagicBytesUtilResult.getInputStream(); ServletResponseUtil.sendFile(request, response, fileName, is, contentLength, contentType); }
From source file:com.liferay.dynamic.data.lists.service.impl.DDLRecordLocalServiceImpl.java
License:Open Source License
protected String getNextVersion(String version, boolean majorVersion, int workflowAction) { if (workflowAction == WorkflowConstants.ACTION_SAVE_DRAFT) { majorVersion = false;//from ww w. j a va2 s . com } int[] versionParts = StringUtil.split(version, StringPool.PERIOD, 0); if (majorVersion) { versionParts[0]++; versionParts[1] = 0; } else { versionParts[1]++; } return versionParts[0] + StringPool.PERIOD + versionParts[1]; }
From source file:com.liferay.dynamic.data.lists.util.comparator.DDLRecordVersionVersionComparator.java
License:Open Source License
@Override public int compare(DDLRecordVersion recordVersion1, DDLRecordVersion recordVersion2) { int value = 0; String version1 = recordVersion1.getVersion(); String version2 = recordVersion2.getVersion(); int[] versionParts1 = StringUtil.split(version1, StringPool.PERIOD, 0); int[] versionParts2 = StringUtil.split(version2, StringPool.PERIOD, 0); if ((versionParts1.length != 2) && (versionParts2.length != 2)) { value = 0;/*from w w w .j a v a 2s . c o m*/ } else if (versionParts1.length != 2) { value = -1; } else if (versionParts2.length != 2) { value = 1; } else if (versionParts1[0] > versionParts2[0]) { value = 1; } else if (versionParts1[0] < versionParts2[0]) { value = -1; } else if (versionParts1[1] > versionParts2[1]) { value = 1; } else if (versionParts1[1] < versionParts2[1]) { value = -1; } if (_ascending) { return value; } else { return -value; } }
From source file:com.liferay.dynamic.data.mapping.service.impl.DDMFormInstanceLocalServiceImpl.java
License:Open Source License
protected String getNextVersion(String version, boolean majorVersion) { int[] versionParts = StringUtil.split(version, StringPool.PERIOD, 0); if (majorVersion) { versionParts[0]++;//w w w . j a v a2s . c o m versionParts[1] = 0; } else { versionParts[1]++; } return versionParts[0] + StringPool.PERIOD + versionParts[1]; }
From source file:com.liferay.dynamic.data.mapping.util.comparator.FormInstanceRecordVersionVersionComparator.java
License:Open Source License
@Override public int compare(DDMFormInstanceRecordVersion ddmFormInstanceRecordVersion1, DDMFormInstanceRecordVersion ddmFormInstanceRecordVersion2) { int value = 0; String version1 = ddmFormInstanceRecordVersion1.getVersion(); String version2 = ddmFormInstanceRecordVersion2.getVersion(); int[] versionParts1 = StringUtil.split(version1, StringPool.PERIOD, 0); int[] versionParts2 = StringUtil.split(version2, StringPool.PERIOD, 0); if ((versionParts1.length != 2) && (versionParts2.length != 2)) { value = 0;/*from w ww . j a v a2s . c o m*/ } else if (versionParts1.length != 2) { value = -1; } else if (versionParts2.length != 2) { value = 1; } else if (versionParts1[0] > versionParts2[0]) { value = 1; } else if (versionParts1[0] < versionParts2[0]) { value = -1; } else if (versionParts1[1] > versionParts2[1]) { value = 1; } else if (versionParts1[1] < versionParts2[1]) { value = -1; } if (_ascending) { return value; } else { return -value; } }
From source file:com.liferay.dynamic.data.mapping.util.comparator.FormInstanceVersionVersionComparator.java
License:Open Source License
@Override public int compare(DDMFormInstanceVersion ddmFormInstanceVersion1, DDMFormInstanceVersion ddmFormInstanceVersion2) { int value = 0; String version1 = ddmFormInstanceVersion1.getVersion(); String version2 = ddmFormInstanceVersion2.getVersion(); int[] versionParts1 = StringUtil.split(version1, StringPool.PERIOD, 0); int[] versionParts2 = StringUtil.split(version2, StringPool.PERIOD, 0); if ((versionParts1.length != 2) && (versionParts2.length != 2)) { value = 0;// w w w .j av a 2 s . com } else if (versionParts1.length != 2) { value = -1; } else if (versionParts2.length != 2) { value = 1; } else if (versionParts1[0] > versionParts2[0]) { value = 1; } else if (versionParts1[0] < versionParts2[0]) { value = -1; } else if (versionParts1[1] > versionParts2[1]) { value = 1; } else if (versionParts1[1] < versionParts2[1]) { value = -1; } if (_ascending) { return value; } else { return -value; } }
From source file:com.liferay.extension.mvc.MVCPortletExtended.java
License:Open Source License
protected String getMVCPathAttributeName(String namespace) { return namespace.concat(StringPool.PERIOD).concat(MVCRenderConstantsExt.MVC_PATH_REQUEST_ATTRIBUTE_NAME); }