List of usage examples for java.util Collections checkedList
public static <E> List<E> checkedList(List<E> list, Class<E> type)
From source file:es.upm.fiware.rss.dao.impl.DbeTransactionDaoImpl.java
@Override public List<DbeTransaction> getTransactionByTxPbCorrelationId(Integer pbCorrelationId) { String hql = "from DbeTransaction as trans where trans.txPbCorrelationId=:correlation"; List<DbeTransaction> resultList; try {// www . j a va2s .com List list = this.getSession().createQuery(hql).setParameter("correlation", pbCorrelationId).list(); resultList = Collections.checkedList(list, DbeTransaction.class); } catch (Exception e) { DbeTransactionDaoImpl.LOGGER.error("Error db", e); return null; } return resultList; }
From source file:es.upm.fiware.rss.dao.impl.SetRevenueShareConfDaoImpl.java
/** * Returns a list of revenue sharing models based on the id of the owner * provider//from w w w. j a va 2s. c o m * * @param providerId, ID of the owner provider * @return A list of SetRevenueShareConf objects containing the revenue * sharing models of the given provider */ @Override public List<SetRevenueShareConf> getRevenueModelsByProviderId(String providerId) { SetRevenueShareConfDaoImpl.LOGGER.debug("getRevenueModelsByProviderId"); // Build the query String hql = " from SetRevenueShareConf l where l.id.txAppProviderId ='" + providerId + "'"; List list = this.getSession().createQuery(hql).list(); List<SetRevenueShareConf> resultList = Collections.checkedList(list, SetRevenueShareConf.class); if (null == resultList || resultList.isEmpty()) { resultList = null; } return resultList; }
From source file:es.tid.fiware.rss.dao.impl.DbeAggregatorAppProviderDaoImpl.java
@Override public List<DbeAggregatorAppProvider> getDbeAggregatorAppProviderByAggregatorId(String aggregatorId) { DbeAggregatorAppProviderDaoImpl.LOGGER.debug("getDbeAggregatorAppProviderByAggregatorId"); String hql = " from DbeAggregatorAppProvider l where l.id.txEmail ='" + aggregatorId + "'"; List list = getHibernateTemplate().find(hql); List<DbeAggregatorAppProvider> resultList = Collections.checkedList(list, DbeAggregatorAppProvider.class); if (null != resultList && resultList.size() > 0) { return resultList; } else { // <=0 return null; }/*from w w w.j a va2 s .c o m*/ }
From source file:es.tid.fiware.rss.dao.impl.SetRevenueShareConfDaoImpl.java
@Override public List<SetRevenueShareConf> getRevenueModelsByProviderId(String providerId) { SetRevenueShareConfDaoImpl.LOGGER.debug("getRevenueModelsByProviderId"); String hql = " from SetRevenueShareConf l where l.id.txAppProviderId ='" + providerId + "'"; List list = getHibernateTemplate().find(hql); List<SetRevenueShareConf> resultList = Collections.checkedList(list, SetRevenueShareConf.class); if (null != resultList && resultList.size() > 0) { return resultList; } else { // <=0 return null; }// w w w . j a va 2 s.c om }
From source file:es.upm.fiware.rss.dao.impl.LanguageDaoImpl.java
/** * Method executes HQL query.//from w w w .j a va 2 s . c om * * @param hql * String with HQL query * @return resultList */ private List<BmLanguage> listLanguageQuery(final String hql) { LanguageDaoImpl.LOGGER.debug(hql); // @SuppressWarnings("rawtypes") List list = this.getSession().createQuery(hql).list(); // entityManager.createQuery(hql).getResultList(); // @SuppressWarnings("unchecked") List<BmLanguage> resultList = Collections.checkedList(list, BmLanguage.class); return resultList; }
From source file:es.tid.fiware.rss.dao.impl.ObCountryDaoImpl.java
/** * Method executes HQL query.//from w w w . j a v a 2s .com * * @param hql * String with HQL query * @return resultList */ private List<BmObCountry> listObCountryQuery(final String hql) { ObCountryDaoImpl.LOGGER.debug(hql); // @SuppressWarnings("rawtypes") List list = getHibernateTemplate().find(hql); // entityManager.createQuery(hql).getResultList(); // @SuppressWarnings("unchecked") List<BmObCountry> resultList = Collections.checkedList(list, BmObCountry.class); return resultList; }
From source file:es.tid.fiware.rss.dao.impl.LanguageDaoImpl.java
/** * Method executes HQL query./*from ww w. j a va 2s .com*/ * * @param hql * String with HQL query * @return resultList */ private List<BmLanguage> listLanguageQuery(final String hql) { LanguageDaoImpl.LOGGER.debug(hql); // @SuppressWarnings("rawtypes") List list = getHibernateTemplate().find(hql); // entityManager.createQuery(hql).getResultList(); // @SuppressWarnings("unchecked") List<BmLanguage> resultList = Collections.checkedList(list, BmLanguage.class); return resultList; }
From source file:es.upm.fiware.rss.dao.impl.CountryDaoImpl.java
/** * Method executes HQL query./* w ww .j a va2 s .c om*/ * * @param hql * String with HQL query * @return resultList */ private List<BmCountry> listCountryQuery(final String hql) { CountryDaoImpl.LOGGER.debug(hql); // @SuppressWarnings("rawtypes") List list = this.getSession().createQuery(hql).list(); // @SuppressWarnings("unchecked") List<BmCountry> resultList = Collections.checkedList(list, BmCountry.class); return resultList; }
From source file:org.camelcookbook.transformation.csv.CsvSpringTest.java
@Test public void testCsvUnmarshal() throws Exception { final String request = "PROGRAMMING,Camel in Action,en,Claus Ibsen,Jon Anstey,Dec-2010,49.99\n" + "PROGRAMMING,Apache Camel Developer's Cookbook,en,Scott Cranton,Jakub Korab,Dec-2013,49.99\n"; @SuppressWarnings("unchecked") final List<BookModel> response = Collections .checkedList(template.requestBody("direct:unmarshal", request, List.class), BookModel.class); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM-yyyy"); BookModel book1 = new BookModel(); book1.setCategory("PROGRAMMING"); book1.setTitle("Camel in Action"); book1.setTitleLanguage("en"); book1.setAuthor1("Claus Ibsen"); book1.setAuthor2("Jon Anstey"); book1.setPublishDate(simpleDateFormat.parse("Dec-2010")); book1.setPrice(BigDecimal.valueOf(49.99)); BookModel book2 = new BookModel(); book2.setCategory("PROGRAMMING"); book2.setTitle("Apache Camel Developer's Cookbook"); book2.setTitleLanguage("en"); book2.setAuthor1("Scott Cranton"); book2.setAuthor2("Jakub Korab"); book2.setPublishDate(simpleDateFormat.parse("Dec-2013")); book2.setPrice(BigDecimal.valueOf(49.99)); BookModel response1 = response.get(0); assertEquals(book1, response1);/*from w ww . j a v a 2 s. c o m*/ BookModel response2 = response.get(1); assertEquals(book2, response2); }
From source file:es.tid.fiware.rss.dao.impl.ObCountryDaoImpl.java
@Override public final BmObCountry getBmObByITUData(final String txMncItuT212) { String hql = "from BmObCountry c where c.txMncItuT212 = '" + txMncItuT212 + "'"; List<BmObCountry> list = getHibernateTemplate().find(hql); List<BmObCountry> resultList = Collections.checkedList(list, BmObCountry.class); if (resultList.size() == 1) { return resultList.get(0); }// w ww .j av a2 s . c o m return null; }