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