use of org.olat.imsmd.xml.manifest.TaxonType 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);
}
}
}
use of org.olat.imsmd.xml.manifest.TaxonType 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);
}
}
}
use of org.olat.imsmd.xml.manifest.TaxonType in project OpenOLAT by OpenOLAT.
the class ManifestMetadataBuilder method getClassificationTaxonomy.
public String getClassificationTaxonomy() {
StringBuilder sb = new StringBuilder();
ClassificationType classification = getClassification("discipline", null, false);
if (classification != null) {
TaxonpathType taxonpath = getFromAny(TaxonpathType.class, classification.getContent());
if (taxonpath != null) {
List<TaxonType> taxons = taxonpath.getTaxon();
if (taxons != null) {
for (TaxonType taxon : taxons) {
if (taxon.getEntry() != null && taxon.getEntry().getLangstring().size() > 0) {
LangstringType value = taxon.getEntry().getLangstring().get(0);
if (value != null && value.getValue() != null) {
sb.append("/").append(value.getValue());
}
}
}
}
}
}
return sb.length() == 0 ? null : sb.toString();
}
use of org.olat.imsmd.xml.manifest.TaxonType in project openolat by klemens.
the class ManifestMetadataBuilder method getClassificationTaxonomy.
public String getClassificationTaxonomy() {
StringBuilder sb = new StringBuilder();
ClassificationType classification = getClassification("discipline", null, false);
if (classification != null) {
TaxonpathType taxonpath = getFromAny(TaxonpathType.class, classification.getContent());
if (taxonpath != null) {
List<TaxonType> taxons = taxonpath.getTaxon();
if (taxons != null) {
for (TaxonType taxon : taxons) {
if (taxon.getEntry() != null && taxon.getEntry().getLangstring().size() > 0) {
LangstringType value = taxon.getEntry().getLangstring().get(0);
if (value != null && value.getValue() != null) {
sb.append("/").append(value.getValue());
}
}
}
}
}
}
return sb.length() == 0 ? null : sb.toString();
}
Aggregations