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.rtl.servlet.filters.ComboServletFilter.java
License:Open Source License
protected boolean validateModuleExtension(String moduleName) throws Exception { boolean validModuleExtension = false; String[] fileExtensions = PrefsPropsUtil.getStringArray(PropsKeys.COMBO_ALLOWED_FILE_EXTENSIONS, StringPool.COMMA); for (String fileExtension : fileExtensions) { if (StringPool.STAR.equals(fileExtension) || StringUtil.endsWith(moduleName, fileExtension)) { validModuleExtension = true; break; }//from w w w. j av a 2 s . c o m } return validModuleExtension; }
From source file:com.liferay.sample.service.persistence.AddressPK.java
License:Open Source License
@Override public String toString() { StringBundler sb = new StringBundler(10); sb.append(StringPool.OPEN_CURLY_BRACE); sb.append("addressId"); sb.append(StringPool.EQUAL);/*w w w. j ava2 s . co m*/ sb.append(addressId); sb.append(StringPool.COMMA); sb.append(StringPool.SPACE); sb.append("employeeId"); sb.append(StringPool.EQUAL); sb.append(employeeId); sb.append(StringPool.CLOSE_CURLY_BRACE); return sb.toString(); }
From source file:com.liferay.samplealloymvc.service.persistence.impl.AssetPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Asset> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . ja v a2 s. com*/ Map<Serializable, Asset> map = new HashMap<Serializable, Asset>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Asset asset = fetchByPrimaryKey(primaryKey); if (asset != null) { map.put(primaryKey, asset); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Asset asset = (Asset) entityCache.getResult(AssetModelImpl.ENTITY_CACHE_ENABLED, AssetImpl.class, primaryKey); if (asset == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, asset); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_ASSET_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 (Asset asset : (List<Asset>) q.list()) { map.put(asset.getPrimaryKeyObj(), asset); cacheResult(asset); uncachedPrimaryKeys.remove(asset.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(AssetModelImpl.ENTITY_CACHE_ENABLED, AssetImpl.class, primaryKey, _nullAsset); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplealloymvc.service.persistence.impl.CheckoutPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Checkout> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }//from w w w.jav a 2s .co m Map<Serializable, Checkout> map = new HashMap<Serializable, Checkout>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Checkout checkout = fetchByPrimaryKey(primaryKey); if (checkout != null) { map.put(primaryKey, checkout); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Checkout checkout = (Checkout) entityCache.getResult(CheckoutModelImpl.ENTITY_CACHE_ENABLED, CheckoutImpl.class, primaryKey); if (checkout == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, checkout); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_CHECKOUT_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 (Checkout checkout : (List<Checkout>) q.list()) { map.put(checkout.getPrimaryKeyObj(), checkout); cacheResult(checkout); uncachedPrimaryKeys.remove(checkout.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(CheckoutModelImpl.ENTITY_CACHE_ENABLED, CheckoutImpl.class, primaryKey, _nullCheckout); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplealloymvc.service.persistence.impl.DefinitionPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Definition> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*ww w .j a va 2s .c om*/ Map<Serializable, Definition> map = new HashMap<Serializable, Definition>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Definition definition = fetchByPrimaryKey(primaryKey); if (definition != null) { map.put(primaryKey, definition); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Definition definition = (Definition) entityCache.getResult(DefinitionModelImpl.ENTITY_CACHE_ENABLED, DefinitionImpl.class, primaryKey); if (definition == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, definition); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_DEFINITION_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 (Definition definition : (List<Definition>) q.list()) { map.put(definition.getPrimaryKeyObj(), definition); cacheResult(definition); uncachedPrimaryKeys.remove(definition.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(DefinitionModelImpl.ENTITY_CACHE_ENABLED, DefinitionImpl.class, primaryKey, _nullDefinition); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplealloymvc.service.persistence.impl.SAMTodoItemPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SAMTodoItem> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w . j a v a2 s . c o m*/ Map<Serializable, SAMTodoItem> map = new HashMap<Serializable, SAMTodoItem>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SAMTodoItem samTodoItem = fetchByPrimaryKey(primaryKey); if (samTodoItem != null) { map.put(primaryKey, samTodoItem); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SAMTodoItem samTodoItem = (SAMTodoItem) entityCache.getResult(SAMTodoItemModelImpl.ENTITY_CACHE_ENABLED, SAMTodoItemImpl.class, primaryKey); if (samTodoItem == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, samTodoItem); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SAMTODOITEM_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 (SAMTodoItem samTodoItem : (List<SAMTodoItem>) q.list()) { map.put(samTodoItem.getPrimaryKeyObj(), samTodoItem); cacheResult(samTodoItem); uncachedPrimaryKeys.remove(samTodoItem.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(SAMTodoItemModelImpl.ENTITY_CACHE_ENABLED, SAMTodoItemImpl.class, primaryKey, _nullSAMTodoItem); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplealloymvc.service.persistence.impl.SAMTodoListPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SAMTodoList> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from ww w. ja v a 2s . com*/ Map<Serializable, SAMTodoList> map = new HashMap<Serializable, SAMTodoList>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SAMTodoList samTodoList = fetchByPrimaryKey(primaryKey); if (samTodoList != null) { map.put(primaryKey, samTodoList); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SAMTodoList samTodoList = (SAMTodoList) entityCache.getResult(SAMTodoListModelImpl.ENTITY_CACHE_ENABLED, SAMTodoListImpl.class, primaryKey); if (samTodoList == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, samTodoList); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SAMTODOLIST_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 (SAMTodoList samTodoList : (List<SAMTodoList>) q.list()) { map.put(samTodoList.getPrimaryKeyObj(), samTodoList); cacheResult(samTodoList); uncachedPrimaryKeys.remove(samTodoList.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(SAMTodoListModelImpl.ENTITY_CACHE_ENABLED, SAMTodoListImpl.class, primaryKey, _nullSAMTodoList); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplealloymvc.service.persistence.impl.TypePersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Type> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w ww . j ava 2s. c o m*/ Map<Serializable, Type> map = new HashMap<Serializable, Type>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); Type type = fetchByPrimaryKey(primaryKey); if (type != null) { map.put(primaryKey, type); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { Type type = (Type) entityCache.getResult(TypeModelImpl.ENTITY_CACHE_ENABLED, TypeImpl.class, primaryKey); if (type == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, type); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_TYPE_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 (Type type : (List<Type>) q.list()) { map.put(type.getPrimaryKeyObj(), type); cacheResult(type); uncachedPrimaryKeys.remove(type.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { entityCache.putResult(TypeModelImpl.ENTITY_CACHE_ENABLED, TypeImpl.class, primaryKey, _nullType); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.samplelar.service.persistence.impl.SampleLARBookingPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, SampleLARBooking> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w .j av a 2s.c o m*/ Map<Serializable, SampleLARBooking> map = new HashMap<Serializable, SampleLARBooking>(); if (primaryKeys.size() == 1) { Iterator<Serializable> iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); SampleLARBooking sampleLARBooking = fetchByPrimaryKey(primaryKey); if (sampleLARBooking != null) { map.put(primaryKey, sampleLARBooking); } return map; } Set<Serializable> uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { SampleLARBooking sampleLARBooking = (SampleLARBooking) EntityCacheUtil.getResult( SampleLARBookingModelImpl.ENTITY_CACHE_ENABLED, SampleLARBookingImpl.class, primaryKey); if (sampleLARBooking == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, sampleLARBooking); } } if (uncachedPrimaryKeys == null) { return map; } StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1); query.append(_SQL_SELECT_SAMPLELARBOOKING_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 (SampleLARBooking sampleLARBooking : (List<SampleLARBooking>) q.list()) { map.put(sampleLARBooking.getPrimaryKeyObj(), sampleLARBooking); cacheResult(sampleLARBooking); uncachedPrimaryKeys.remove(sampleLARBooking.getPrimaryKeyObj()); } for (Serializable primaryKey : uncachedPrimaryKeys) { EntityCacheUtil.putResult(SampleLARBookingModelImpl.ENTITY_CACHE_ENABLED, SampleLARBookingImpl.class, primaryKey, _nullSampleLARBooking); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }
From source file:com.liferay.sampleservicebuilder.service.persistence.impl.FooPersistenceImpl.java
License:Open Source License
@Override public Map<Serializable, Foo> fetchByPrimaryKeys(Set<Serializable> primaryKeys) { if (primaryKeys.isEmpty()) { return Collections.emptyMap(); }/*from w w w. j a va 2 s . c om*/ 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) { Foo foo = (Foo) EntityCacheUtil.getResult(FooModelImpl.ENTITY_CACHE_ENABLED, FooImpl.class, primaryKey); if (foo == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<Serializable>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, foo); } } 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) { EntityCacheUtil.putResult(FooModelImpl.ENTITY_CACHE_ENABLED, FooImpl.class, primaryKey, _nullFoo); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } return map; }