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;
}
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;
}
Aggregations