List of usage examples for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS
String CLOSE_PARENTHESIS
To view the source code for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS.
Click Source Link
From source file:com.liferay.microblogs.service.persistence.impl.MicroblogsEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of microblogs entries where creatorClassNameId = ? and creatorClassPK = any ? and type = ?. * * @param creatorClassNameId the creator class name ID * @param creatorClassPKs the creator class p ks * @param type the type/*from ww w . j a v a 2 s . co m*/ * @return the number of matching microblogs entries */ @Override public int countByCCNI_CCPK_T(long creatorClassNameId, long[] creatorClassPKs, int type) { if (creatorClassPKs == null) { creatorClassPKs = new long[0]; } else { creatorClassPKs = ArrayUtil.unique(creatorClassPKs); } Object[] finderArgs = new Object[] { creatorClassNameId, StringUtil.merge(creatorClassPKs), type }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_CCNI_CCPK_T, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_MICROBLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_CCNI_CCPK_T_CREATORCLASSNAMEID_2); if (creatorClassPKs.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_CCNI_CCPK_T_CREATORCLASSPK_7); query.append(StringUtil.merge(creatorClassPKs)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CCNI_CCPK_T_TYPE_2); query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(creatorClassNameId); qPos.add(type); count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_CCNI_CCPK_T, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_CCNI_CCPK_T, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.liferay.microblogs.service.persistence.impl.MicroblogsEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of microblogs entries that the user has permission to view where creatorClassNameId = ? and creatorClassPK = any ? and type = ?. * * @param creatorClassNameId the creator class name ID * @param creatorClassPKs the creator class p ks * @param type the type/*w w w. j a va 2s . c o m*/ * @return the number of matching microblogs entries that the user has permission to view */ @Override public int filterCountByCCNI_CCPK_T(long creatorClassNameId, long[] creatorClassPKs, int type) { if (!InlineSQLHelperUtil.isEnabled()) { return countByCCNI_CCPK_T(creatorClassNameId, creatorClassPKs, type); } if (creatorClassPKs == null) { creatorClassPKs = new long[0]; } else { creatorClassPKs = ArrayUtil.unique(creatorClassPKs); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_MICROBLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_CCNI_CCPK_T_CREATORCLASSNAMEID_2); if (creatorClassPKs.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_CCNI_CCPK_T_CREATORCLASSPK_7); query.append(StringUtil.merge(creatorClassPKs)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); query.append(WHERE_AND); } query.append(_FINDER_COLUMN_CCNI_CCPK_T_TYPE_2_SQL); query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), MicroblogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(creatorClassNameId); qPos.add(type); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.microblogs.service.persistence.impl.MicroblogsEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, MicroblogsEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w ww . java2 s . c om Map<Serializable, MicroblogsEntry> map = new HashMap<Serializable, MicroblogsEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); MicroblogsEntry microblogsEntry = fetchByPrimaryKey(primaryKey); if (microblogsEntry != null) { map.put(primaryKey, microblogsEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { MicroblogsEntry microblogsEntry = (MicroblogsEntry) EntityCacheUtil.getResult( MicroblogsEntryModelImpl.ENTITY_CACHE_ENABLED, MicroblogsEntryImpl.class, primaryKey); if (microblogsEntry == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, microblogsEntry); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_MICROBLOGSENTRY_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 (MicroblogsEntry microblogsEntry : (List<MicroblogsEntry>) q.list()) { map.put(microblogsEntry.getPrimaryKeyObj(), microblogsEntry); cacheResult(microblogsEntry); uncachedPrimaryKeys.remove(microblogsEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(MicroblogsEntryModelImpl.ENTITY_CACHE_ENABLED, MicroblogsEntryImpl.class, primaryKey, _nullMicroblogsEntry); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.modules.wiki.extractor.service.persistence.impl.WikiContentPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WikiContent> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//w w w . jav a2 s.co m Map<Serializable, WikiContent> map = new HashMap<Serializable, WikiContent>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WikiContent wikiContent = fetchByPrimaryKey(primaryKey); if (wikiContent != null) { map.put(primaryKey, wikiContent); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(WikiContentModelImpl.ENTITY_CACHE_ENABLED, WikiContentImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (WikiContent) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WIKICONTENT_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 (WikiContent wikiContent : (List<WikiContent>) q.list()) { map.put(wikiContent.getPrimaryKeyObj(), wikiContent); cacheResult(wikiContent); uncachedPrimaryKeys.remove(wikiContent.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WikiContentModelImpl.ENTITY_CACHE_ENABLED, WikiContentImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.monitoring.service.persistence.impl.MetricPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Metric> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* ww w .j ava2s .c o m*/ Map<Serializable, Metric> map = new HashMap<Serializable, Metric>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Metric metric = fetchByPrimaryKey(primaryKey); if (metric != null) { map.put(primaryKey, metric); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Metric metric = (Metric) EntityCacheUtil.getResult(MetricModelImpl.ENTITY_CACHE_ENABLED, MetricImpl.class, primaryKey); if (metric == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, metric); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_METRIC_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 (Metric metric : (List<Metric>) q.list()) { map.put(metric.getPrimaryKeyObj(), metric); cacheResult(metric); uncachedPrimaryKeys.remove(metric.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(MetricModelImpl.ENTITY_CACHE_ENABLED, MetricImpl.class, primaryKey, _nullMetric); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.online.service.persistence.impl.AppPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, App> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// w w w . j a va 2 s .c o m Map<Serializable, App> map = new HashMap<Serializable, App>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); App app = fetchByPrimaryKey(primaryKey); if (app != null) { map.put(primaryKey, app); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { App app = (App) entityCache.getResult(AppModelImpl.ENTITY_CACHE_ENABLED, AppImpl.class, primaryKey); if (app == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, app); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_APP_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 (App app : (List<App>) q.list()) { map.put(app.getPrimaryKeyObj(), app); cacheResult(app); uncachedPrimaryKeys.remove(app.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AppModelImpl.ENTITY_CACHE_ENABLED, AppImpl.class, primaryKey, _nullApp); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.opensocial.service.persistence.impl.GadgetPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Gadget> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from ww w .j a va 2 s. co m Map<Serializable, Gadget> map = new HashMap<Serializable, Gadget>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Gadget gadget = fetchByPrimaryKey(primaryKey); if (gadget != null) { map.put(primaryKey, gadget); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Gadget gadget = (Gadget) EntityCacheUtil.getResult(GadgetModelImpl.ENTITY_CACHE_ENABLED, GadgetImpl.class, primaryKey); if (gadget == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, gadget); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_GADGET_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 (Gadget gadget : (List<Gadget>) q.list()) { map.put(gadget.getPrimaryKeyObj(), gadget); cacheResult(gadget); uncachedPrimaryKeys.remove(gadget.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(GadgetModelImpl.ENTITY_CACHE_ENABLED, GadgetImpl.class, primaryKey, _nullGadget); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.opensocial.service.persistence.impl.OAuthConsumerPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, OAuthConsumer> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j a v a2 s . c om*/ Map<Serializable, OAuthConsumer> map = new HashMap<Serializable, OAuthConsumer>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); OAuthConsumer oAuthConsumer = fetchByPrimaryKey(primaryKey); if (oAuthConsumer != null) { map.put(primaryKey, oAuthConsumer); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { OAuthConsumer oAuthConsumer = (OAuthConsumer) EntityCacheUtil .getResult(OAuthConsumerModelImpl.ENTITY_CACHE_ENABLED, OAuthConsumerImpl.class, primaryKey); if (oAuthConsumer == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, oAuthConsumer); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_OAUTHCONSUMER_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 (OAuthConsumer oAuthConsumer : (List<OAuthConsumer>) q.list()) { map.put(oAuthConsumer.getPrimaryKeyObj(), oAuthConsumer); cacheResult(oAuthConsumer); uncachedPrimaryKeys.remove(oAuthConsumer.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(OAuthConsumerModelImpl.ENTITY_CACHE_ENABLED, OAuthConsumerImpl.class, primaryKey, _nullOAuthConsumer); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.opensocial.service.persistence.impl.OAuthTokenPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, OAuthToken> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from ww w . j a va 2 s .co m*/ Map<Serializable, OAuthToken> map = new HashMap<Serializable, OAuthToken>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); OAuthToken oAuthToken = fetchByPrimaryKey(primaryKey); if (oAuthToken != null) { map.put(primaryKey, oAuthToken); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { OAuthToken oAuthToken = (OAuthToken) EntityCacheUtil.getResult(OAuthTokenModelImpl.ENTITY_CACHE_ENABLED, OAuthTokenImpl.class, primaryKey); if (oAuthToken == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, oAuthToken); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_OAUTHTOKEN_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 (OAuthToken oAuthToken : (List<OAuthToken>) q.list()) { map.put(oAuthToken.getPrimaryKeyObj(), oAuthToken); cacheResult(oAuthToken); uncachedPrimaryKeys.remove(oAuthToken.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(OAuthTokenModelImpl.ENTITY_CACHE_ENABLED, OAuthTokenImpl.class, primaryKey, _nullOAuthToken); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.osb.scv.user.mapper.service.persistence.impl.MappingDataSourcePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, MappingDataSource> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//w w w . ja va 2 s . com Map<Serializable, MappingDataSource> map = new HashMap<Serializable, MappingDataSource>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); MappingDataSource mappingDataSource = fetchByPrimaryKey(primaryKey); if (mappingDataSource != null) { map.put(primaryKey, mappingDataSource); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(MappingDataSourceModelImpl.ENTITY_CACHE_ENABLED, MappingDataSourceImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (MappingDataSource) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_MAPPINGDATASOURCE_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 (MappingDataSource mappingDataSource : (List<MappingDataSource>) q.list()) { map.put(mappingDataSource.getPrimaryKeyObj(), mappingDataSource); cacheResult(mappingDataSource); uncachedPrimaryKeys.remove(mappingDataSource.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(MappingDataSourceModelImpl.ENTITY_CACHE_ENABLED, MappingDataSourceImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }