List of usage examples for com.liferay.portal.kernel.util StringPool COMMA
String COMMA
To view the source code for com.liferay.portal.kernel.util StringPool COMMA.
Click Source Link
From source file:com.liferay.util.bridges.mvc.MVCPortlet.java
License:Open Source License
@Override protected boolean callActionMethod(ActionRequest request, ActionResponse response) throws PortletException { if (_actionCommandCache == null) { return super.callActionMethod(request, response); }//from w w w . j a v a 2 s. c om String actionName = ParamUtil.getString(request, ActionRequest.ACTION_NAME); if (!actionName.contains(StringPool.COMMA)) { ActionCommand actionCommand = _actionCommandCache.getActionCommand(actionName); if (actionCommand != ActionCommandCache.EMPTY) { return actionCommand.processCommand(request, response); } } else { List<ActionCommand> actionCommands = _actionCommandCache.getActionCommandChain(actionName); if (actionCommands.isEmpty()) { return false; } for (ActionCommand actionCommand : actionCommands) { if (!actionCommand.processCommand(request, response)) { return false; } } return true; } return false; }
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 w w. ja v a 2 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.liferay.util.mail.InternetAddressUtil.java
License:Open Source License
public static String toString(Address[] addresses) { if ((addresses == null) || (addresses.length == 0)) { return StringPool.BLANK; }/*from ww w . ja v a2 s . c om*/ StringBundler sb = new StringBundler(addresses.length * 3 - 2); if (addresses != null) { for (int i = 0; i < addresses.length; i++) { sb.append(toString(addresses[i])); if (i < addresses.length - 1) { sb.append(StringPool.COMMA); sb.append(StringPool.NBSP); } } } return sb.toString(); }
From source file:com.liferay.video.library.service.persistence.impl.VideoPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Video> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*w w w. ja v a 2s. co m*/ Map<Serializable, Video> map = new HashMap<Serializable, Video>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Video video = fetchByPrimaryKey(primaryKey); if (video != null) { map.put(primaryKey, video); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(VideoModelImpl.ENTITY_CACHE_ENABLED, VideoImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Video) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_VIDEO_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (Video video : (List<Video>) q.list()) { map.put(video.getPrimaryKeyObj(), video); cacheResult(video); uncachedPrimaryKeys.remove(video.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(VideoModelImpl.ENTITY_CACHE_ENABLED, VideoImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.vldap.server.directory.BaseDirectory.java
License:Open Source License
public BaseDirectory(String name, Directory parentDirectory) throws Exception { name = escape(name.trim());/* w w w. j a v a2 s. c om*/ if (parentDirectory != null) { _parentDirectory = parentDirectory; name += StringPool.COMMA + parentDirectory.getName(); } try { _name = new DN(name); } catch (Exception e) { _log.error("Invalid name " + name); throw e; } }
From source file:com.liferay.web.extender.internal.webbundle.WebBundleProcessor.java
License:Open Source License
protected void processExportImportPackage(Attributes attributes) throws IOException { for (String packageName : _referencedPackages) { if (packageName.startsWith("java.") || _jarProvidedPackages.contains(packageName)) { continue; }/*from w w w . ja v a 2 s .com*/ if (_classProvidedPackages.contains(packageName)) { _exportPackages.add(packageName); } else { _importPackages.add(packageName); } } for (String packageName : _classProvidedPackages) { _exportPackages.add(packageName); } if (!_exportPackages.isEmpty()) { Collections.sort(_exportPackages); String exportPackages = StringUtil.merge(_exportPackages, ";version=\"".concat(_version).concat("\",")); attributes.putValue(Constants.EXPORT_PACKAGE, exportPackages.concat(";version=\"").concat(_version).concat("\"")); } String importPackage = MapUtil.getString(_parameterMap, Constants.IMPORT_PACKAGE); if (Validator.isNotNull(importPackage)) { attributes.putValue(Constants.IMPORT_PACKAGE, importPackage); } else if (!_importPackages.isEmpty()) { Collections.sort(_importPackages); String importPackages = StringUtil.merge(_importPackages, StringPool.COMMA); attributes.putValue(Constants.IMPORT_PACKAGE, importPackages); } }
From source file:com.liferay.wiki.service.persistence.impl.WikiNodePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WikiNode> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from www . j a v a2 s .c om Map<Serializable, WikiNode> map = new HashMap<Serializable, WikiNode>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WikiNode wikiNode = fetchByPrimaryKey(primaryKey); if (wikiNode != null) { map.put(primaryKey, wikiNode); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED, WikiNodeImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (WikiNode) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WIKINODE_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (WikiNode wikiNode : (List<WikiNode>) q.list()) { map.put(wikiNode.getPrimaryKeyObj(), wikiNode); cacheResult(wikiNode); uncachedPrimaryKeys.remove(wikiNode.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WikiNodeModelImpl.ENTITY_CACHE_ENABLED, WikiNodeImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wiki.service.persistence.impl.WikiPagePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WikiPage> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w .j ava2 s . c o m*/ Map<Serializable, WikiPage> map = new HashMap<Serializable, WikiPage>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WikiPage wikiPage = fetchByPrimaryKey(primaryKey); if (wikiPage != null) { map.put(primaryKey, wikiPage); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED, WikiPageImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (WikiPage) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WIKIPAGE_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (WikiPage wikiPage : (List<WikiPage>) q.list()) { map.put(wikiPage.getPrimaryKeyObj(), wikiPage); cacheResult(wikiPage); uncachedPrimaryKeys.remove(wikiPage.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WikiPageModelImpl.ENTITY_CACHE_ENABLED, WikiPageImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wiki.service.persistence.impl.WikiPageResourcePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WikiPageResource> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j ava 2 s. c o m*/ Map<Serializable, WikiPageResource> map = new HashMap<Serializable, WikiPageResource>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WikiPageResource wikiPageResource = fetchByPrimaryKey(primaryKey); if (wikiPageResource != null) { map.put(primaryKey, wikiPageResource); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED, WikiPageResourceImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (WikiPageResource) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WIKIPAGERESOURCE_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(String.valueOf(primaryKey)); query.append(StringPool.COMMA); } query.setIndex(query.index() - 1); query.append(StringPool.CLOSE_PARENTHESIS); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); for (WikiPageResource wikiPageResource : (List<WikiPageResource>) q.list()) { map.put(wikiPageResource.getPrimaryKeyObj(), wikiPageResource); cacheResult(wikiPageResource); uncachedPrimaryKeys.remove(wikiPageResource.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WikiPageResourceModelImpl.ENTITY_CACHE_ENABLED, WikiPageResourceImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wiki.web.internal.portlet.action.EditPageAttachmentsMVCActionCommand.java
License:Open Source License
/** * TODO: Remove. This should extend from EditFileEntryAction once it is * modularized./*from w w w . j a v a 2 s.com*/ */ protected String[] getAllowedFileExtensions(PortletConfig portletConfig, PortletRequest portletRequest, PortletResponse portletResponse) throws PortalException { return PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA); }