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.socialcoding.service.persistence.impl.JIRAIssuePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, JIRAIssue> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . jav a 2 s . co m*/ Map<Serializable, JIRAIssue> map = new HashMap<Serializable, JIRAIssue>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); JIRAIssue jiraIssue = fetchByPrimaryKey(primaryKey); if (jiraIssue != null) { map.put(primaryKey, jiraIssue); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { JIRAIssue jiraIssue = (JIRAIssue) EntityCacheUtil.getResult(JIRAIssueModelImpl.ENTITY_CACHE_ENABLED, JIRAIssueImpl.class, primaryKey); if (jiraIssue == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, jiraIssue); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_JIRAISSUE_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 (JIRAIssue jiraIssue : (List<JIRAIssue>) q.list()) { map.put(jiraIssue.getPrimaryKeyObj(), jiraIssue); cacheResult(jiraIssue); uncachedPrimaryKeys.remove(jiraIssue.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(JIRAIssueModelImpl.ENTITY_CACHE_ENABLED, JIRAIssueImpl.class, primaryKey, _nullJIRAIssue); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialcoding.service.persistence.impl.JIRAProjectPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, JIRAProject> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*w ww. jav a2 s .co m*/ Map<Serializable, JIRAProject> map = new HashMap<Serializable, JIRAProject>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); JIRAProject jiraProject = fetchByPrimaryKey(primaryKey); if (jiraProject != null) { map.put(primaryKey, jiraProject); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { JIRAProject jiraProject = (JIRAProject) EntityCacheUtil .getResult(JIRAProjectModelImpl.ENTITY_CACHE_ENABLED, JIRAProjectImpl.class, primaryKey); if (jiraProject == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, jiraProject); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_JIRAPROJECT_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 (JIRAProject jiraProject : (List<JIRAProject>) q.list()) { map.put(jiraProject.getPrimaryKeyObj(), jiraProject); cacheResult(jiraProject); uncachedPrimaryKeys.remove(jiraProject.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(JIRAProjectModelImpl.ENTITY_CACHE_ENABLED, JIRAProjectImpl.class, primaryKey, _nullJIRAProject); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialcoding.service.persistence.impl.SVNRepositoryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SVNRepository> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* ww w . j av a2s. c o m*/ Map<Serializable, SVNRepository> map = new HashMap<Serializable, SVNRepository>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SVNRepository svnRepository = fetchByPrimaryKey(primaryKey); if (svnRepository != null) { map.put(primaryKey, svnRepository); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SVNRepository svnRepository = (SVNRepository) EntityCacheUtil .getResult(SVNRepositoryModelImpl.ENTITY_CACHE_ENABLED, SVNRepositoryImpl.class, primaryKey); if (svnRepository == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, svnRepository); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SVNREPOSITORY_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 (SVNRepository svnRepository : (List<SVNRepository>) q.list()) { map.put(svnRepository.getPrimaryKeyObj(), svnRepository); cacheResult(svnRepository); uncachedPrimaryKeys.remove(svnRepository.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(SVNRepositoryModelImpl.ENTITY_CACHE_ENABLED, SVNRepositoryImpl.class, primaryKey, _nullSVNRepository); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialcoding.service.persistence.impl.SVNRevisionPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SVNRevision> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* www . j a v a 2 s.c o m*/ Map<Serializable, SVNRevision> map = new HashMap<Serializable, SVNRevision>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SVNRevision svnRevision = fetchByPrimaryKey(primaryKey); if (svnRevision != null) { map.put(primaryKey, svnRevision); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SVNRevision svnRevision = (SVNRevision) EntityCacheUtil .getResult(SVNRevisionModelImpl.ENTITY_CACHE_ENABLED, SVNRevisionImpl.class, primaryKey); if (svnRevision == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, svnRevision); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SVNREVISION_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 (SVNRevision svnRevision : (List<SVNRevision>) q.list()) { map.put(svnRevision.getPrimaryKeyObj(), svnRevision); cacheResult(svnRevision); uncachedPrimaryKeys.remove(svnRevision.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(SVNRevisionModelImpl.ENTITY_CACHE_ENABLED, SVNRevisionImpl.class, primaryKey, _nullSVNRevision); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialnetworking.service.persistence.impl.MeetupsEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, MeetupsEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from ww w .j a va 2 s .c o m Map<Serializable, MeetupsEntry> map = new HashMap<Serializable, MeetupsEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); MeetupsEntry meetupsEntry = fetchByPrimaryKey(primaryKey); if (meetupsEntry != null) { map.put(primaryKey, meetupsEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { MeetupsEntry meetupsEntry = (MeetupsEntry) EntityCacheUtil .getResult(MeetupsEntryModelImpl.ENTITY_CACHE_ENABLED, MeetupsEntryImpl.class, primaryKey); if (meetupsEntry == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, meetupsEntry); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_MEETUPSENTRY_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 (MeetupsEntry meetupsEntry : (List<MeetupsEntry>) q.list()) { map.put(meetupsEntry.getPrimaryKeyObj(), meetupsEntry); cacheResult(meetupsEntry); uncachedPrimaryKeys.remove(meetupsEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(MeetupsEntryModelImpl.ENTITY_CACHE_ENABLED, MeetupsEntryImpl.class, primaryKey, _nullMeetupsEntry); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialnetworking.service.persistence.impl.MeetupsRegistrationPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, MeetupsRegistration> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*w w w .j a v a2 s . c om*/ Map<Serializable, MeetupsRegistration> map = new HashMap<Serializable, MeetupsRegistration>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); MeetupsRegistration meetupsRegistration = fetchByPrimaryKey(primaryKey); if (meetupsRegistration != null) { map.put(primaryKey, meetupsRegistration); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { MeetupsRegistration meetupsRegistration = (MeetupsRegistration) EntityCacheUtil.getResult( MeetupsRegistrationModelImpl.ENTITY_CACHE_ENABLED, MeetupsRegistrationImpl.class, primaryKey); if (meetupsRegistration == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, meetupsRegistration); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_MEETUPSREGISTRATION_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 (MeetupsRegistration meetupsRegistration : (List<MeetupsRegistration>) q.list()) { map.put(meetupsRegistration.getPrimaryKeyObj(), meetupsRegistration); cacheResult(meetupsRegistration); uncachedPrimaryKeys.remove(meetupsRegistration.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(MeetupsRegistrationModelImpl.ENTITY_CACHE_ENABLED, MeetupsRegistrationImpl.class, primaryKey, _nullMeetupsRegistration); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.socialnetworking.service.persistence.impl.WallEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WallEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// w w w .j a v a 2 s.c o m Map<Serializable, WallEntry> map = new HashMap<Serializable, WallEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WallEntry wallEntry = fetchByPrimaryKey(primaryKey); if (wallEntry != null) { map.put(primaryKey, wallEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WallEntry wallEntry = (WallEntry) EntityCacheUtil.getResult(WallEntryModelImpl.ENTITY_CACHE_ENABLED, WallEntryImpl.class, primaryKey); if (wallEntry == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, wallEntry); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WALLENTRY_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 (WallEntry wallEntry : (List<WallEntry>) q.list()) { map.put(wallEntry.getPrimaryKeyObj(), wallEntry); cacheResult(wallEntry); uncachedPrimaryKeys.remove(wallEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(WallEntryModelImpl.ENTITY_CACHE_ENABLED, WallEntryImpl.class, primaryKey, _nullWallEntry); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.sync.hook.upgrade.v1_0_1.UpgradeSyncDLObject.java
License:Open Source License
protected void updateColumn(String tableName, String columnName1, String columnName2, String columnName3, String primaryKeyColumnName, Object columnDefaultValue, String[] types) throws Exception { StringBundler sb = new StringBundler(types.length * 4 + 24); sb.append("update SyncDLObject set "); sb.append(columnName1);//from www. j av a2s . c o m sb.append(" = (select "); sb.append(columnName2); sb.append(" from "); sb.append(tableName); sb.append(" where ("); sb.append(tableName); sb.append(StringPool.PERIOD); sb.append(primaryKeyColumnName); sb.append(" = SyncDLObject.typePK"); if (columnName3 != null) { sb.append(" and "); sb.append(tableName); sb.append(StringPool.PERIOD); sb.append(columnName3); sb.append(" = SyncDLObject."); sb.append(columnName3); } sb.append(")) where ("); for (int i = 0; i < types.length; i++) { sb.append("type_ = '"); sb.append(types[i]); sb.append(StringPool.APOSTROPHE); if ((i + 1) < types.length) { sb.append(" or "); } } sb.append(") and ("); sb.append(columnName1); sb.append(" is null or "); sb.append(columnName1); sb.append(" = "); sb.append(columnDefaultValue); sb.append(StringPool.CLOSE_PARENTHESIS); runSQL(sb.toString()); }
From source file:com.liferay.sync.service.persistence.impl.SyncDevicePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SyncDevice> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* www. ja v a 2 s .c o m*/ Map<Serializable, SyncDevice> map = new HashMap<Serializable, SyncDevice>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SyncDevice syncDevice = fetchByPrimaryKey(primaryKey); if (syncDevice != null) { map.put(primaryKey, syncDevice); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SyncDevice syncDevice = (SyncDevice) entityCache.getResult(SyncDeviceModelImpl.ENTITY_CACHE_ENABLED, SyncDeviceImpl.class, primaryKey); if (syncDevice == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, syncDevice); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SYNCDEVICE_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 (SyncDevice syncDevice : (List<SyncDevice>) q.list()) { map.put(syncDevice.getPrimaryKeyObj(), syncDevice); cacheResult(syncDevice); uncachedPrimaryKeys.remove(syncDevice.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(SyncDeviceModelImpl.ENTITY_CACHE_ENABLED, SyncDeviceImpl.class, primaryKey, _nullSyncDevice); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.sync.service.persistence.impl.SyncDLFileVersionDiffPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SyncDLFileVersionDiff> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w ww.ja v a 2s .co m Map<Serializable, SyncDLFileVersionDiff> map = new HashMap<Serializable, SyncDLFileVersionDiff>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SyncDLFileVersionDiff syncDLFileVersionDiff = fetchByPrimaryKey(primaryKey); if (syncDLFileVersionDiff != null) { map.put(primaryKey, syncDLFileVersionDiff); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SyncDLFileVersionDiff syncDLFileVersionDiff = (SyncDLFileVersionDiff) EntityCacheUtil.getResult( SyncDLFileVersionDiffModelImpl.ENTITY_CACHE_ENABLED, SyncDLFileVersionDiffImpl.class, primaryKey); if (syncDLFileVersionDiff == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, syncDLFileVersionDiff); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SYNCDLFILEVERSIONDIFF_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 (SyncDLFileVersionDiff syncDLFileVersionDiff : (List<SyncDLFileVersionDiff>) q.list()) { map.put(syncDLFileVersionDiff.getPrimaryKeyObj(), syncDLFileVersionDiff); cacheResult(syncDLFileVersionDiff); uncachedPrimaryKeys.remove(syncDLFileVersionDiff.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(SyncDLFileVersionDiffModelImpl.ENTITY_CACHE_ENABLED, SyncDLFileVersionDiffImpl.class, primaryKey, _nullSyncDLFileVersionDiff); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }