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.fmdp.webform.util.WebFormUtil.java

License:Open Source License

public static String[] split(String s) {
    return split(s, StringPool.COMMA);
}

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();
    }/*  ww w .jav  a 2  s .  com*/

    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 . j a v a  2  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 ww .ja va2 s .c  o  m

    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  .  j a v a 2s .  c  om

    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;
}

From source file:com.gleo.plugins.hexiagon.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  ww  w .j a v a2  s  .  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) {
        Serializable serializable = entityCache.getResult(TypeModelImpl.ENTITY_CACHE_ENABLED, TypeImpl.class,
                primaryKey);

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

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

    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, nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.hedu.groovy.scripts.portlet.service.persistence.impl.GroovyScriptPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        GroovyScript groovyScript = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_GROOVYSCRIPT_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 (GroovyScript groovyScript : (List<GroovyScript>) q.list()) {
            map.put(groovyScript.getPrimaryKeyObj(), groovyScript);

            cacheResult(groovyScript);

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

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

    return map;
}

From source file:com.hitss.layer.service.persistence.ActividadCronogramaPK.java

License:Open Source License

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

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("actividadCronogramaId");
    sb.append(StringPool.EQUAL);/*from   w  ww. j ava  2  s  . com*/
    sb.append(actividadCronogramaId);

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

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.hitss.layer.service.persistence.ActividadPlanAccionUsuarioPK.java

License:Open Source License

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

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("actividadPlanAccionUsuariocoId");
    sb.append(StringPool.EQUAL);/*w  ww.  j ava  2s .c om*/
    sb.append(actividadPlanAccionUsuariocoId);

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

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.hitss.layer.service.persistence.ActividadPlanPK.java

License:Open Source License

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

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("actividadPlanId");
    sb.append(StringPool.EQUAL);/*from   ww w .  j  av  a2  s  .  c  om*/
    sb.append(actividadPlanId);

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

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}