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

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

Introduction

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

Prototype

String CLOSE_PARENTHESIS

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

Click Source Link

Usage

From source file:com.liferay.marketplace.service.persistence.impl.AppPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, App> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }/*from www  .  j av a 2 s  .com*/

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

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

        Serializable primaryKey = iterator.next();

        App app = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        App app = (App) EntityCacheUtil.getResult(AppModelImpl.ENTITY_CACHE_ENABLED, AppImpl.class, primaryKey);

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

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

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

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

    query.append(_SQL_SELECT_APP_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 (App app : (List<App>) q.list()) {
            map.put(app.getPrimaryKeyObj(), app);

            cacheResult(app);

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

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

    return map;
}

From source file:com.liferay.marketplace.service.persistence.impl.ModulePersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        Module module = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Module module = (Module) EntityCacheUtil.getResult(ModuleModelImpl.ENTITY_CACHE_ENABLED,
                ModuleImpl.class, primaryKey);

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

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

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

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

    query.append(_SQL_SELECT_MODULE_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 (Module module : (List<Module>) q.list()) {
            map.put(module.getPrimaryKeyObj(), module);

            cacheResult(module);

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

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

    return map;
}

From source file:com.liferay.maven.test.sb.service.persistence.impl.AssignmentPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        Assignment assignment = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_ASSIGNMENT_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 (Assignment assignment : (List<Assignment>) q.list()) {
            map.put(assignment.getPrimaryKeyObj(), assignment);

            cacheResult(assignment);

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

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

    return map;
}

From source file:com.liferay.maven.test.sb.service.persistence.impl.SubmissionPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, Submission> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }/*from  w w w .  j  av a2  s .  c  o m*/

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

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

        Serializable primaryKey = iterator.next();

        Submission submission = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_SUBMISSION_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 (Submission submission : (List<Submission>) q.list()) {
            map.put(submission.getPrimaryKeyObj(), submission);

            cacheResult(submission);

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

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

    return map;
}

From source file:com.liferay.meeting.webex.service.persistence.impl.WebExAccountPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, WebExAccount> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//from   ww  w . j a  v a 2 s  . c o m

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

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

        Serializable primaryKey = iterator.next();

        WebExAccount webExAccount = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        WebExAccount webExAccount = (WebExAccount) entityCache
                .getResult(WebExAccountModelImpl.ENTITY_CACHE_ENABLED, WebExAccountImpl.class, primaryKey);

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

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

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

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

    query.append(_SQL_SELECT_WEBEXACCOUNT_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 (WebExAccount webExAccount : (List<WebExAccount>) q.list()) {
            map.put(webExAccount.getPrimaryKeyObj(), webExAccount);

            cacheResult(webExAccount);

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

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

    return map;
}

From source file:com.liferay.meeting.webex.service.persistence.impl.WebExSitePersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, WebExSite> 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, WebExSite> map = new HashMap<Serializable, WebExSite>();

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

        Serializable primaryKey = iterator.next();

        WebExSite webExSite = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        WebExSite webExSite = (WebExSite) entityCache.getResult(WebExSiteModelImpl.ENTITY_CACHE_ENABLED,
                WebExSiteImpl.class, primaryKey);

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

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

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

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

    query.append(_SQL_SELECT_WEBEXSITE_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 (WebExSite webExSite : (List<WebExSite>) q.list()) {
            map.put(webExSite.getPrimaryKeyObj(), webExSite);

            cacheResult(webExSite);

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

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

    return map;
}

From source file:com.liferay.meeting.webex.util.TimeZoneUtil.java

License:Open Source License

public static TimeZoneType.Enum convert(String timeZoneString) {
    int x = timeZoneString.indexOf(StringPool.OPEN_PARENTHESIS);
    int y = timeZoneString.indexOf(StringPool.CLOSE_PARENTHESIS);

    if ((x == -1) || (y == -1)) {
        return null;
    }/*from   w  w  w  .  ja v  a2  s . c  o m*/

    return _timeZoneTypeEnumsByShortName.get(timeZoneString.substring(x + 1, y));
}

From source file:com.liferay.meeting.webex.util.TimeZoneUtil.java

License:Open Source License

public void setTimeZones(Map<TimeZone, TimeZoneType.Enum> timeZoneTypeEnums) {

    for (Map.Entry<TimeZone, TimeZoneType.Enum> entry : timeZoneTypeEnums.entrySet()) {

        TimeZone timeZone = entry.getKey();
        TimeZoneType.Enum timeZoneTypeEnum = entry.getValue();

        _timeZones.put(timeZoneTypeEnum, timeZone);
        _timeZoneTypeEnumsByTimeZone.put(timeZone, timeZoneTypeEnum);

        String timeZoneTypeEnumString = timeZoneTypeEnum.toString();

        int x = timeZoneTypeEnumString.indexOf(StringPool.OPEN_PARENTHESIS);
        int y = timeZoneTypeEnumString.indexOf(StringPool.CLOSE_PARENTHESIS);

        if ((x != -1) && (y != -1)) {
            String shortName = timeZoneTypeEnumString.substring(x + 1, y);

            _timeZoneTypeEnumsByShortName.put(shortName, timeZoneTypeEnum);
        }//from  ww  w  . j a  v  a  2 s .com
    }
}

From source file:com.liferay.micro.maintainance.analysis.service.persistence.impl.AnalysisEntryPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        AnalysisEntry analysisEntry = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_ANALYSISENTRY_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 (AnalysisEntry analysisEntry : (List<AnalysisEntry>) q.list()) {
            map.put(analysisEntry.getPrimaryKeyObj(), analysisEntry);

            cacheResult(analysisEntry);

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

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

    return map;
}

From source file:com.liferay.micro.maintainance.analysis.service.persistence.impl.AnalysisUserPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, AnalysisUser> 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, AnalysisUser> map = new HashMap<Serializable, AnalysisUser>();

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

        Serializable primaryKey = iterator.next();

        AnalysisUser analysisUser = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_ANALYSISUSER_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 (AnalysisUser analysisUser : (List<AnalysisUser>) q.list()) {
            map.put(analysisUser.getPrimaryKeyObj(), analysisUser);

            cacheResult(analysisUser);

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

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

    return map;
}