Search in sources :

Example 1 with PurposeType

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

the class ManifestMetadataBuilder method getClassification.

public ClassificationType getClassification(String purpose, String lang, boolean create) {
    LomType lom = getLom(create);
    if (lom == null)
        return null;
    ClassificationType classification = null;
    List<ClassificationType> classifications = lom.getClassification();
    for (ClassificationType cl : classifications) {
        PurposeType purposeType = getFromAny(PurposeType.class, cl.getContent());
        if (purposeType != null && purposeType.getValue() != null && purposeType.getValue().getLangstring() != null) {
            String value = purposeType.getValue().getLangstring().getValue();
            if (value != null && value.equals(purpose)) {
                classification = cl;
                break;
            }
        }
    }
    if (classification == null && create) {
        classification = mdObjectFactory.createClassificationType();
        PurposeType purposeType = mdObjectFactory.createPurposeType();
        purposeType.setSource(createSource("LOMv1.0", lang));
        purposeType.setValue(createValue(purpose, lang));
        classification.getContent().add(mdObjectFactory.createPurpose(purposeType));
        lom.getClassification().add(classification);
    }
    return classification;
}
Also used : PurposeType(org.olat.imsmd.xml.manifest.PurposeType) ClassificationType(org.olat.imsmd.xml.manifest.ClassificationType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 2 with PurposeType

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

the class ManifestMetadataBuilder method getClassification.

public ClassificationType getClassification(String purpose, String lang, boolean create) {
    LomType lom = getLom(create);
    if (lom == null)
        return null;
    ClassificationType classification = null;
    List<ClassificationType> classifications = lom.getClassification();
    for (ClassificationType cl : classifications) {
        PurposeType purposeType = getFromAny(PurposeType.class, cl.getContent());
        if (purposeType != null && purposeType.getValue() != null && purposeType.getValue().getLangstring() != null) {
            String value = purposeType.getValue().getLangstring().getValue();
            if (value != null && value.equals(purpose)) {
                classification = cl;
                break;
            }
        }
    }
    if (classification == null && create) {
        classification = mdObjectFactory.createClassificationType();
        PurposeType purposeType = mdObjectFactory.createPurposeType();
        purposeType.setSource(createSource("LOMv1.0", lang));
        purposeType.setValue(createValue(purpose, lang));
        classification.getContent().add(mdObjectFactory.createPurpose(purposeType));
        lom.getClassification().add(classification);
    }
    return classification;
}
Also used : PurposeType(org.olat.imsmd.xml.manifest.PurposeType) ClassificationType(org.olat.imsmd.xml.manifest.ClassificationType) LomType(org.olat.imsmd.xml.manifest.LomType)

Aggregations

ClassificationType (org.olat.imsmd.xml.manifest.ClassificationType)2 LomType (org.olat.imsmd.xml.manifest.LomType)2 PurposeType (org.olat.imsmd.xml.manifest.PurposeType)2