Search in sources :

Example 91 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelOverviewController method doCreateTaxonomyLevel.

private void doCreateTaxonomyLevel(UserRequest ureq) {
    if (createTaxonomyLevelCtrl != null)
        return;
    taxonomyLevel = taxonomyService.getTaxonomyLevel(taxonomyLevel);
    Taxonomy taxonomy = taxonomyLevel.getTaxonomy();
    createTaxonomyLevelCtrl = new EditTaxonomyLevelController(ureq, getWindowControl(), taxonomyLevel, taxonomy);
    listenTo(createTaxonomyLevelCtrl);
    cmc = new CloseableModalController(getWindowControl(), "close", createTaxonomyLevelCtrl.getInitialComponent(), true, translate("add.taxonomy.level"));
    listenTo(cmc);
    cmc.activate();
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 92 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.

the class TaxonomyLevelOverviewController method doMove.

private void doMove(UserRequest ureq) {
    if (moveLevelCtrl != null)
        return;
    taxonomyLevel = taxonomyService.getTaxonomyLevel(taxonomyLevel);
    Taxonomy taxonomy = taxonomyLevel.getTaxonomy();
    List<TaxonomyLevel> levelsToMove = Collections.singletonList(taxonomyLevel);
    moveLevelCtrl = new MoveTaxonomyLevelController(ureq, getWindowControl(), levelsToMove, taxonomy);
    listenTo(moveLevelCtrl);
    String title = translate("move.taxonomy.level.title", new String[] { StringHelper.escapeHtml(taxonomyLevel.getDisplayName()) });
    cmc = new CloseableModalController(getWindowControl(), "close", moveLevelCtrl.getInitialComponent(), true, title);
    listenTo(cmc);
    cmc.activate();
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel)

Example 93 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.

the class DocumentPoolManagerTest method createTypeLevelCompetence.

private TaxonomyLevelType createTypeLevelCompetence(Identity id, TaxonomyLevel parent, TaxonomyCompetenceTypes competenceType) {
    String levelId = "DP-Lev. " + UUID.randomUUID();
    Taxonomy taxonomy = getDocumentPoolTaxonomy();
    TaxonomyLevelType type = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-docpool", "A type for document pool", "Typed", "TYP-0", taxonomy);
    TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel(levelId, "Competence level", "A competence", null, null, parent, type, taxonomy);
    TaxonomyCompetence competenceTarget = taxonomyCompetenceDao.createTaxonomyCompetence(competenceType, level, id, null);
    dbInstance.commit();
    type.setDocumentsLibraryManageCompetenceEnabled(false);
    type.setDocumentsLibraryTeachCompetenceWriteEnabled(false);
    type.setDocumentsLibraryTeachCompetenceReadEnabled(false);
    type.setDocumentsLibraryHaveCompetenceReadEnabled(false);
    type.setDocumentsLibraryTargetCompetenceReadEnabled(false);
    type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
    dbInstance.commit();
    Assert.assertNotNull(competenceTarget);
    return type;
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyCompetence(org.olat.modules.taxonomy.TaxonomyCompetence)

Example 94 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.

the class DocumentPoolManagerTest method lostAndFoundSpecialCase.

/**
 * The test check if the presence of a level with the identifier lost+found
 * in the parent line stop the competence.
 */
@Test
public void lostAndFoundSpecialCase() {
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
    Taxonomy taxonomy = getDocumentPoolTaxonomy();
    TaxonomyLevel level1 = taxonomyLevelDao.createTaxonomyLevel("DP-Lev. " + UUID.randomUUID(), "Competence level", "A competence", null, null, null, null, taxonomy);
    TaxonomyLevel level2 = taxonomyLevelDao.createTaxonomyLevel("DP-Lev. " + UUID.randomUUID(), "Competence level", "A competence", null, null, level1, null, taxonomy);
    TaxonomyLevelType type = createTypeLevelCompetence(id, level2, TaxonomyCompetenceTypes.have);
    type.setDocumentsLibraryHaveCompetenceReadEnabled(true);
    type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
    dbInstance.commitAndCloseSession();
    // check first without lost+found
    boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
    Assert.assertTrue(hasCompetence);
    // change the identifier level 2
    level2.setIdentifier("lost+found");
    level2 = taxonomyLevelDao.updateTaxonomyLevel(level2);
    dbInstance.commitAndCloseSession();
    // access refused
    boolean hasLostCompetence = documentPoolManager.hasValidCompetence(id);
    Assert.assertFalse(hasLostCompetence);
    // remove lost + found
    level2.setIdentifier("DP-Lev. " + UUID.randomUUID());
    level2 = taxonomyLevelDao.updateTaxonomyLevel(level2);
    dbInstance.commitAndCloseSession();
    // access allowed
    boolean hasAgainCompetence = documentPoolManager.hasValidCompetence(id);
    Assert.assertTrue(hasAgainCompetence);
    // root will be lost
    level1.setIdentifier("lost+found");
    level1 = taxonomyLevelDao.updateTaxonomyLevel(level1);
    dbInstance.commitAndCloseSession();
    boolean hasLostAgainCompetence = documentPoolManager.hasValidCompetence(id);
    Assert.assertFalse(hasLostAgainCompetence);
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 95 with Taxonomy

use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.

the class DocumentPoolManagerTest method setupTaxonomy.

@Before
public void setupTaxonomy() {
    Taxonomy taxonomy = null;
    String taxonomyTreeKey = documentPoolModule.getTaxonomyTreeKey();
    if (StringHelper.isLong(taxonomyTreeKey)) {
        taxonomy = taxonomyDao.loadByKey(new Long(taxonomyTreeKey));
    }
    if (taxonomy == null) {
        taxonomy = taxonomyDao.createTaxonomy("DP-1", "Doc-pool", "Taxonomy for document pool", null);
        dbInstance.commitAndCloseSession();
        documentPoolModule.setTaxonomyTreeKey(taxonomy.getKey().toString());
    }
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) Before(org.junit.Before)

Aggregations

Taxonomy (org.olat.modules.taxonomy.Taxonomy)194 Test (org.junit.Test)132 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)122 Identity (org.olat.core.id.Identity)56 URI (java.net.URI)36 HttpResponse (org.apache.http.HttpResponse)36 TaxonomyCompetence (org.olat.modules.taxonomy.TaxonomyCompetence)36 TaxonomyLevelType (org.olat.modules.taxonomy.TaxonomyLevelType)34 Date (java.util.Date)22 HttpGet (org.apache.http.client.methods.HttpGet)16 ArrayList (java.util.ArrayList)14 TaxonomyService (org.olat.modules.taxonomy.TaxonomyService)14 TaxonomyRefImpl (org.olat.modules.taxonomy.model.TaxonomyRefImpl)14 HttpPut (org.apache.http.client.methods.HttpPut)12 HashMap (java.util.HashMap)10 List (java.util.List)10 VFSContainer (org.olat.core.util.vfs.VFSContainer)10 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)10 TaxonomyLevelTypeToType (org.olat.modules.taxonomy.TaxonomyLevelTypeToType)10 TaxonomyLevelRefImpl (org.olat.modules.taxonomy.model.TaxonomyLevelRefImpl)10