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.marketplace.service.persistence.impl.AppPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, App> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*www. j a va2 s. co 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) EntityCacheUtil.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) { EntityCacheUtil.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.marketplace.service.persistence.impl.ModulePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Module> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from ww w . jav a 2 s .c o m Map<Serializable, Module> map = new HashMap<Serializable, Module>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Module module = fetchByPrimaryKey(primaryKey); if (module != null) { map.put(primaryKey, module); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Module module = (Module) EntityCacheUtil.getResult(ModuleModelImpl.ENTITY_CACHE_ENABLED, ModuleImpl.class, primaryKey); if (module == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, module); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_MODULE_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 (Module module : (List<Module>) q.list()) { map.put(module.getPrimaryKeyObj(), module); cacheResult(module); uncachedPrimaryKeys.remove(module.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(ModuleModelImpl.ENTITY_CACHE_ENABLED, ModuleImpl.class, primaryKey, _nullModule); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.maven.test.sb.service.persistence.impl.AssignmentPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Assignment> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*w w w. j a va 2 s .com*/ Map<Serializable, Assignment> map = new HashMap<Serializable, Assignment>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Assignment assignment = fetchByPrimaryKey(primaryKey); if (assignment != null) { map.put(primaryKey, assignment); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(AssignmentModelImpl.ENTITY_CACHE_ENABLED, AssignmentImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Assignment) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ASSIGNMENT_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 (Assignment assignment : (List<Assignment>) q.list()) { map.put(assignment.getPrimaryKeyObj(), assignment); cacheResult(assignment); uncachedPrimaryKeys.remove(assignment.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AssignmentModelImpl.ENTITY_CACHE_ENABLED, AssignmentImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.maven.test.sb.service.persistence.impl.SubmissionPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Submission> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w . ja v a 2s . c o m Map<Serializable, Submission> map = new HashMap<Serializable, Submission>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Submission submission = fetchByPrimaryKey(primaryKey); if (submission != null) { map.put(primaryKey, submission); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(SubmissionModelImpl.ENTITY_CACHE_ENABLED, SubmissionImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Submission) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SUBMISSION_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 (Submission submission : (List<Submission>) q.list()) { map.put(submission.getPrimaryKeyObj(), submission); cacheResult(submission); uncachedPrimaryKeys.remove(submission.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(SubmissionModelImpl.ENTITY_CACHE_ENABLED, SubmissionImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.meeting.webex.service.persistence.impl.WebExAccountPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WebExAccount> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// w ww . ja v a 2 s . co m Map<Serializable, WebExAccount> map = new HashMap<Serializable, WebExAccount>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WebExAccount webExAccount = fetchByPrimaryKey(primaryKey); if (webExAccount != null) { map.put(primaryKey, webExAccount); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WebExAccount webExAccount = (WebExAccount) entityCache .getResult(WebExAccountModelImpl.ENTITY_CACHE_ENABLED, WebExAccountImpl.class, primaryKey); if (webExAccount == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, webExAccount); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WEBEXACCOUNT_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 (WebExAccount webExAccount : (List<WebExAccount>) q.list()) { map.put(webExAccount.getPrimaryKeyObj(), webExAccount); cacheResult(webExAccount); uncachedPrimaryKeys.remove(webExAccount.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WebExAccountModelImpl.ENTITY_CACHE_ENABLED, WebExAccountImpl.class, primaryKey, _nullWebExAccount); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.meeting.webex.service.persistence.impl.WebExSitePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, WebExSite> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j a v a2 s .c o m*/ Map<Serializable, WebExSite> map = new HashMap<Serializable, WebExSite>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); WebExSite webExSite = fetchByPrimaryKey(primaryKey); if (webExSite != null) { map.put(primaryKey, webExSite); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { WebExSite webExSite = (WebExSite) entityCache.getResult(WebExSiteModelImpl.ENTITY_CACHE_ENABLED, WebExSiteImpl.class, primaryKey); if (webExSite == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, webExSite); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_WEBEXSITE_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 (WebExSite webExSite : (List<WebExSite>) q.list()) { map.put(webExSite.getPrimaryKeyObj(), webExSite); cacheResult(webExSite); uncachedPrimaryKeys.remove(webExSite.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(WebExSiteModelImpl.ENTITY_CACHE_ENABLED, WebExSiteImpl.class, primaryKey, _nullWebExSite); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.micro.maintainance.analysis.service.persistence.impl.AnalysisEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, AnalysisEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w .ja va 2 s. c o m Map<Serializable, AnalysisEntry> map = new HashMap<Serializable, AnalysisEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); AnalysisEntry analysisEntry = fetchByPrimaryKey(primaryKey); if (analysisEntry != null) { map.put(primaryKey, analysisEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(AnalysisEntryModelImpl.ENTITY_CACHE_ENABLED, AnalysisEntryImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (AnalysisEntry) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ANALYSISENTRY_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 (AnalysisEntry analysisEntry : (List<AnalysisEntry>) q.list()) { map.put(analysisEntry.getPrimaryKeyObj(), analysisEntry); cacheResult(analysisEntry); uncachedPrimaryKeys.remove(analysisEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AnalysisEntryModelImpl.ENTITY_CACHE_ENABLED, AnalysisEntryImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.micro.maintainance.analysis.service.persistence.impl.AnalysisUserPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, AnalysisUser> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* w w w . j a va 2s . c o m*/ Map<Serializable, AnalysisUser> map = new HashMap<Serializable, AnalysisUser>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); AnalysisUser analysisUser = fetchByPrimaryKey(primaryKey); if (analysisUser != null) { map.put(primaryKey, analysisUser); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(AnalysisUserModelImpl.ENTITY_CACHE_ENABLED, AnalysisUserImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (AnalysisUser) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ANALYSISUSER_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 (AnalysisUser analysisUser : (List<AnalysisUser>) q.list()) { map.put(analysisUser.getPrimaryKeyObj(), analysisUser); cacheResult(analysisUser); uncachedPrimaryKeys.remove(analysisUser.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AnalysisUserModelImpl.ENTITY_CACHE_ENABLED, AnalysisUserImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.micro.maintainance.candidate.service.persistence.impl.CandidateEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, CandidateEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w. ja va2 s. c om Map<Serializable, CandidateEntry> map = new HashMap<Serializable, CandidateEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); CandidateEntry candidateEntry = fetchByPrimaryKey(primaryKey); if (candidateEntry != null) { map.put(primaryKey, candidateEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(CandidateEntryModelImpl.ENTITY_CACHE_ENABLED, CandidateEntryImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (CandidateEntry) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_CANDIDATEENTRY_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 (CandidateEntry candidateEntry : (List<CandidateEntry>) q.list()) { map.put(candidateEntry.getPrimaryKeyObj(), candidateEntry); cacheResult(candidateEntry); uncachedPrimaryKeys.remove(candidateEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(CandidateEntryModelImpl.ENTITY_CACHE_ENABLED, CandidateEntryImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.micro.maintainance.decision.service.persistence.impl.DecisionEntryPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, DecisionEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*ww w . j a v a 2 s .co m*/ Map<Serializable, DecisionEntry> map = new HashMap<Serializable, DecisionEntry>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); DecisionEntry decisionEntry = fetchByPrimaryKey(primaryKey); if (decisionEntry != null) { map.put(primaryKey, decisionEntry); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(DecisionEntryModelImpl.ENTITY_CACHE_ENABLED, DecisionEntryImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (DecisionEntry) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_DECISIONENTRY_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 (DecisionEntry decisionEntry : (List<DecisionEntry>) q.list()) { map.put(decisionEntry.getPrimaryKeyObj(), decisionEntry); cacheResult(decisionEntry); uncachedPrimaryKeys.remove(decisionEntry.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(DecisionEntryModelImpl.ENTITY_CACHE_ENABLED, DecisionEntryImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }