Search in sources :

Example 6 with TaxonomyLevelSearchParameters

use of org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelDAOTest method searchLevelsByExternalId.

@Test
public void searchLevelsByExternalId() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-105B", "Named taxonomy", null, null);
    TaxonomyLevel level1 = taxonomyLevelDao.createTaxonomyLevel("L-1C", "A numerated level", "", "34765", null, null, null, taxonomy);
    TaxonomyLevel level2 = taxonomyLevelDao.createTaxonomyLevel("L-1D", "A numerated level", "", "34766", null, null, null, taxonomy);
    dbInstance.commitAndCloseSession();
    // key
    TaxonomyLevelSearchParameters searchParams = new TaxonomyLevelSearchParameters();
    searchParams.setQuickSearch("34765");
    List<TaxonomyLevel> levels = taxonomyLevelDao.searchLevels(taxonomy, searchParams);
    Assert.assertNotNull(levels);
    Assert.assertEquals(1, levels.size());
    Assert.assertEquals(level1, levels.get(0));
    Assert.assertNotEquals(level2, levels.get(0));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelSearchParameters(org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters) Test(org.junit.Test)

Example 7 with TaxonomyLevelSearchParameters

use of org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelDAOTest method searchLevelsByKey.

@Test
public void searchLevelsByKey() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-105B", "Named taxonomy", null, null);
    TaxonomyLevel level1 = taxonomyLevelDao.createTaxonomyLevel("L-1E", "A numerated level", "", null, null, null, null, taxonomy);
    TaxonomyLevel level2 = taxonomyLevelDao.createTaxonomyLevel("L-1F", "A numerated level", "", null, null, null, null, taxonomy);
    dbInstance.commitAndCloseSession();
    // key
    TaxonomyLevelSearchParameters searchParams = new TaxonomyLevelSearchParameters();
    searchParams.setQuickSearch(level1.getKey().toString());
    List<TaxonomyLevel> levels = taxonomyLevelDao.searchLevels(taxonomy, searchParams);
    Assert.assertNotNull(levels);
    Assert.assertEquals(1, levels.size());
    Assert.assertEquals(level1, levels.get(0));
    Assert.assertNotEquals(level2, levels.get(0));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelSearchParameters(org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters) Test(org.junit.Test)

Example 8 with TaxonomyLevelSearchParameters

use of org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters in project openolat by klemens.

the class TaxonomyLevelDAOTest method searchLevelsByExternalId.

@Test
public void searchLevelsByExternalId() {
    Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-105B", "Named taxonomy", null, null);
    TaxonomyLevel level1 = taxonomyLevelDao.createTaxonomyLevel("L-1C", "A numerated level", "", "34765", null, null, null, taxonomy);
    TaxonomyLevel level2 = taxonomyLevelDao.createTaxonomyLevel("L-1D", "A numerated level", "", "34766", null, null, null, taxonomy);
    dbInstance.commitAndCloseSession();
    // key
    TaxonomyLevelSearchParameters searchParams = new TaxonomyLevelSearchParameters();
    searchParams.setQuickSearch("34765");
    List<TaxonomyLevel> levels = taxonomyLevelDao.searchLevels(taxonomy, searchParams);
    Assert.assertNotNull(levels);
    Assert.assertEquals(1, levels.size());
    Assert.assertEquals(level1, levels.get(0));
    Assert.assertNotEquals(level2, levels.get(0));
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelSearchParameters(org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters) Test(org.junit.Test)

Aggregations

TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)8 TaxonomyLevelSearchParameters (org.olat.modules.taxonomy.model.TaxonomyLevelSearchParameters)8 Test (org.junit.Test)6 Taxonomy (org.olat.modules.taxonomy.Taxonomy)6 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 FlexiTreeNodeComparator (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTreeNodeComparator)2 FlexiTreeTableNode (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTreeTableNode)2