Search in sources :

Example 1 with ContextType

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

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

the class ManifestMetadataBuilder method getEducationContext.

public String getEducationContext() {
    EducationalType educational = getEducational(true);
    StringBuilder sb = new StringBuilder();
    if (educational != null) {
        ContextType type = getFromAny(ContextType.class, educational.getContent());
        if (type != null && type.getSource() != null && type.getSource().getLangstring() != null && type.getValue() != null && type.getValue().getLangstring() != null) {
            String source = type.getSource().getLangstring().getValue();
            String value = type.getValue().getLangstring().getValue();
            if (StringHelper.containsNonWhitespace(source) && StringHelper.containsNonWhitespace(value)) {
                sb.append(value);
            }
        }
    }
    return sb.length() == 0 ? null : sb.toString();
}
Also used : ContextType(org.olat.imsmd.xml.manifest.ContextType) EducationalType(org.olat.imsmd.xml.manifest.EducationalType)

Example 3 with ContextType

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

the class ManifestMetadataBuilder method getEducationContext.

public String getEducationContext() {
    EducationalType educational = getEducational(true);
    StringBuilder sb = new StringBuilder();
    if (educational != null) {
        ContextType type = getFromAny(ContextType.class, educational.getContent());
        if (type != null && type.getSource() != null && type.getSource().getLangstring() != null && type.getValue() != null && type.getValue().getLangstring() != null) {
            String source = type.getSource().getLangstring().getValue();
            String value = type.getValue().getLangstring().getValue();
            if (StringHelper.containsNonWhitespace(source) && StringHelper.containsNonWhitespace(value)) {
                sb.append(value);
            }
        }
    }
    return sb.length() == 0 ? null : sb.toString();
}
Also used : ContextType(org.olat.imsmd.xml.manifest.ContextType) EducationalType(org.olat.imsmd.xml.manifest.EducationalType)

Example 4 with ContextType

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

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)

Aggregations

ContextType (org.olat.imsmd.xml.manifest.ContextType)4 EducationalType (org.olat.imsmd.xml.manifest.EducationalType)4 SourceType (org.olat.imsmd.xml.manifest.SourceType)2 ValueType (org.olat.imsmd.xml.manifest.ValueType)2