Example usage for java.util Collections checkedList

List of usage examples for java.util Collections checkedList

Introduction

In this page you can find the example usage for java.util Collections checkedList.

Prototype

public static <E> List<E> checkedList(List<E> list, Class<E> type) 

Source Link

Document

Returns a dynamically typesafe view of the specified list.

Usage

From source file:es.tid.fiware.rss.dao.impl.CountryDaoImpl.java

/**
 * Method executes HQL query.//www .j  a  v  a  2s  .  com
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmCountry> listCountryQuery(final String hql) {
    CountryDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = getHibernateTemplate().find(hql);
    // @SuppressWarnings("unchecked")
    List<BmCountry> resultList = Collections.checkedList(list, BmCountry.class);
    return resultList;
}

From source file:es.upm.fiware.rss.dao.impl.CurrencyDaoImpl.java

/**
 * Method executes HQL query.//from  w  w w. ja  va  2  s  .  c  o  m
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmCurrency> listCurrencyQuery(final String hql) {
    CurrencyDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = this.getSession().createQuery(hql).list();
    // entityManager.createQuery(hql).getResultList();
    // @SuppressWarnings("unchecked")
    List<BmCurrency> resultList = Collections.checkedList(list, BmCurrency.class);
    return resultList;
}

From source file:es.upm.fiware.rss.dao.impl.ServDeployMopDaoImpl.java

/**
 * Method executes HQL query./*from   ww  w. jav  a 2s . c o m*/
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmServdeployMop> listServDeployMopQuery(final String hql) {
    ServDeployMopDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = this.getSession().createQuery(hql).list();
    // @SuppressWarnings("unchecked")
    List<BmServdeployMop> resultList = Collections.checkedList(list, BmServdeployMop.class);
    return resultList;
}

From source file:es.upm.fiware.rss.dao.impl.ServiceDeploymentDaoImpl.java

/**
 * listServiceDeploymentQuery to get all data from ServiceDeployment query.
 * /*from ww  w. j  av  a  2s .  c  o m*/
 * @param hql
 *            the query to get ServiceDeployment id with the service, ob and country
 * @return a list with the results from the ServiceDeployment query
 */
private List<BmServiceDeployment> listServiceDeploymentQuery(final String hql) {
    ServiceDeploymentDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = this.getSession().createQuery(hql).list();
    // entityManager.createQuery(hql).getResultList();
    // @SuppressWarnings("unchecked")
    List<BmServiceDeployment> resultList = Collections.checkedList(list, BmServiceDeployment.class);
    return resultList;
}

From source file:es.upm.fiware.rss.dao.impl.SetRevenueShareConfDaoImpl.java

/**
 * Returns a list of revenue sharing models filtered by some params
 * // w ww .j a v  a  2s  .c  om
 * @param aggregatorId
 * @param appProviderId
 * @param productClass
 * @return
 */
@Override
public List<SetRevenueShareConf> getRevenueModelsByParameters(String aggregatorId, String appProviderId,
        String productClass) {
    SetRevenueShareConfDaoImpl.LOGGER.debug("getRevenueModelsByProviderId");

    // Build queries
    String hql = "from SetRevenueShareConf l";

    if (null != aggregatorId && !aggregatorId.isEmpty()) {
        hql += " where l.aggregator= '" + aggregatorId + "'";

        if (null != appProviderId && !appProviderId.isEmpty()) {
            hql += " and l.id.modelOwner.id.txAppProviderId= '" + appProviderId + "'";

            if (null != productClass && !productClass.isEmpty()) {
                hql += " and l.id.productClass= '" + productClass + "'";
            }
        }
    }

    List<SetRevenueShareConf> resultList;
    try {
        List list = this.getSession().createQuery(hql).list();
        resultList = Collections.checkedList(list, SetRevenueShareConf.class);
    } catch (Exception e) {
        return null;
    }

    if (null == resultList || resultList.isEmpty()) {
        resultList = null;
    }

    return resultList;
}

From source file:es.tid.fiware.rss.dao.impl.CurrencyDaoImpl.java

/**
 * Method executes HQL query.//  www.  j  a  v  a 2  s . c o  m
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmCurrency> listCurrencyQuery(final String hql) {
    CurrencyDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = getHibernateTemplate().find(hql);
    // entityManager.createQuery(hql).getResultList();
    // @SuppressWarnings("unchecked")
    List<BmCurrency> resultList = Collections.checkedList(list, BmCurrency.class);
    return resultList;
}

From source file:es.tid.fiware.rss.dao.impl.ServDeployMopDaoImpl.java

/**
 * Method executes HQL query.//  ww w. ja  v  a2 s . co m
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmServdeployMop> listServDeployMopQuery(final String hql) {
    ServDeployMopDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = getHibernateTemplate().find(hql);
    // @SuppressWarnings("unchecked")
    List<BmServdeployMop> resultList = Collections.checkedList(list, BmServdeployMop.class);
    return resultList;
}

From source file:es.tid.fiware.rss.dao.impl.ServiceDeploymentDaoImpl.java

/**
 * listServiceDeploymentQuery to get all data from ServiceDeployment query.
 * //from   ww  w . ja v  a 2 s .  c o  m
 * @param hql
 *            the query to get ServiceDeployment id with the service, ob and country
 * @return a list with the results from the ServiceDeployment query
 */
private List<BmServiceDeployment> listServiceDeploymentQuery(final String hql) {
    ServiceDeploymentDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = getHibernateTemplate().find(hql);
    // entityManager.createQuery(hql).getResultList();
    // @SuppressWarnings("unchecked")
    List<BmServiceDeployment> resultList = Collections.checkedList(list, BmServiceDeployment.class);
    return resultList;
}

From source file:es.tid.fiware.rss.dao.impl.SetRevenueShareConfDaoImpl.java

@Override
public List<SetRevenueShareConf> getRevenueModelsByParameters(String aggregatorId, String appProviderId,
        String productClass) {/* w  w w. j  a  va 2s .  co m*/
    SetRevenueShareConfDaoImpl.LOGGER.debug("getRevenueModelsByProviderId");
    String hql = "select * from set_revenue_share_conf l where tx_appprovider_id ='" + appProviderId + "'";
    // if appProvider not specified
    if (null == appProviderId || "".equalsIgnoreCase(appProviderId)) {
        hql = "select * from set_revenue_share_conf l where tx_appprovider_id in "
                + "(select tx_appprovider_id from dbe_aggregator_appprovider where tx_email='" + aggregatorId
                + "')";
    }
    // if product class specified
    if (null != productClass) {
        hql += " and  tx_product_class='" + productClass + "'";
    }
    List list = super.getSession().createSQLQuery(hql).addEntity(SetRevenueShareConf.class).list();
    List<SetRevenueShareConf> resultList = Collections.checkedList(list, SetRevenueShareConf.class);
    if (null != resultList && resultList.size() > 0) {
        return resultList;
    } else { // <=0
        return null;
    }
}

From source file:es.upm.fiware.rss.dao.impl.PricePointDaoImpl.java

/**
 * Method executes HQL query.//from www.  j  ava 2s  .  c o  m
 * 
 * @param hql
 *            String with HQL query
 * @return resultList
 */
private List<BmPricePoint> listPricePointQuery(final String hql) {
    PricePointDaoImpl.LOGGER.debug(hql);
    // @SuppressWarnings("rawtypes")
    List list = this.getSession().createQuery(hql).list();
    // @SuppressWarnings("unchecked")
    List<BmPricePoint> resultList = Collections.checkedList(list, BmPricePoint.class);
    return resultList;
}