Search in sources :

Example 16 with LomType

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

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

the class ManifestMetadataBuilder method getEducational.

public EducationalType getEducational(boolean create) {
    LomType lom = getLom(create);
    if (lom == null)
        return null;
    EducationalType educational = lom.getEducational();
    if (educational == null && create) {
        educational = mdObjectFactory.createEducationalType();
        lom.setEducational(educational);
    }
    return educational;
}
Also used : EducationalType(org.olat.imsmd.xml.manifest.EducationalType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 18 with LomType

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

Example 19 with LomType

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

the class ManifestMetadataBuilder method getRights.

public RightsType getRights(boolean create) {
    LomType lom = getLom(create);
    if (lom == null)
        return null;
    RightsType rights = lom.getRights();
    if (rights == null && create) {
        rights = mdObjectFactory.createRightsType();
        lom.setRights(rights);
    }
    return rights;
}
Also used : RightsType(org.olat.imsmd.xml.manifest.RightsType) LomType(org.olat.imsmd.xml.manifest.LomType)

Example 20 with LomType

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

LomType (org.olat.imsmd.xml.manifest.LomType)20 ManifestMetadataType (org.olat.imscp.xml.manifest.ManifestMetadataType)4 TechnicalType (org.olat.imsmd.xml.manifest.TechnicalType)4 ClassificationType (org.olat.imsmd.xml.manifest.ClassificationType)2 EducationalType (org.olat.imsmd.xml.manifest.EducationalType)2 GeneralType (org.olat.imsmd.xml.manifest.GeneralType)2 LifecycleType (org.olat.imsmd.xml.manifest.LifecycleType)2 PurposeType (org.olat.imsmd.xml.manifest.PurposeType)2 RightsType (org.olat.imsmd.xml.manifest.RightsType)2