Example usage for com.liferay.portal.kernel.util StringPool COMMA

List of usage examples for com.liferay.portal.kernel.util StringPool COMMA

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool COMMA.

Prototype

String COMMA

To view the source code for com.liferay.portal.kernel.util StringPool COMMA.

Click Source Link

Usage

From source file:com.kisti.science.platform.app.service.persistence.CommonPackagePK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("pkgName");
    sb.append(StringPool.EQUAL);/*from w  ww .j  a  v a2s.c om*/
    sb.append(pkgName);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("pkgVersion");
    sb.append(StringPool.EQUAL);
    sb.append(pkgVersion);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.kisti.scienceappstore.service.persistence.CommonLibraryPK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("libName");
    sb.append(StringPool.EQUAL);/*  www .  j  a v a2 s. com*/
    sb.append(libName);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("sysArch");
    sb.append(StringPool.EQUAL);
    sb.append(sysArch);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.ktree.timezone.model.dao.service.persistence.WorldClockPK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("id");
    sb.append(StringPool.EQUAL);//from w  w  w .j av a  2s .  c o  m
    sb.append(id);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("place");
    sb.append(StringPool.EQUAL);
    sb.append(place);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.liferay.adaptive.media.image.service.persistence.impl.AdaptiveMediaImageEntryPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, AdaptiveMediaImageEntry> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//from   w w  w  .ja  va  2s .c  om

    Map<Serializable, AdaptiveMediaImageEntry> map = new HashMap<Serializable, AdaptiveMediaImageEntry>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        AdaptiveMediaImageEntry adaptiveMediaImageEntry = fetchByPrimaryKey(primaryKey);

        if (adaptiveMediaImageEntry != null) {
            map.put(primaryKey, adaptiveMediaImageEntry);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Serializable serializable = entityCache.getResult(AdaptiveMediaImageEntryModelImpl.ENTITY_CACHE_ENABLED,
                AdaptiveMediaImageEntryImpl.class, primaryKey);

        if (serializable != nullModel) {
            if (serializable == null) {
                if (uncachedPrimaryKeys == null) {
                    uncachedPrimaryKeys = new HashSet<Serializable>();
                }

                uncachedPrimaryKeys.add(primaryKey);
            } else {
                map.put(primaryKey, (AdaptiveMediaImageEntry) serializable);
            }
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_ADAPTIVEMEDIAIMAGEENTRY_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
        query.append((long) 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 (AdaptiveMediaImageEntry adaptiveMediaImageEntry : (List<AdaptiveMediaImageEntry>) q.list()) {
            map.put(adaptiveMediaImageEntry.getPrimaryKeyObj(), adaptiveMediaImageEntry);

            cacheResult(adaptiveMediaImageEntry);

            uncachedPrimaryKeys.remove(adaptiveMediaImageEntry.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            entityCache.putResult(AdaptiveMediaImageEntryModelImpl.ENTITY_CACHE_ENABLED,
                    AdaptiveMediaImageEntryImpl.class, primaryKey, nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.akismet.service.persistence.impl.AkismetDataPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, AkismetData> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//from  w w  w.jav a 2s .co  m

    Map<Serializable, AkismetData> map = new HashMap<Serializable, AkismetData>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        AkismetData akismetData = fetchByPrimaryKey(primaryKey);

        if (akismetData != null) {
            map.put(primaryKey, akismetData);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        AkismetData akismetData = (AkismetData) EntityCacheUtil
                .getResult(AkismetDataModelImpl.ENTITY_CACHE_ENABLED, AkismetDataImpl.class, primaryKey);

        if (akismetData == null) {
            if (uncachedPrimaryKeys == null) {
                uncachedPrimaryKeys = new HashSet<Serializable>();
            }

            uncachedPrimaryKeys.add(primaryKey);
        } else {
            map.put(primaryKey, akismetData);
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_AKISMETDATA_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 (AkismetData akismetData : (List<AkismetData>) q.list()) {
            map.put(akismetData.getPrimaryKeyObj(), akismetData);

            cacheResult(akismetData);

            uncachedPrimaryKeys.remove(akismetData.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            EntityCacheUtil.putResult(AkismetDataModelImpl.ENTITY_CACHE_ENABLED, AkismetDataImpl.class,
                    primaryKey, _nullAkismetData);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.alloy.taglib.alloy_util.ComponentTag.java

License:Open Source License

private boolean _isValidAttribute(String key) {
    List<String> excludeAttributes = Collections.emptyList();

    if (getExcludeAttributes() != null) {
        excludeAttributes = Arrays.asList(getExcludeAttributes().split(StringPool.COMMA));
    }/*from  w  w  w.ja v  a  2s.  c  o m*/

    return !(excludeAttributes.contains(key) || key.equals(_DYNAMIC_ATTRIBUTES));
}

From source file:com.liferay.amfregistration.service.persistence.RegistrationPK.java

License:Open Source License

@Override
public String toString() {
    StringBundler sb = new StringBundler(10);

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("username");
    sb.append(StringPool.EQUAL);/*from  w  ww  .  j a  v a 2s.c  om*/
    sb.append(username);

    sb.append(StringPool.COMMA);
    sb.append(StringPool.SPACE);
    sb.append("userID");
    sb.append(StringPool.EQUAL);
    sb.append(userID);

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.liferay.ams.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  ww w.j  a  va 2  s.  c  om

    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) EntityCacheUtil.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) {
            EntityCacheUtil.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.ams.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 ww  .  j a  v a2s.c o 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) EntityCacheUtil.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) {
            EntityCacheUtil.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.ams.service.persistence.impl.DefinitionPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, Definition> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//  w w  w  .j av  a 2s.co  m

    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) EntityCacheUtil.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) {
            EntityCacheUtil.putResult(DefinitionModelImpl.ENTITY_CACHE_ENABLED, DefinitionImpl.class,
                    primaryKey, _nullDefinition);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}