Search in sources :

Example 1 with LangstringType

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

the class ManifestMetadataBuilder method getGeneralKeywords.

public String getGeneralKeywords() {
    GeneralType general = getGeneral(false);
    if (general != null) {
        StringBuilder keywords = new StringBuilder();
        for (Object any : general.getContent()) {
            if (any instanceof JAXBElement<?> && ((JAXBElement<?>) any).getValue().getClass().equals(KeywordType.class)) {
                KeywordType keywordType = (KeywordType) ((JAXBElement<?>) any).getValue();
                List<LangstringType> langStrings = keywordType.getLangstring();
                for (LangstringType langString : langStrings) {
                    String keyword = langString.getValue();
                    if (keywords.length() > 0)
                        keywords.append(" ");
                    keywords.append(keyword);
                }
            }
        }
        return keywords.toString();
    }
    return null;
}
Also used : KeywordType(org.olat.imsmd.xml.manifest.KeywordType) LangstringType(org.olat.imsmd.xml.manifest.LangstringType) GeneralType(org.olat.imsmd.xml.manifest.GeneralType)

Example 2 with LangstringType

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

the class ManifestMetadataBuilder method getGeneralKeywords.

public String getGeneralKeywords() {
    GeneralType general = getGeneral(false);
    if (general != null) {
        StringBuilder keywords = new StringBuilder();
        for (Object any : general.getContent()) {
            if (any instanceof JAXBElement<?> && ((JAXBElement<?>) any).getValue().getClass().equals(KeywordType.class)) {
                KeywordType keywordType = (KeywordType) ((JAXBElement<?>) any).getValue();
                List<LangstringType> langStrings = keywordType.getLangstring();
                for (LangstringType langString : langStrings) {
                    String keyword = langString.getValue();
                    if (keywords.length() > 0)
                        keywords.append(" ");
                    keywords.append(keyword);
                }
            }
        }
        return keywords.toString();
    }
    return null;
}
Also used : KeywordType(org.olat.imsmd.xml.manifest.KeywordType) LangstringType(org.olat.imsmd.xml.manifest.LangstringType) GeneralType(org.olat.imsmd.xml.manifest.GeneralType)

Example 3 with LangstringType

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

the class ManifestMetadataBuilder method createString.

public LangstringType createString(String value, String lang) {
    LangstringType string = mdObjectFactory.createLangstringType();
    string.setLang(lang);
    string.setValue(value);
    return string;
}
Also used : LangstringType(org.olat.imsmd.xml.manifest.LangstringType)

Example 4 with LangstringType

use of org.olat.imsmd.xml.manifest.LangstringType 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();
}
Also used : TaxonType(org.olat.imsmd.xml.manifest.TaxonType) LangstringType(org.olat.imsmd.xml.manifest.LangstringType) TaxonpathType(org.olat.imsmd.xml.manifest.TaxonpathType) ClassificationType(org.olat.imsmd.xml.manifest.ClassificationType)

Example 5 with LangstringType

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

the class ManifestMetadataBuilder method createString.

public LangstringType createString(String value, String lang) {
    LangstringType string = mdObjectFactory.createLangstringType();
    string.setLang(lang);
    string.setValue(value);
    return string;
}
Also used : LangstringType(org.olat.imsmd.xml.manifest.LangstringType)

Aggregations

LangstringType (org.olat.imsmd.xml.manifest.LangstringType)6 ClassificationType (org.olat.imsmd.xml.manifest.ClassificationType)2 GeneralType (org.olat.imsmd.xml.manifest.GeneralType)2 KeywordType (org.olat.imsmd.xml.manifest.KeywordType)2 TaxonType (org.olat.imsmd.xml.manifest.TaxonType)2 TaxonpathType (org.olat.imsmd.xml.manifest.TaxonpathType)2