Search in sources :

Example 6 with TaxonomyLevelImpl

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;
}
Also used : TaxonomyLevelImpl(org.olat.modules.taxonomy.model.TaxonomyLevelImpl) Date(java.util.Date)

Aggregations

Date (java.util.Date)6 TaxonomyLevelImpl (org.olat.modules.taxonomy.model.TaxonomyLevelImpl)6 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)4 Taxonomy (org.olat.modules.taxonomy.Taxonomy)2