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.bemis.portal.shipment.service.persistence.impl.ShipmentPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Shipment> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j a v a2 s.c om*/ Map<Serializable, Shipment> map = new HashMap<Serializable, Shipment>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Shipment shipment = fetchByPrimaryKey(primaryKey); if (shipment != null) { map.put(primaryKey, shipment); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ShipmentModelImpl.ENTITY_CACHE_ENABLED, ShipmentImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Shipment) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SHIPMENT_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 (Shipment shipment : (List<Shipment>) q.list()) { map.put(shipment.getPrimaryKeyObj(), shipment); cacheResult(shipment); uncachedPrimaryKeys.remove(shipment.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ShipmentModelImpl.ENTITY_CACHE_ENABLED, ShipmentImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.beorn.onlinepayment.rule.CompositeCondition.java
License:Open Source License
public String explain(ConditionExplainContext conditionExplainContext) { if (_conditions.length == 0) return conditionExplainContext.get("always"); if (_conditions.length == 1) return _conditions[0].explain(conditionExplainContext); StringBundler sb = new StringBundler(2 + (_conditions.length - 1) * 3 + _conditions.length); boolean first = true; sb.append(StringPool.OPEN_PARENTHESIS); for (Condition<T> condition : _conditions) { if (!first) { sb.append(StringPool.SPACE); sb.append(getExplainOperator(conditionExplainContext)); sb.append(StringPool.SPACE); }// w ww . j a va 2s. c o m sb.append(condition.explain(conditionExplainContext)); first = false; } sb.append(StringPool.CLOSE_PARENTHESIS); return sb.toString(); }
From source file:com.bookmark.service.persistence.impl.companyBookmarkPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, companyBookmark> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }// w w w. j a v a 2s. c om Map<Serializable, companyBookmark> map = new HashMap<Serializable, companyBookmark>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); companyBookmark companyBookmark = fetchByPrimaryKey(primaryKey); if (companyBookmark != null) { map.put(primaryKey, companyBookmark); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(companyBookmarkModelImpl.ENTITY_CACHE_ENABLED, companyBookmarkImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (companyBookmark) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 4) + 1); query.append(_SQL_SELECT_COMPANYBOOKMARK_WHERE_PKS_IN); for (Serializable primaryKey : uncachedPrimaryKeys) { query.append(StringPool.APOSTROPHE); query.append((String) primaryKey); query.append(StringPool.APOSTROPHE); 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 (companyBookmark companyBookmark : (List<companyBookmark>) q.list()) { map.put(companyBookmark.getPrimaryKeyObj(), companyBookmark); cacheResult(companyBookmark); uncachedPrimaryKeys.remove(companyBookmark.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(companyBookmarkModelImpl.ENTITY_CACHE_ENABLED, companyBookmarkImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.clavisit.clavisit.poc.ddl.images.service.persistence.impl.ImagePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Image> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from www . ja v a 2 s .c o m*/ Map<Serializable, Image> map = new HashMap<Serializable, Image>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Image image = fetchByPrimaryKey(primaryKey); if (image != null) { map.put(primaryKey, image); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(ImageModelImpl.ENTITY_CACHE_ENABLED, ImageImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Image) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_IMAGE_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 (Image image : (List<Image>) q.list()) { map.put(image.getPrimaryKeyObj(), image); cacheResult(image); uncachedPrimaryKeys.remove(image.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(ImageModelImpl.ENTITY_CACHE_ENABLED, ImageImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.employee.service.persistence.impl.EmployeeePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Employeee> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from www . j a v a 2 s .c o m Map<Serializable, Employeee> map = new HashMap<Serializable, Employeee>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Employeee employeee = fetchByPrimaryKey(primaryKey); if (employeee != null) { map.put(primaryKey, employeee); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(EmployeeeModelImpl.ENTITY_CACHE_ENABLED, EmployeeeImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Employeee) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_EMPLOYEEE_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 (Employeee employeee : (List<Employeee>) q.list()) { map.put(employeee.getPrimaryKeyObj(), employeee); cacheResult(employeee); uncachedPrimaryKeys.remove(employeee.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(EmployeeeModelImpl.ENTITY_CACHE_ENABLED, EmployeeeImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.example.service.persistence.impl.FooPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Foo> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//w w w .jav a2 s . co m Map<Serializable, Foo> map = new HashMap<Serializable, Foo>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Foo foo = fetchByPrimaryKey(primaryKey); if (foo != null) { map.put(primaryKey, foo); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(FooModelImpl.ENTITY_CACHE_ENABLED, FooImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Foo) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_FOO_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 (Foo foo : (List<Foo>) q.list()) { map.put(foo.getPrimaryKeyObj(), foo); cacheResult(foo); uncachedPrimaryKeys.remove(foo.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(FooModelImpl.ENTITY_CACHE_ENABLED, FooImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.gleo.plugins.hexiagon.service.persistence.impl.AnnouncementImagePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, AnnouncementImage> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j ava2 s .c om*/ Map<Serializable, AnnouncementImage> map = new HashMap<Serializable, AnnouncementImage>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); AnnouncementImage announcementImage = fetchByPrimaryKey(primaryKey); if (announcementImage != null) { map.put(primaryKey, announcementImage); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(AnnouncementImageModelImpl.ENTITY_CACHE_ENABLED, AnnouncementImageImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (AnnouncementImage) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ANNOUNCEMENTIMAGE_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 (AnnouncementImage announcementImage : (List<AnnouncementImage>) q.list()) { map.put(announcementImage.getPrimaryKeyObj(), announcementImage); cacheResult(announcementImage); uncachedPrimaryKeys.remove(announcementImage.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AnnouncementImageModelImpl.ENTITY_CACHE_ENABLED, AnnouncementImageImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.gleo.plugins.hexiagon.service.persistence.impl.AnnouncementPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Announcement> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w. jav a2 s . c o m Map<Serializable, Announcement> map = new HashMap<Serializable, Announcement>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Announcement announcement = fetchByPrimaryKey(primaryKey); if (announcement != null) { map.put(primaryKey, announcement); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(AnnouncementModelImpl.ENTITY_CACHE_ENABLED, AnnouncementImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Announcement) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ANNOUNCEMENT_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 (Announcement announcement : (List<Announcement>) q.list()) { map.put(announcement.getPrimaryKeyObj(), announcement); cacheResult(announcement); uncachedPrimaryKeys.remove(announcement.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AnnouncementModelImpl.ENTITY_CACHE_ENABLED, AnnouncementImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.gleo.plugins.hexiagon.service.persistence.impl.CurrencyPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Currency> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w.ja v a 2 s .c om*/ Map<Serializable, Currency> map = new HashMap<Serializable, Currency>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Currency currency = fetchByPrimaryKey(primaryKey); if (currency != null) { map.put(primaryKey, currency); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(CurrencyModelImpl.ENTITY_CACHE_ENABLED, CurrencyImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Currency) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_CURRENCY_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 (Currency currency : (List<Currency>) q.list()) { map.put(currency.getPrimaryKeyObj(), currency); cacheResult(currency); uncachedPrimaryKeys.remove(currency.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(CurrencyModelImpl.ENTITY_CACHE_ENABLED, CurrencyImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.gleo.plugins.hexiagon.service.persistence.impl.FavoritePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Favorite> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w ww .jav a2 s. co m Map<Serializable, Favorite> map = new HashMap<Serializable, Favorite>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Favorite favorite = fetchByPrimaryKey(primaryKey); if (favorite != null) { map.put(primaryKey, favorite); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Serializable serializable = entityCache.getResult(FavoriteModelImpl.ENTITY_CACHE_ENABLED, FavoriteImpl.class, primaryKey); if (serializable != nullModel) { if (serializable == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, (Favorite) serializable); } } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_FAVORITE_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 (Favorite favorite : (List<Favorite>) q.list()) { map.put(favorite.getPrimaryKeyObj(), favorite); cacheResult(favorite); uncachedPrimaryKeys.remove(favorite.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(FavoriteModelImpl.ENTITY_CACHE_ENABLED, FavoriteImpl.class, primaryKey, nullModel); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }