Search in sources :

Example 1 with SourceType

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

the class ManifestMetadataBuilder method setLicense.

public void setLicense(String license) {
    RightsType rights = getRights(true);
    CopyrightandotherrestrictionsType type = getFromAny(CopyrightandotherrestrictionsType.class, rights.getContent());
    if (type == null) {
        type = mdObjectFactory.createCopyrightandotherrestrictionsType();
        rights.getContent().add(mdObjectFactory.createCopyrightandotherrestrictions(type));
    }
    SourceType sourceType = mdObjectFactory.createSourceType();
    sourceType.setLangstring(createString("https://www.openolat.org", "en"));
    ValueType valueType = mdObjectFactory.createValueType();
    valueType.setLangstring(createString(license, "en"));
    type.setSource(sourceType);
    type.setValue(valueType);
}
Also used : CopyrightandotherrestrictionsType(org.olat.imsmd.xml.manifest.CopyrightandotherrestrictionsType) ValueType(org.olat.imsmd.xml.manifest.ValueType) RightsType(org.olat.imsmd.xml.manifest.RightsType) SourceType(org.olat.imsmd.xml.manifest.SourceType)

Example 2 with SourceType

use of org.olat.imsmd.xml.manifest.SourceType 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 3 with SourceType

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

the class ManifestMetadataBuilder method setEducationalContext.

public void setEducationalContext(String context, String lang) {
    EducationalType educational = getEducational(true);
    if (educational != null) {
        ContextType type = getFromAny(ContextType.class, educational.getContent());
        if (type == null) {
            type = mdObjectFactory.createContextType();
            educational.getContent().add(mdObjectFactory.createContext(type));
        }
        SourceType sourceType = mdObjectFactory.createSourceType();
        sourceType.setLangstring(createString("https://www.openolat.org", lang));
        ValueType valueType = mdObjectFactory.createValueType();
        valueType.setLangstring(createString(context, lang));
        type.setSource(sourceType);
        type.setValue(valueType);
    }
}
Also used : ContextType(org.olat.imsmd.xml.manifest.ContextType) ValueType(org.olat.imsmd.xml.manifest.ValueType) EducationalType(org.olat.imsmd.xml.manifest.EducationalType) SourceType(org.olat.imsmd.xml.manifest.SourceType)

Example 4 with SourceType

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

the class ManifestMetadataBuilder method createSource.

public SourceType createSource(String value, String lang) {
    SourceType sourceType = mdObjectFactory.createSourceType();
    sourceType.setLangstring(createString(value, lang));
    return sourceType;
}
Also used : SourceType(org.olat.imsmd.xml.manifest.SourceType)

Example 5 with SourceType

use of org.olat.imsmd.xml.manifest.SourceType 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

SourceType (org.olat.imsmd.xml.manifest.SourceType)8 ValueType (org.olat.imsmd.xml.manifest.ValueType)4 StringTokenizer (java.util.StringTokenizer)2 ClassificationType (org.olat.imsmd.xml.manifest.ClassificationType)2 ContextType (org.olat.imsmd.xml.manifest.ContextType)2 CopyrightandotherrestrictionsType (org.olat.imsmd.xml.manifest.CopyrightandotherrestrictionsType)2 EducationalType (org.olat.imsmd.xml.manifest.EducationalType)2 EntryType (org.olat.imsmd.xml.manifest.EntryType)2 RightsType (org.olat.imsmd.xml.manifest.RightsType)2 TaxonType (org.olat.imsmd.xml.manifest.TaxonType)2 TaxonpathType (org.olat.imsmd.xml.manifest.TaxonpathType)2