use of org.olat.modules.taxonomy.model.TaxonomyInfos in project OpenOLAT by OpenOLAT.
the class TaxonomyListAdminController method loadModel.
private void loadModel() {
List<TaxonomyInfos> taxonomyList = taxonomyService.getTaxonomyInfosList();
List<TaxonomyRow> rows = new ArrayList<>(taxonomyList.size());
for (TaxonomyInfos taxonomy : taxonomyList) {
rows.add(forgeTaxonomyRow(taxonomy));
}
model.setObjects(rows);
tableEl.reset(true, true, true);
}
use of org.olat.modules.taxonomy.model.TaxonomyInfos in project openolat by klemens.
the class TaxonomyDAOTest method getTaxonomyInfosList.
@Test
public void getTaxonomyInfosList() {
Taxonomy taxonomy0 = taxonomyDao.createTaxonomy("ID40", "An other taxonomy", "A little taxonomy", "REF-40");
Taxonomy taxonomy1 = taxonomyDao.createTaxonomy("ID41", "An other taxonomy", "A little taxonomy", "REF-41");
dbInstance.commitAndCloseSession();
List<TaxonomyInfos> infosList = taxonomyDao.getTaxonomyInfosList();
Assert.assertNotNull(infosList);
int found = 0;
for (TaxonomyInfos info : infosList) {
if (info.getKey().equals(taxonomy0.getKey()) || info.getKey().equals(taxonomy1.getKey())) {
found++;
}
}
Assert.assertEquals(2, found);
}
use of org.olat.modules.taxonomy.model.TaxonomyInfos in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.modules.taxonomy.model.TaxonomyInfos in project OpenOLAT by OpenOLAT.
the class TaxonomyDAOTest method getTaxonomyInfosList.
@Test
public void getTaxonomyInfosList() {
Taxonomy taxonomy0 = taxonomyDao.createTaxonomy("ID40", "An other taxonomy", "A little taxonomy", "REF-40");
Taxonomy taxonomy1 = taxonomyDao.createTaxonomy("ID41", "An other taxonomy", "A little taxonomy", "REF-41");
dbInstance.commitAndCloseSession();
List<TaxonomyInfos> infosList = taxonomyDao.getTaxonomyInfosList();
Assert.assertNotNull(infosList);
int found = 0;
for (TaxonomyInfos info : infosList) {
if (info.getKey().equals(taxonomy0.getKey()) || info.getKey().equals(taxonomy1.getKey())) {
found++;
}
}
Assert.assertEquals(2, found);
}
use of org.olat.modules.taxonomy.model.TaxonomyInfos in project openolat by klemens.
the class TaxonomyListAdminController method loadModel.
private void loadModel() {
List<TaxonomyInfos> taxonomyList = taxonomyService.getTaxonomyInfosList();
List<TaxonomyRow> rows = new ArrayList<>(taxonomyList.size());
for (TaxonomyInfos taxonomy : taxonomyList) {
rows.add(forgeTaxonomyRow(taxonomy));
}
model.setObjects(rows);
tableEl.reset(true, true, true);
}
Aggregations