Search in sources :

Example 6 with Feedback

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;
}
Also used : Item(org.olat.ims.qti.editor.beecom.objects.Item) VFSItem(org.olat.core.util.vfs.VFSItem) Feedback(org.olat.ims.qti.editor.beecom.objects.Feedback) Assessment(org.olat.ims.qti.editor.beecom.objects.Assessment) Section(org.olat.ims.qti.editor.beecom.objects.Section)

Example 7 with Feedback

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;
}
Also used : Feedback(org.olat.ims.qti.editor.beecom.objects.Feedback) Attribute(org.dom4j.Attribute) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList)

Example 8 with 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;
}
Also used : Feedback(org.olat.ims.qti.editor.beecom.objects.Feedback) Attribute(org.dom4j.Attribute) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

Feedback (org.olat.ims.qti.editor.beecom.objects.Feedback)8 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Material (org.olat.ims.qti.editor.beecom.objects.Material)4 Iterator (java.util.Iterator)2 Attribute (org.dom4j.Attribute)2 Element (org.dom4j.Element)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 Assessment (org.olat.ims.qti.editor.beecom.objects.Assessment)2 Item (org.olat.ims.qti.editor.beecom.objects.Item)2 Mattext (org.olat.ims.qti.editor.beecom.objects.Mattext)2 QTIObject (org.olat.ims.qti.editor.beecom.objects.QTIObject)2 Section (org.olat.ims.qti.editor.beecom.objects.Section)2