List of usage examples for com.liferay.portal.kernel.util StringPool CLOSE_BRACKET
String CLOSE_BRACKET
To view the source code for com.liferay.portal.kernel.util StringPool CLOSE_BRACKET.
Click Source Link
From source file:au.com.permeance.liferay.portlet.documentlibrary.service.impl.DLFolderExportZipHelper.java
License:Open Source License
/** * Returns a ZIP entry name for the file entry. * // w w w .j a v a 2 s . c o m * @param fileEntry file entry * @param folderPath file path * @param zipWriter ZIP writer * * @return ZIP entry name * * @throws SystemException * @throws PortalException */ public static String buildZipEntryName(FileEntry fileEntry, String folderPath, ZipWriter zipWriter) throws SystemException, PortalException { // Use file entry title as file name String fileEntryBaseName = fileEntry.getTitle(); // normalize base name by stripping extension and replacing non-alphanum chars with underscore fileEntryBaseName = FilenameUtils.getBaseName(fileEntryBaseName); fileEntryBaseName = fileEntryBaseName.replaceAll("\\W+", "_"); // build zip entry name String zipEntryName = folderPath + fileEntryBaseName + FilenameUtils.EXTENSION_SEPARATOR_STR + fileEntry.getExtension(); if (zipWriter.hasAllocatedPath(zipEntryName)) { String oldZipEntryName = zipEntryName; int counter = 1; while (true) { zipEntryName = folderPath + fileEntryBaseName + StringPool.OPEN_BRACKET + counter + StringPool.CLOSE_BRACKET + FilenameUtils.EXTENSION_SEPARATOR_STR + fileEntry.getExtension(); if (!zipWriter.hasAllocatedPath(zipEntryName)) { break; } counter++; } if (s_log.isDebugEnabled()) { s_log.debug(oldZipEntryName + " already exists in ZIP file, renaming to " + zipEntryName); } } return zipEntryName; }
From source file:com.liferay.journal.internal.util.impl.JournalConverterImpl.java
License:Open Source License
protected Element fetchMetadataEntry(Element parentElement, String attributeName, String attributeValue) { StringBundler sb = new StringBundler(5); sb.append("entry[@"); sb.append(attributeName);// w w w . j a va 2 s . co m sb.append(StringPool.EQUAL); sb.append(HtmlUtil.escapeXPathAttribute(attributeValue)); sb.append(StringPool.CLOSE_BRACKET); XPath xPathSelector = SAXReaderUtil.createXPath(sb.toString()); return (Element) xPathSelector.selectSingleNode(parentElement); }
From source file:com.liferay.portlet.documentlibrary.util.LiferayVideoConverter.java
License:Open Source License
protected void initVideoFrameRateMap(Properties videoProperties) { _videoFrameRateMap = new HashMap<String, IRational>(); for (String previewVideoContainer : _previewVideoContainers) { int numerator = GetterUtil.getInteger( videoProperties.getProperty(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO_FRAME_RATE_NUMERATOR + "[" + previewVideoContainer + "]")); int denominator = GetterUtil.getInteger( videoProperties.getProperty(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO_FRAME_RATE_DENOMINATOR + StringPool.OPEN_BRACKET + previewVideoContainer + StringPool.CLOSE_BRACKET)); if ((numerator > 0) && (denominator > 0)) { IRational iRational = IRational.make(numerator, denominator); _videoFrameRateMap.put(previewVideoContainer, iRational); if (_log.isInfoEnabled()) { _log.info("Frame rate for " + previewVideoContainer + " set to " + iRational.getNumerator() + "/" + iRational.getDenominator()); }//from w ww .ja v a2s.c o m } } }
From source file:com.liferay.portlet.dynamicdatamapping.storage.XMLStorageAdapter.java
License:Open Source License
private XPath _parseCondition(Condition condition) { StringBundler sb = new StringBundler(4); sb.append("//dynamic-element"); sb.append(StringPool.OPEN_BRACKET);/*www . jav a2s . co m*/ sb.append(_toXPath(condition)); sb.append(StringPool.CLOSE_BRACKET); return SAXReaderUtil.createXPath(sb.toString()); }
From source file:com.liferay.util.JS.java
License:Open Source License
public static String toScript(String[] array) { StringBundler sb = new StringBundler(array.length * 4 + 2); sb.append(StringPool.OPEN_BRACKET);//w ww . j a v a2 s .co m for (int i = 0; i < array.length; i++) { sb.append(StringPool.APOSTROPHE); sb.append(UnicodeFormatter.toString(array[i])); sb.append(StringPool.APOSTROPHE); if (i + 1 < array.length) { sb.append(StringPool.COMMA); } } sb.append(StringPool.CLOSE_BRACKET); return sb.toString(); }
From source file:com.rivetlogic.portal.search.elasticsearch.util.ElasticsearchHelper.java
License:Open Source License
/** * Builds the range term./* ww w. j a va 2 s . c o m*/ * * @param entry the entry * @return the string */ private String buildRangeTerm(org.elasticsearch.search.facet.range.RangeFacet.Entry entry) { StringBuilder termBuilder = new StringBuilder(); termBuilder.append(StringPool.OPEN_BRACKET); termBuilder.append(entry.getFromAsString()); termBuilder.append(StringPool.SPACE); termBuilder.append(ElasticsearchIndexerConstants.ELASTIC_SEARCH_TO); termBuilder.append(StringPool.SPACE); termBuilder.append(entry.getToAsString()); termBuilder.append(StringPool.CLOSE_BRACKET); return termBuilder.toString(); }