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.bemis.portal.migration.customer.service.persistence.CustomerUserOrgRelationPK.java

License:Open Source License

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

    sb.append(StringPool.OPEN_CURLY_BRACE);

    sb.append("email");
    sb.append(StringPool.EQUAL);/*from ww w. j  a v a2  s  . c  o  m*/
    sb.append(email);

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

    sb.append(StringPool.CLOSE_CURLY_BRACE);

    return sb.toString();
}

From source file:com.bemis.portal.migration.customer.service.persistence.impl.CustomerUserPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        CustomerUser customerUser = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_CUSTOMERUSER_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 (CustomerUser customerUser : (List<CustomerUser>) q.list()) {
            map.put(customerUser.getPrimaryKeyObj(), customerUser);

            cacheResult(customerUser);

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

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

    return map;
}

From source file:com.bemis.portal.order.service.persistence.impl.OrderPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        Order order = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_ORDER__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 (Order order : (List<Order>) q.list()) {
            map.put(order.getPrimaryKeyObj(), order);

            cacheResult(order);

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

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

    return map;
}

From source file:com.bemis.portal.order.service.persistence.impl.OrderRequestPersistenceImpl.java

License:Open Source License

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

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

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

        Serializable primaryKey = iterator.next();

        OrderRequest orderRequest = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_ORDERREQUEST_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 (OrderRequest orderRequest : (List<OrderRequest>) q.list()) {
            map.put(orderRequest.getPrimaryKeyObj(), orderRequest);

            cacheResult(orderRequest);

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

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

    return map;
}

From source file:com.bemis.portal.order.service.persistence.impl.ReleasePersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, Release> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//from  www.j  ava2s  .c o  m

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

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

        Serializable primaryKey = iterator.next();

        Release release = fetchByPrimaryKey(primaryKey);

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

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

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

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

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

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

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

    query.append(_SQL_SELECT_RELEASE_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 (Release release : (List<Release>) q.list()) {
            map.put(release.getPrimaryKeyObj(), release);

            cacheResult(release);

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

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

    return map;
}

From source file:com.bemis.portal.report.model.impl.ReportDefinitionImpl.java

License:Open Source License

@Override
public Set<String> getAvailableFieldsSet() {
    if (_availableFieldsSet == null) {
        String[] availableFieldsArray = StringUtil.split(getAvailableFields(), StringPool.COMMA);

        _availableFieldsSet = new LinkedHashSet<>(Arrays.asList(availableFieldsArray));
    }//from   w  w w. j  ava  2 s  .  c om

    return _availableFieldsSet;
}

From source file:com.bemis.portal.report.model.impl.ReportDefinitionImpl.java

License:Open Source License

@Override
public Set<String> getDefaultSelectedFieldsSet() {
    if (_defaultSelectedFieldsSet == null) {
        String[] defaultSelectedFieldsArray = StringUtil.split(getDefaultSelectedFields(), StringPool.COMMA);

        _defaultSelectedFieldsSet = new LinkedHashSet<>(Arrays.asList(defaultSelectedFieldsArray));
    }//from  w w  w  .  j  av  a  2 s. c o m

    return _defaultSelectedFieldsSet;
}

From source file:com.bemis.portal.report.model.impl.ReportDefinitionImpl.java

License:Open Source License

@Override
public Set<String> getSortFieldsSet() {
    if (_sortFieldsSet == null) {
        String[] sortFieldsArray = StringUtil.split(getSortFields(), StringPool.COMMA);

        _sortFieldsSet = new LinkedHashSet<>(Arrays.asList(sortFieldsArray));
    }/*from  w w  w  .  j a v a  2  s. co m*/

    return _sortFieldsSet;
}

From source file:com.bemis.portal.report.model.impl.ReportPreferencesImpl.java

License:Open Source License

public Set<String> getSelectedFieldsSet() {
    if (_selectedFieldsSet == null) {
        String[] selectedFieldsArray = StringUtil.split(getSelectedFields(), StringPool.COMMA);

        _selectedFieldsSet = new LinkedHashSet<>(Arrays.asList(selectedFieldsArray));
    }//from  w  w w .j  ava 2  s.c om

    return _selectedFieldsSet;
}

From source file:com.bemis.portal.report.model.impl.ReportRequestImpl.java

License:Open Source License

@Override
public Set<String> getSelectedFieldsSet() {
    if (_selectedFieldsSet == null) {
        String[] selectedFieldsArray = StringUtil.split(getSelectedFields(), StringPool.COMMA);

        _selectedFieldsSet = new LinkedHashSet<>(Arrays.asList(selectedFieldsArray));
    }/*from   www  .j a v a  2  s  .  c  om*/

    return _selectedFieldsSet;
}