use of org.olat.ims.qti.editor.beecom.objects.Feedback in project openolat by klemens.
the class QTIEditHelper method getFeedbacks.
/**
* @param object
* @return
*/
private static List<Feedback> getFeedbacks(QTIObject object) {
List<Feedback> feedbacks = null;
if (Item.class.isAssignableFrom(object.getClass())) {
Item item = (Item) object;
feedbacks = item.getItemfeedbacks();
} else if (Section.class.isAssignableFrom(object.getClass())) {
Section section = (Section) object;
feedbacks = section.getSectionfeedbacks();
} else if (Assessment.class.isAssignableFrom(object.getClass())) {
Assessment assessment = (Assessment) object;
feedbacks = assessment.getAssessfeedbacks();
}
return feedbacks;
}
use of org.olat.ims.qti.editor.beecom.objects.Feedback in project openolat by klemens.
the class FeedbackParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.objects.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("sectionfeedback")
// || element.getName().equalsIgnoreCase("itemfeedback")
// || element.getName().equalsIgnoreCase("assessmentfeedback");
List materialsXML = element.selectNodes(".//material");
if (materialsXML.size() == 0)
return null;
Feedback feedback = new Feedback();
// attributes
Attribute tmp = element.attribute("ident");
if (tmp != null)
feedback.setIdent(tmp.getValue());
tmp = element.attribute("title");
if (tmp != null)
feedback.setTitle(tmp.getValue());
tmp = element.attribute("view");
if (tmp != null)
feedback.setView(tmp.getValue());
// get type
if (element.element("solution") != null)
return null;
else if (element.element("hint") != null)
return null;
// parse Material
// MATERIAL
List<Object> materials = new ArrayList<>();
for (Iterator i = materialsXML.iterator(); i.hasNext(); ) {
materials.add(parserManager.parse((Element) i.next()));
}
feedback.setMaterials(materials);
return feedback;
}
use of org.olat.ims.qti.editor.beecom.objects.Feedback in project OpenOLAT by OpenOLAT.
the class FeedbackParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.objects.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("sectionfeedback")
// || element.getName().equalsIgnoreCase("itemfeedback")
// || element.getName().equalsIgnoreCase("assessmentfeedback");
List materialsXML = element.selectNodes(".//material");
if (materialsXML.size() == 0)
return null;
Feedback feedback = new Feedback();
// attributes
Attribute tmp = element.attribute("ident");
if (tmp != null)
feedback.setIdent(tmp.getValue());
tmp = element.attribute("title");
if (tmp != null)
feedback.setTitle(tmp.getValue());
tmp = element.attribute("view");
if (tmp != null)
feedback.setView(tmp.getValue());
// get type
if (element.element("solution") != null)
return null;
else if (element.element("hint") != null)
return null;
// parse Material
// MATERIAL
List<Object> materials = new ArrayList<>();
for (Iterator i = materialsXML.iterator(); i.hasNext(); ) {
materials.add(parserManager.parse((Element) i.next()));
}
feedback.setMaterials(materials);
return feedback;
}
Aggregations