List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:fi.helsinki.opintoni.config.audit.AuditEventConverter.java
/** * Convert a list of PersistentAuditEvent to a list of AuditEvent * * @param persistentAuditEvents the list to convert * @return the converted list./*from www . j a v a2 s . co m*/ */ public List<AuditEvent> convertToAuditEvent(Iterable<PersistentAuditEvent> persistentAuditEvents) { if (persistentAuditEvents == null) { return Collections.emptyList(); } List<AuditEvent> auditEvents = new ArrayList<>(); for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) { AuditEvent auditEvent = new AuditEvent(persistentAuditEvent.getAuditEventDate().toDate(), persistentAuditEvent.getPrincipal(), persistentAuditEvent.getAuditEventType(), convertDataToObjects(persistentAuditEvent.getData())); auditEvents.add(auditEvent); } return auditEvents; }
From source file:no.dusken.aranea.service.RoleServiceImpl.java
public List<Role> getRoles() { List<Role> list = Collections.emptyList(); try {// w w w . j av a2s . c om list = genericDao.getByNamedQuery("role_roles", null); } catch (DataAccessException dae) { log.info("Unable to get Roles", dae); } return list; }
From source file:com.devicehive.dao.riak.model.RiakDeviceEquipment.java
public static List<DeviceEquipmentVO> convertToVo(List<RiakDeviceEquipment> equipment) { if (equipment == null) { return Collections.emptyList(); }/*from ww w . j a v a2 s. com*/ return equipment.stream().map(RiakDeviceEquipment::convertToVo).collect(Collectors.toList()); }
From source file:org.italiangrid.storm.webdav.authz.vomap.VOMapAuthDetailsSource.java
@Override public Collection<GrantedAuthority> getVOMSGrantedAuthorities(HttpServletRequest request) { X500Principal principal = getPrincipalFromRequest(request); if (principal == null) { return Collections.emptyList(); }/*from ww w . j av a 2s .c o m*/ List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); for (String voName : mapService.getPrincipalVOs(principal)) { if (logger.isDebugEnabled()) { logger.debug("Adding VO authority: {}", voName); } authorities.add(new VOMSVOMapAuthority(voName)); } return authorities; }
From source file:cc.kave.commons.pointsto.evaluation.OneMissingQueryBuilder.java
@Override public List<Query> createQueries(Usage in) { List<CallSite> receiverCallSites = new ArrayList<>(in.getReceiverCallsites()); if (receiverCallSites.isEmpty()) { return Collections.emptyList(); }/*w w w . j a v a 2s . co m*/ int numQueries = Math.min(maxNumQueries, receiverCallSites.size()); Set<Set<CallSite>> queriesCallSites = new HashSet<>(numQueries); int iters = 0; while (queriesCallSites.size() < numQueries && iters < 100) { int missingIndex = rndGenerator.nextInt(receiverCallSites.size()); CallSite missingCallSite = receiverCallSites.get(missingIndex); Set<CallSite> newCallSites = new HashSet<>(in.getAllCallsites()); newCallSites.remove(missingCallSite); queriesCallSites.add(newCallSites); ++iters; } List<Query> queries = new ArrayList<>(maxNumQueries); for (Set<CallSite> callSites : queriesCallSites) { Query query = Query.createAsCopyFrom(in); query.setAllCallsites(callSites); queries.add(query); } return queries; }
From source file:net.shopxx.dao.impl.ArticleCategoryDaoImpl.java
public List<ArticleCategory> findParents(ArticleCategory articleCategory, boolean recursive, Integer count) { if (articleCategory == null || articleCategory.getParent() == null) { return Collections.emptyList(); }// ww w . j a v a 2s. c om TypedQuery<ArticleCategory> query; if (recursive) { String jpql = "select articleCategory from ArticleCategory articleCategory where articleCategory.id in (:ids) order by articleCategory.grade asc"; query = entityManager.createQuery(jpql, ArticleCategory.class).setParameter("ids", Arrays.asList(articleCategory.getParentIds())); } else { String jpql = "select articleCategory from ArticleCategory articleCategory where articleCategory = :articleCategory"; query = entityManager.createQuery(jpql, ArticleCategory.class).setParameter("articleCategory", articleCategory.getParent()); } if (count != null) { query.setMaxResults(count); } return query.getResultList(); }
From source file:net.shopxx.dao.impl.ProductCategoryDaoImpl.java
public List<ProductCategory> findParents(ProductCategory productCategory, boolean recursive, Integer count) { if (productCategory == null || productCategory.getParent() == null) { return Collections.emptyList(); }/*w ww .j a v a 2 s . co m*/ TypedQuery<ProductCategory> query; if (recursive) { String jpql = "select productCategory from ProductCategory productCategory where productCategory.id in (:ids) order by productCategory.grade asc"; query = entityManager.createQuery(jpql, ProductCategory.class).setParameter("ids", Arrays.asList(productCategory.getParentIds())); } else { String jpql = "select productCategory from ProductCategory productCategory where productCategory = :productCategory"; query = entityManager.createQuery(jpql, ProductCategory.class).setParameter("productCategory", productCategory.getParent()); } if (count != null) { query.setMaxResults(count); } return query.getResultList(); }
From source file:jp.ryoyamamoto.poiutils.Sheets.java
/** * Gets the hyperlinks on the sheet./*from w ww.ja va 2s . c o m*/ * * @param sheet * the sheet. * @return the hyperlinks on the sheet. */ @SuppressWarnings("unchecked") public static List<Hyperlink> getHyperlinks(Sheet sheet) { try { return (List<Hyperlink>) FieldUtils.readDeclaredField(sheet, "hyperlinks", true); } catch (IllegalAccessException e) { e.printStackTrace(); } return Collections.emptyList(); }
From source file:com.frank.search.solr.core.convert.SolrConverterBase.java
@Override public Collection<SolrInputDocument> write(Iterable<?> source) { if (source == null) { return Collections.emptyList(); }//from www . j a v a2 s . co m List<SolrInputDocument> resultList = new ArrayList<SolrInputDocument>(); for (Object bean : source) { if (bean instanceof SolrInputDocument) { resultList.add((SolrInputDocument) bean); } else { resultList.add(createAndWrite(bean)); } } return resultList; }
From source file:uk.co.blackpepper.support.spring.jdbc.jooq.SpringJdbcJooqUtilsTest.java
@Test public void newPreparedStatementCreatorReturnsPreparedStatementCreator() { Query query = mock(Query.class); when(query.getParams()).thenReturn(Maps.<String, Param<?>>newHashMap()); when(query.getBindValues()).thenReturn(Collections.emptyList()); when(query.getSQL()).thenReturn("x"); PreparedStatementCreator actual = SpringJdbcJooqUtils.newPreparedStatementCreator(query); // The concrete class implements this interface, so we can make a meaningful assertion String sql = ((SqlProvider) actual).getSql(); assertThat(sql, is("x")); }