Search in sources :

Example 11 with GeneralType

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

the class ManifestMetadataBuilder method setCoverage.

public void setCoverage(String coverage, String lang) {
    GeneralType general = getGeneral(true);
    if (general != null) {
        CoverageType type = getFromAny(CoverageType.class, general.getContent());
        if (type == null) {
            type = mdObjectFactory.createCoverageType();
            general.getContent().add(mdObjectFactory.createCoverage(type));
        }
        createOrUpdateFirstLangstring(type.getLangstring(), coverage, lang);
    }
}
Also used : CoverageType(org.olat.imsmd.xml.manifest.CoverageType) GeneralType(org.olat.imsmd.xml.manifest.GeneralType)

Example 12 with GeneralType

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

the class ManifestMetadataBuilder method setGeneralKeywords.

public void setGeneralKeywords(String keywords, String lang) {
    GeneralType general = getGeneral(true);
    if (general != null) {
        clearFromAny(KeywordType.class, general.getContent());
        for (StringTokenizer tokenizer = new StringTokenizer(keywords, " "); tokenizer.hasMoreTokens(); ) {
            String keyword = tokenizer.nextToken();
            KeywordType type = mdObjectFactory.createKeywordType();
            general.getContent().add(mdObjectFactory.createKeyword(type));
            createOrUpdateFirstLangstring(type.getLangstring(), keyword, lang);
        }
    }
}
Also used : KeywordType(org.olat.imsmd.xml.manifest.KeywordType) StringTokenizer(java.util.StringTokenizer) GeneralType(org.olat.imsmd.xml.manifest.GeneralType)

Example 13 with GeneralType

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

the class ManifestMetadataBuilder method setLanguage.

public void setLanguage(String language, String lang) {
    GeneralType general = getGeneral(true);
    if (general != null) {
        StringType type = getFromAny(StringType.class, general.getContent());
        if (type == null) {
            type = mdObjectFactory.createStringType();
            QName languageQNAME = new QName("http://www.imsglobal.org/xsd/imsmd_v1p2", "context");
            JAXBElement<StringType> typeEl = new JAXBElement<StringType>(languageQNAME, StringType.class, null, type);
            general.getContent().add(typeEl);
        }
        type.setLang(lang);
        type.setValue(language);
    }
}
Also used : StringType(org.olat.imsmd.xml.manifest.StringType) QName(javax.xml.namespace.QName) JAXBElement(javax.xml.bind.JAXBElement) GeneralType(org.olat.imsmd.xml.manifest.GeneralType)

Example 14 with GeneralType

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

the class ManifestMetadataBuilder method getGeneral.

public GeneralType getGeneral(boolean create) {
    LomType lom = getLom(create);
    if (lom == null)
        return null;
    GeneralType general = lom.getGeneral();
    if (general == null && create) {
        general = mdObjectFactory.createGeneralType();
        lom.setGeneral(general);
    }
    return general;
}
Also used : GeneralType(org.olat.imsmd.xml.manifest.GeneralType) LomType(org.olat.imsmd.xml.manifest.LomType)

Aggregations

GeneralType (org.olat.imsmd.xml.manifest.GeneralType)14 KeywordType (org.olat.imsmd.xml.manifest.KeywordType)4 StringTokenizer (java.util.StringTokenizer)2 JAXBElement (javax.xml.bind.JAXBElement)2 QName (javax.xml.namespace.QName)2 CoverageType (org.olat.imsmd.xml.manifest.CoverageType)2 DescriptionType (org.olat.imsmd.xml.manifest.DescriptionType)2 LangstringType (org.olat.imsmd.xml.manifest.LangstringType)2 LomType (org.olat.imsmd.xml.manifest.LomType)2 StringType (org.olat.imsmd.xml.manifest.StringType)2 TitleType (org.olat.imsmd.xml.manifest.TitleType)2