use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.
the class TaxonomyCompetenceAuditLogDAOTest method auditLog.
@Test
public void auditLog() {
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("competent-1");
Taxonomy taxonomy = taxonomyDao.createTaxonomy("ID-24", "Competence", "", null);
TaxonomyLevel level = taxonomyLevelDao.createTaxonomyLevel("ID-Level-1", "Competence level", "A very difficult competence", null, null, null, null, taxonomy);
TaxonomyCompetence competence = taxonomyCompetenceDao.createTaxonomyCompetence(TaxonomyCompetenceTypes.have, level, id, null);
dbInstance.commit();
String after = taxonomyCompetenceAuditLogDao.toXml(competence);
taxonomyCompetenceAuditLogDao.auditLog(TaxonomyCompetenceAuditLog.Action.addCompetence, "Before", "After", "Message", taxonomy, competence, id, null);
dbInstance.commit();
Assert.assertNotNull(after);
}
use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.
the class TaxonomyDAOTest method getTaxonomyList.
@Test
public void getTaxonomyList() {
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<Taxonomy> taxonomyList = taxonomyDao.getTaxonomyList();
Assert.assertTrue(taxonomyList.contains(taxonomy0));
Assert.assertTrue(taxonomyList.contains(taxonomy1));
}
use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.
the class TaxonomyLevelTypeDAOTest method allowSubTypes.
@Test
public void allowSubTypes() {
Taxonomy taxonomy = taxonomyDao.createTaxonomy("Tax-type", "Typed taxonomy", "A typed taxonomy", "");
TaxonomyLevelType type = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-parent", "A type", null, null, taxonomy);
TaxonomyLevelType subType1 = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-sub-1", "A type", null, null, taxonomy);
TaxonomyLevelType subType2 = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-sub-2", "A type", null, null, taxonomy);
dbInstance.commitAndCloseSession();
taxonomyLevelTypeToTypeDao.addAllowedSubType(type, subType1);
taxonomyLevelTypeToTypeDao.addAllowedSubType(type, subType2);
dbInstance.commitAndCloseSession();
TaxonomyLevelTypeImpl reloadedType = (TaxonomyLevelTypeImpl) taxonomyLevelTypeDao.loadTaxonomyLevelTypeByKey(type.getKey());
Assert.assertNotNull(reloadedType.getAllowedTaxonomyLevelSubTypes());
Assert.assertEquals(2, reloadedType.getAllowedTaxonomyLevelSubTypes().size());
Set<TaxonomyLevelTypeToType> allowedTypeSet = reloadedType.getAllowedTaxonomyLevelSubTypes();
List<TaxonomyLevelType> allowedSubTypes = allowedTypeSet.stream().map(t -> t.getAllowedSubTaxonomyLevelType()).collect(Collectors.toList());
Assert.assertTrue(allowedSubTypes.contains(subType1));
Assert.assertTrue(allowedSubTypes.contains(subType2));
}
use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.
the class TaxonomyLevelTypeDAOTest method loadTaxonomyLevelTypeByTaxonomy.
@Test
public void loadTaxonomyLevelTypeByTaxonomy() {
Taxonomy taxonomy = taxonomyDao.createTaxonomy("Tax-type", "Typed taxonomy", "A typed taxonomy", "");
Taxonomy taxonomyMarker = taxonomyDao.createTaxonomy("Tax-marker", "Marker taxonomy", "An unused taxonomy", "");
TaxonomyLevelType type = taxonomyLevelTypeDao.createTaxonomyLevelType("Type-reload", "A first reloaded type", "Typed", "TYP-1", taxonomy);
dbInstance.commitAndCloseSession();
// check the taxonomy with types
List<TaxonomyLevelType> taxonomyTypes = taxonomyLevelTypeDao.loadTaxonomyLevelTypeByTaxonomy(taxonomy);
Assert.assertNotNull(taxonomyTypes);
Assert.assertEquals(1, taxonomyTypes.size());
Assert.assertEquals(type, taxonomyTypes.get(0));
// check the marker without
List<TaxonomyLevelType> taxonomyWithoutTypes = taxonomyLevelTypeDao.loadTaxonomyLevelTypeByTaxonomy(taxonomyMarker);
Assert.assertNotNull(taxonomyWithoutTypes);
Assert.assertEquals(0, taxonomyWithoutTypes.size());
}
use of org.olat.modules.taxonomy.Taxonomy in project OpenOLAT by OpenOLAT.
the class IdentityCompetencesController method doRemoveCompetence.
private void doRemoveCompetence(IdentityCompetenceRow row) {
Taxonomy taxonomy = row.getTaxonomy();
TaxonomyCompetence competence = row.getCompetence();
String before = taxonomyService.toAuditXml(competence);
taxonomyService.removeTaxonomyLevelCompetence(competence);
taxonomyService.auditLog(TaxonomyCompetenceAuditLog.Action.removeCompetence, before, null, null, taxonomy, competence, assessedIdentity, getIdentity());
loadModel();
tableEl.reset(true, true, true);
String competenceTypeName = translate(row.getCompetenceType().name());
String levelDisplayName = StringHelper.escapeHtml(row.getTaxonomyLevel().getDisplayName());
showInfo("confirm.removed.competence", new String[] { competenceTypeName, levelDisplayName });
}
Aggregations