use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TaxonomyLevelTypesEditController method doOpenTools.
private void doOpenTools(UserRequest ureq, TaxonomyLevelTypeRow row, FormLink link) {
removeAsListenerAndDispose(toolsCtrl);
removeAsListenerAndDispose(toolsCalloutCtrl);
TaxonomyLevelType type = taxonomyService.getTaxonomyLevelType(row);
if (type == null) {
tableEl.reloadData();
showWarning("warning.taxonomy.level.type.deleted");
} else {
toolsCtrl = new ToolsController(ureq, getWindowControl(), row, type);
listenTo(toolsCtrl);
toolsCalloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(), toolsCtrl.getInitialComponent(), link.getFormDispatchId(), "", true, "");
listenTo(toolsCalloutCtrl);
toolsCalloutCtrl.activate();
}
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_have.
@Test
public void hasCompetenceByTaxonomy_have() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.have);
// set read for teach competence
type.setDocumentsLibraryHaveCompetenceReadEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertTrue(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_teachRead.
@Test
public void hasCompetenceByTaxonomy_teachRead() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.teach);
// set read for teach competence
type.setDocumentsLibraryTeachCompetenceReadEnabled(true);
type = taxonomyLevelTypeDao.updateTaxonomyLevelType(type);
dbInstance.commitAndCloseSession();
boolean hasCompetence = documentPoolManager.hasValidCompetence(id);
Assert.assertTrue(hasCompetence);
}
use of org.olat.modules.taxonomy.TaxonomyLevelType 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;
}
use of org.olat.modules.taxonomy.TaxonomyLevelType 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);
}
Aggregations