use of org.olat.modules.taxonomy.model.TaxonomyLevelImpl in project openolat by klemens.
the class TaxonomyLevelDAO method createTaxonomyLevel.
public TaxonomyLevel createTaxonomyLevel(String identifier, String displayName, String description, String externalId, TaxonomyLevelManagedFlag[] flags, TaxonomyLevel parent, TaxonomyLevelType type, Taxonomy taxonomy) {
TaxonomyLevelImpl level = new TaxonomyLevelImpl();
level.setCreationDate(new Date());
level.setLastModified(level.getCreationDate());
level.setEnabled(true);
if (StringHelper.containsNonWhitespace(identifier)) {
level.setIdentifier(identifier);
} else {
level.setIdentifier(UUID.randomUUID().toString());
}
level.setManagedFlagsString(TaxonomyLevelManagedFlag.toString(flags));
level.setDisplayName(displayName);
level.setDescription(description);
level.setExternalId(externalId);
level.setTaxonomy(taxonomy);
level.setType(type);
dbInstance.getCurrentEntityManager().persist(level);
String storage = createLevelStorage(taxonomy, level);
level.setDirectoryPath(storage);
String identifiersPath = getMaterializedPathIdentifiers(parent, level);
String keysPath = getMaterializedPathKeys(parent, level);
level.setParent(parent);
level.setMaterializedPathKeys(keysPath);
level.setMaterializedPathIdentifiers(identifiersPath);
level = dbInstance.getCurrentEntityManager().merge(level);
level.getTaxonomy();
return level;
}
Aggregations