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.dynamic.data.lists.service.persistence.impl.DDLRecordVersionPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, DDLRecordVersion> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* w w w.j av a 2 s . c o m*/ Map<Serializable, DDLRecordVersion> map = new HashMap<Serializable, DDLRecordVersion>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); DDLRecordVersion ddlRecordVersion = fetchByPrimaryKey(primaryKey); if (ddlRecordVersion != null) { map.put(primaryKey, ddlRecordVersion); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(DDLRecordVersionModelImpl.ENTITY_CACHE_ENABLED, DDLRecordVersionImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (DDLRecordVersion) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_DDLRECORDVERSION_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 (DDLRecordVersion ddlRecordVersion : (List<DDLRecordVersion>) q.list()) { map.put(ddlRecordVersion.getPrimaryKeyObj(), ddlRecordVersion); cacheResult(ddlRecordVersion); uncachedPrimaryKeys.remove(ddlRecordVersion.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(DDLRecordVersionModelImpl.ENTITY_CACHE_ENABLED, DDLRecordVersionImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.evp.admin.service.persistence.impl.FundPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Fund> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//w ww. j av a2 s. c o m Map<Serializable, Fund> map = new HashMap<Serializable, Fund>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Fund fund = fetchByPrimaryKey(primaryKey); if (fund != null) { map.put(primaryKey, fund); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Fund fund = (Fund) EntityCacheUtil.getResult(FundModelImpl.ENTITY_CACHE_ENABLED, FundImpl.class, primaryKey); if (fund == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, fund); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_FUND_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 (Fund fund : (List<Fund>) q.list()) { map.put(fund.getPrimaryKeyObj(), fund); cacheResult(fund); uncachedPrimaryKeys.remove(fund.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(FundModelImpl.ENTITY_CACHE_ENABLED, FundImpl.class, primaryKey, _nullFund); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.evp.admin.service.persistence.impl.ProjectPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Project> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w ww. ja va 2s . co m Map<Serializable, Project> map = new HashMap<Serializable, Project>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Project project = fetchByPrimaryKey(primaryKey); if (project != null) { map.put(primaryKey, project); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Project project = (Project) EntityCacheUtil.getResult(ProjectModelImpl.ENTITY_CACHE_ENABLED, ProjectImpl.class, primaryKey); if (project == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, project); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_PROJECT_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 (Project project : (List<Project>) q.list()) { map.put(project.getPrimaryKeyObj(), project); cacheResult(project); uncachedPrimaryKeys.remove(project.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(ProjectModelImpl.ENTITY_CACHE_ENABLED, ProjectImpl.class, primaryKey, _nullProject); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.evp.admin.service.persistence.impl.VolunteerPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Volunteer> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j ava 2 s . c o m*/ Map<Serializable, Volunteer> map = new HashMap<Serializable, Volunteer>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Volunteer volunteer = fetchByPrimaryKey(primaryKey); if (volunteer != null) { map.put(primaryKey, volunteer); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Volunteer volunteer = (Volunteer) EntityCacheUtil.getResult(VolunteerModelImpl.ENTITY_CACHE_ENABLED, VolunteerImpl.class, primaryKey); if (volunteer == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, volunteer); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_VOLUNTEER_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 (Volunteer volunteer : (List<Volunteer>) q.list()) { map.put(volunteer.getPrimaryKeyObj(), volunteer); cacheResult(volunteer); uncachedPrimaryKeys.remove(volunteer.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(VolunteerModelImpl.ENTITY_CACHE_ENABLED, VolunteerImpl.class, primaryKey, _nullVolunteer); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.example.servicebuilder.extdb.service.persistence.impl.UserLoginPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, UserLogin> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from ww w . j a va 2 s .c o m Map<Serializable, UserLogin> map = new HashMap<Serializable, UserLogin>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); UserLogin userLogin = fetchByPrimaryKey(primaryKey); if (userLogin != null) { map.put(primaryKey, userLogin); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(UserLoginModelImpl.ENTITY_CACHE_ENABLED, UserLoginImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (UserLogin) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_USERLOGIN_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 (UserLogin userLogin : (List<UserLogin>) q.list()) { map.put(userLogin.getPrimaryKeyObj(), userLogin); cacheResult(userLogin); uncachedPrimaryKeys.remove(userLogin.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(UserLoginModelImpl.ENTITY_CACHE_ENABLED, UserLoginImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.gs.hack.service.persistence.impl.ClientPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Client> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w. j ava 2s .co m Map<Serializable, Client> map = new HashMap<Serializable, Client>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Client client = fetchByPrimaryKey(primaryKey); if (client != null) { map.put(primaryKey, client); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ClientModelImpl.ENTITY_CACHE_ENABLED, ClientImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Client) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_CLIENT_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 (Client client : (List<Client>) q.list()) { map.put(client.getPrimaryKeyObj(), client); cacheResult(client); uncachedPrimaryKeys.remove(client.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ClientModelImpl.ENTITY_CACHE_ENABLED, ClientImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.gs.hack.service.persistence.impl.ProjectPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Project> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// w w w . j a v a 2 s . c o m Map<Serializable, Project> map = new HashMap<Serializable, Project>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Project project = fetchByPrimaryKey(primaryKey); if (project != null) { map.put(primaryKey, project); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ProjectModelImpl.ENTITY_CACHE_ENABLED, ProjectImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Project) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_PROJECT_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 (Project project : (List<Project>) q.list()) { map.put(project.getPrimaryKeyObj(), project); cacheResult(project); uncachedPrimaryKeys.remove(project.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ProjectModelImpl.ENTITY_CACHE_ENABLED, ProjectImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.gs.hack.service.persistence.impl.ProjectTaskPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, ProjectTask> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w . j av a 2 s.c o m Map<Serializable, ProjectTask> map = new HashMap<Serializable, ProjectTask>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); ProjectTask projectTask = fetchByPrimaryKey(primaryKey); if (projectTask != null) { map.put(primaryKey, projectTask); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ProjectTaskModelImpl.ENTITY_CACHE_ENABLED, ProjectTaskImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (ProjectTask) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_PROJECTTASK_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 (ProjectTask projectTask : (List<ProjectTask>) q.list()) { map.put(projectTask.getPrimaryKeyObj(), projectTask); cacheResult(projectTask); uncachedPrimaryKeys.remove(projectTask.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ProjectTaskModelImpl.ENTITY_CACHE_ENABLED, ProjectTaskImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.gs.hack.service.persistence.impl.ProjectUserPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, ProjectUser> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w. j av a 2 s. c o m Map<Serializable, ProjectUser> map = new HashMap<Serializable, ProjectUser>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); ProjectUser projectUser = fetchByPrimaryKey(primaryKey); if (projectUser != null) { map.put(primaryKey, projectUser); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ProjectUserModelImpl.ENTITY_CACHE_ENABLED, ProjectUserImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (ProjectUser) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_PROJECTUSER_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 (ProjectUser projectUser : (List<ProjectUser>) q.list()) { map.put(projectUser.getPrimaryKeyObj(), projectUser); cacheResult(projectUser); uncachedPrimaryKeys.remove(projectUser.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ProjectUserModelImpl.ENTITY_CACHE_ENABLED, ProjectUserImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.gs.hack.service.persistence.impl.TimesheetApprovalPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, TimesheetApproval> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/* ww w . j av a 2s .com*/ Map<Serializable, TimesheetApproval> map = new HashMap<Serializable, TimesheetApproval>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); TimesheetApproval timesheetApproval = fetchByPrimaryKey(primaryKey); if (timesheetApproval != null) { map.put(primaryKey, timesheetApproval); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(TimesheetApprovalModelImpl.ENTITY_CACHE_ENABLED, TimesheetApprovalImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (TimesheetApproval) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_TIMESHEETAPPROVAL_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 (TimesheetApproval timesheetApproval : (List<TimesheetApproval>) q.list()) { map.put(timesheetApproval.getPrimaryKeyObj(), timesheetApproval); cacheResult(timesheetApproval); uncachedPrimaryKeys.remove(timesheetApproval.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(TimesheetApprovalModelImpl.ENTITY_CACHE_ENABLED, TimesheetApprovalImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }