Search in sources :

Example 1 with EntryType

use of org.olat.imsmd.xml.manifest.EntryType in project OpenOLAT by OpenOLAT.

the class ManifestMetadataBuilder method setClassificationTaxonomy.

/**
 * Set a taxonomy path of purpose "discipline"
 * @param taxonomyPath
 * @param lang
 */
public void setClassificationTaxonomy(String taxonomyPath, String lang) {
    ClassificationType classification = getClassification("discipline", lang, true);
    if (classification != null) {
        TaxonpathType taxonpathType = mdObjectFactory.createTaxonpathType();
        clearFromAny(TaxonpathType.class, classification.getContent());
        classification.getContent().add(mdObjectFactory.createTaxonpath(taxonpathType));
        taxonpathType.getTaxon().clear();
        SourceType sourceType = mdObjectFactory.createSourceType();
        sourceType.setLangstring(createString("Unkown", "en"));
        taxonpathType.setSource(sourceType);
        for (StringTokenizer tokenizer = new StringTokenizer(taxonomyPath, "/"); tokenizer.hasMoreTokens(); ) {
            String level = tokenizer.nextToken();
            TaxonType taxonType = mdObjectFactory.createTaxonType();
            EntryType entryType = mdObjectFactory.createEntryType();
            createOrUpdateFirstLangstring(entryType.getLangstring(), level, lang);
            taxonType.setEntry(entryType);
            taxonpathType.getTaxon().add(taxonType);
        }
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) EntryType(org.olat.imsmd.xml.manifest.EntryType) TaxonType(org.olat.imsmd.xml.manifest.TaxonType) SourceType(org.olat.imsmd.xml.manifest.SourceType) TaxonpathType(org.olat.imsmd.xml.manifest.TaxonpathType) ClassificationType(org.olat.imsmd.xml.manifest.ClassificationType)

Example 2 with EntryType

use of org.olat.imsmd.xml.manifest.EntryType in project openolat by klemens.

the class ManifestMetadataBuilder method setClassificationTaxonomy.

/**
 * Set a taxonomy path of purpose "discipline"
 * @param taxonomyPath
 * @param lang
 */
public void setClassificationTaxonomy(String taxonomyPath, String lang) {
    ClassificationType classification = getClassification("discipline", lang, true);
    if (classification != null) {
        TaxonpathType taxonpathType = mdObjectFactory.createTaxonpathType();
        clearFromAny(TaxonpathType.class, classification.getContent());
        classification.getContent().add(mdObjectFactory.createTaxonpath(taxonpathType));
        taxonpathType.getTaxon().clear();
        SourceType sourceType = mdObjectFactory.createSourceType();
        sourceType.setLangstring(createString("Unkown", "en"));
        taxonpathType.setSource(sourceType);
        for (StringTokenizer tokenizer = new StringTokenizer(taxonomyPath, "/"); tokenizer.hasMoreTokens(); ) {
            String level = tokenizer.nextToken();
            TaxonType taxonType = mdObjectFactory.createTaxonType();
            EntryType entryType = mdObjectFactory.createEntryType();
            createOrUpdateFirstLangstring(entryType.getLangstring(), level, lang);
            taxonType.setEntry(entryType);
            taxonpathType.getTaxon().add(taxonType);
        }
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) EntryType(org.olat.imsmd.xml.manifest.EntryType) TaxonType(org.olat.imsmd.xml.manifest.TaxonType) SourceType(org.olat.imsmd.xml.manifest.SourceType) TaxonpathType(org.olat.imsmd.xml.manifest.TaxonpathType) ClassificationType(org.olat.imsmd.xml.manifest.ClassificationType)

Aggregations

StringTokenizer (java.util.StringTokenizer)2 ClassificationType (org.olat.imsmd.xml.manifest.ClassificationType)2 EntryType (org.olat.imsmd.xml.manifest.EntryType)2 SourceType (org.olat.imsmd.xml.manifest.SourceType)2 TaxonType (org.olat.imsmd.xml.manifest.TaxonType)2 TaxonpathType (org.olat.imsmd.xml.manifest.TaxonpathType)2