use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TypeTaxonomyLevelController method getAvailableTypes.
private List<TaxonomyLevelType> getAvailableTypes() {
List<TaxonomyLevelType> allowedTypes = new ArrayList<>(taxonomyService.getTaxonomyLevelTypes(taxonomy));
Set<TaxonomyLevelType> analyzedTypes = new HashSet<>();
for (TaxonomyLevel level : levels) {
TaxonomyLevel parentLevel = level.getParent();
if (parentLevel != null && parentLevel.getType() != null && !analyzedTypes.contains(parentLevel.getType())) {
TaxonomyLevelType parentType = parentLevel.getType();
List<TaxonomyLevelType> allowedSubTypes = new ArrayList<>();
Set<TaxonomyLevelTypeToType> typesToTypes = parentType.getAllowedTaxonomyLevelSubTypes();
for (TaxonomyLevelTypeToType typeToType : typesToTypes) {
allowedSubTypes.add(typeToType.getAllowedSubTaxonomyLevelType());
}
if (allowedSubTypes.size() > 0) {
allowedTypes.retainAll(allowedSubTypes);
}
}
}
return allowedTypes;
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project OpenOLAT by OpenOLAT.
the class TaxonomyLevelTypesEditController method doEditLevelType.
private void doEditLevelType(UserRequest ureq, TaxonomyLevelTypeRef type) {
TaxonomyLevelType reloadedType = taxonomyService.getTaxonomyLevelType(type);
editLevelTypeCtrl = new EditTaxonomyLevelTypeController(ureq, this.getWindowControl(), reloadedType, taxonomy);
listenTo(editLevelTypeCtrl);
cmc = new CloseableModalController(getWindowControl(), "close", editLevelTypeCtrl.getInitialComponent(), true, translate("edit"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.modules.taxonomy.TaxonomyLevelType in project openolat by klemens.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_teachWrite.
@Test
public void hasCompetenceByTaxonomy_teachWrite() {
// 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.setDocumentsLibraryTeachCompetenceWriteEnabled(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 klemens.
the class DocumentPoolManagerTest method hasCompetenceByTaxonomy_target.
@Test
public void hasCompetenceByTaxonomy_target() {
// create a level and competence with a type teach
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-8");
TaxonomyLevelType type = createTypeLevelCompetence(id, null, TaxonomyCompetenceTypes.target);
// set read for teach competence
type.setDocumentsLibraryTargetCompetenceReadEnabled(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 klemens.
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);
}
Aggregations