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.wsrp.service.persistence.impl.WSRPConsumerPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WSRPConsumer> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w ww. ja va 2 s . c o m*/ Map<Serializable, WSRPConsumer> map = new HashMap<Serializable, WSRPConsumer>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WSRPConsumer wsrpConsumer = fetchByPrimaryKey(primaryKey); if (wsrpConsumer != null) { map.put(primaryKey, wsrpConsumer); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WSRPConsumer wsrpConsumer = (WSRPConsumer) EntityCacheUtil .getResult(WSRPConsumerModelImpl.ENTITY_CACHE_ENABLED, WSRPConsumerImpl.class, primaryKey); if (wsrpConsumer == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, wsrpConsumer); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WSRPCONSUMER_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 (WSRPConsumer wsrpConsumer : (List<WSRPConsumer>) q.list()) { map.put(wsrpConsumer.getPrimaryKeyObj(), wsrpConsumer); cacheResult(wsrpConsumer); uncachedPrimaryKeys.remove(wsrpConsumer.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(WSRPConsumerModelImpl.ENTITY_CACHE_ENABLED, WSRPConsumerImpl.class, primaryKey, _nullWSRPConsumer); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wsrp.service.persistence.impl.WSRPConsumerPortletPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WSRPConsumerPortlet> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*w w w . j a v a2 s. c om*/ Map<Serializable, WSRPConsumerPortlet> map = new HashMap<Serializable, WSRPConsumerPortlet>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WSRPConsumerPortlet wsrpConsumerPortlet = fetchByPrimaryKey(primaryKey); if (wsrpConsumerPortlet != null) { map.put(primaryKey, wsrpConsumerPortlet); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WSRPConsumerPortlet wsrpConsumerPortlet = (WSRPConsumerPortlet) EntityCacheUtil.getResult( WSRPConsumerPortletModelImpl.ENTITY_CACHE_ENABLED, WSRPConsumerPortletImpl.class, primaryKey); if (wsrpConsumerPortlet == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, wsrpConsumerPortlet); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WSRPCONSUMERPORTLET_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 (WSRPConsumerPortlet wsrpConsumerPortlet : (List<WSRPConsumerPortlet>) q.list()) { map.put(wsrpConsumerPortlet.getPrimaryKeyObj(), wsrpConsumerPortlet); cacheResult(wsrpConsumerPortlet); uncachedPrimaryKeys.remove(wsrpConsumerPortlet.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(WSRPConsumerPortletModelImpl.ENTITY_CACHE_ENABLED, WSRPConsumerPortletImpl.class, primaryKey, _nullWSRPConsumerPortlet); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wsrp.service.persistence.impl.WSRPProducerPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WSRPProducer> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w .j av a2 s .c o m Map<Serializable, WSRPProducer> map = new HashMap<Serializable, WSRPProducer>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WSRPProducer wsrpProducer = fetchByPrimaryKey(primaryKey); if (wsrpProducer != null) { map.put(primaryKey, wsrpProducer); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WSRPProducer wsrpProducer = (WSRPProducer) EntityCacheUtil .getResult(WSRPProducerModelImpl.ENTITY_CACHE_ENABLED, WSRPProducerImpl.class, primaryKey); if (wsrpProducer == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, wsrpProducer); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WSRPPRODUCER_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 (WSRPProducer wsrpProducer : (List<WSRPProducer>) q.list()) { map.put(wsrpProducer.getPrimaryKeyObj(), wsrpProducer); cacheResult(wsrpProducer); uncachedPrimaryKeys.remove(wsrpProducer.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(WSRPProducerModelImpl.ENTITY_CACHE_ENABLED, WSRPProducerImpl.class, primaryKey, _nullWSRPProducer); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.wsrp.util.MarkupCharacterSetsUtil.java
License:Open Source License
public static String getSupportedMarkupCharacterSets(String markupCharacterSets) { if (Validator.isNull(markupCharacterSets)) { return null; }//ww w. j ava2s. c o m if (!markupCharacterSets.contains(StringPool.UTF8)) { markupCharacterSets = markupCharacterSets.concat(StringPool.COMMA).concat(StringPool.UTF8); } return markupCharacterSets; }
From source file:com.lostsys.lists.service.persistence.TaskListPK.java
License:Open Source License
public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("portlet"); sb.append(StringPool.EQUAL);/*from ww w . j a v a2s . c om*/ sb.append(portlet); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("id"); sb.append(StringPool.EQUAL); sb.append(id); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.mimacom.service.service.persistence.impl.TaskPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Task> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// ww w . j ava2 s. c o m Map<Serializable, Task> map = new HashMap<Serializable, Task>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Task task = fetchByPrimaryKey(primaryKey); if (task != null) { map.put(primaryKey, task); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(TaskModelImpl.ENTITY_CACHE_ENABLED, TaskImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Task) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_TASK_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 (Task task : (List<Task>) q.list()) { map.put(task.getPrimaryKeyObj(), task); cacheResult(task); uncachedPrimaryKeys.remove(task.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(TaskModelImpl.ENTITY_CACHE_ENABLED, TaskImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.ms.internet.message.service.persistence.MSMReceiverPK.java
License:Open Source License
public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("userId"); sb.append(StringPool.EQUAL);//from w w w .ja v a 2 s. c om sb.append(userId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("messageId"); sb.append(StringPool.EQUAL); sb.append(messageId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.nyu.service.impl.LessonLocalServiceImpl.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public List<Lesson> search(String searchText, String searchType) throws SystemException { List<Lesson> lessons;/* w w w . ja v a 2 s .co m*/ DynamicQuery dynamicQuery; try { dynamicQuery = DynamicQueryFactoryUtil.forClass(LessonImpl.class); if (StringUtils.hasText(searchText)) { Criterion criterion = null; String[] searchTypeArr = searchType.split(StringPool.COMMA); criterion = RestrictionsFactoryUtil.like(searchTypeArr[0], StringPool.PERCENT + searchText + StringPool.PERCENT); if (searchTypeArr.length > 1) { for (int i = 1; i < searchTypeArr.length; i++) { criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil .like(searchTypeArr[i], StringPool.PERCENT + searchText + StringPool.PERCENT)); } } dynamicQuery.add(criterion); } lessons = LessonLocalServiceUtil.dynamicQuery(dynamicQuery); } catch (Exception e) { throw new SystemException(); } return lessons; }
From source file:com.nyu.service.impl.LessonLocalServiceImpl.java
License:Open Source License
@SuppressWarnings("unchecked") public List<Lesson> search(String searchText, String searchType, long companyId) throws SystemException { List<Lesson> lessons;/* w ww . j ava 2s. c o m*/ DynamicQuery dynamicQuery; try { dynamicQuery = DynamicQueryFactoryUtil.forClass(LessonImpl.class); if (StringUtils.hasText(searchText)) { Criterion criterion = null; String[] searchTypeArr = searchType.split(StringPool.COMMA); criterion = RestrictionsFactoryUtil.like(searchTypeArr[0], StringPool.PERCENT + searchText + StringPool.PERCENT); if (searchTypeArr.length > 1) { for (int i = 1; i < searchTypeArr.length; i++) { criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil .like(searchTypeArr[i], StringPool.PERCENT + searchText + StringPool.PERCENT)); } } criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.eq("companyId", companyId)); dynamicQuery.add(criterion); } lessons = LessonLocalServiceUtil.dynamicQuery(dynamicQuery); } catch (Exception e) { throw new SystemException(); } return lessons; }
From source file:com.nyu.service.persistence.FavouriteLessonsPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("userId"); sb.append(StringPool.EQUAL);//w w w . j a v a 2 s . c o m sb.append(userId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("lessonId"); sb.append(StringPool.EQUAL); sb.append(lessonId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }