use of org.olat.modules.taxonomy.model.TaxonomyInfos in project openolat by klemens.
the class TaxonomyDAO method getTaxonomyInfosList.
public List<TaxonomyInfos> getTaxonomyInfosList() {
StringBuilder sb = new StringBuilder(256);
sb.append("select tax, ").append(" (select count(level.key) from ctaxonomylevel level").append(" where level.taxonomy.key=tax.key").append(" ) as numOfLevels").append(" from ctaxonomy tax");
List<Object[]> objectsList = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Object[].class).getResultList();
List<TaxonomyInfos> infos = new ArrayList<>(objectsList.size());
for (Object[] objects : objectsList) {
Taxonomy taxonomy = (Taxonomy) objects[0];
Number numOfLevels = (Number) objects[1];
infos.add(new TaxonomyInfos(taxonomy, numOfLevels == null ? 0 : numOfLevels.intValue()));
}
return infos;
}
Aggregations