use of org.olat.ims.qti.editor.beecom.objects.Metadata in project OpenOLAT by OpenOLAT.
the class QTIEditorPackageImpl method getQTIDocument.
/**
* @return Reutrns the QTIDocument structure
*/
public QTIDocument getQTIDocument() {
if (qtiDocument == null) {
if (hasSerializedQTIDocument()) {
qtiDocument = loadSerializedQTIDocument();
resumed = true;
} else {
unzipPackage();
Document doc = loadQTIDocument();
if (doc != null) {
ParserManager parser = new ParserManager();
qtiDocument = (QTIDocument) parser.parse(doc);
// grab assessment type
Metadata meta = qtiDocument.getAssessment().getMetadata();
String assessType = meta.getField(AssessmentInstance.QMD_LABEL_TYPE);
if (assessType != null) {
qtiDocument.setSurvey(assessType.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY));
}
resumed = false;
} else {
qtiDocument = null;
}
}
}
return qtiDocument;
}
use of org.olat.ims.qti.editor.beecom.objects.Metadata in project OpenOLAT by OpenOLAT.
the class QTIEditHelper method createAssessment.
/**
* Creates an empty assessment
* @param title
* @param type
* @return Assessment
*/
public static Assessment createAssessment(String title, String type) {
Assessment assessment = new Assessment();
assessment.setIdent(CodeHelper.getGlobalForeverUniqueID());
assessment.setTitle(title);
Metadata meta = new Metadata();
meta.setField(AssessmentInstance.QMD_LABEL_TYPE, type);
assessment.setMetadata(meta);
return assessment;
}
use of org.olat.ims.qti.editor.beecom.objects.Metadata in project openolat by klemens.
the class QTIEditorPackageImpl method getQTIDocument.
/**
* @return Reutrns the QTIDocument structure
*/
public QTIDocument getQTIDocument() {
if (qtiDocument == null) {
if (hasSerializedQTIDocument()) {
qtiDocument = loadSerializedQTIDocument();
resumed = true;
} else {
unzipPackage();
Document doc = loadQTIDocument();
if (doc != null) {
ParserManager parser = new ParserManager();
qtiDocument = (QTIDocument) parser.parse(doc);
// grab assessment type
Metadata meta = qtiDocument.getAssessment().getMetadata();
String assessType = meta.getField(AssessmentInstance.QMD_LABEL_TYPE);
if (assessType != null) {
qtiDocument.setSurvey(assessType.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY));
}
resumed = false;
} else {
qtiDocument = null;
}
}
}
return qtiDocument;
}
use of org.olat.ims.qti.editor.beecom.objects.Metadata in project openolat by klemens.
the class QTIMetadataParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("qtimetadata");
Metadata meta = new Metadata();
List metadatafields = element.selectNodes("./qtimetadatafield");
for (Iterator iter = metadatafields.iterator(); iter.hasNext(); ) {
Element metadatafield = (Element) iter.next();
String key = metadatafield.elementText("fieldlabel");
String value = metadatafield.elementText("fieldentry");
meta.setField(key, value);
}
return meta;
}
use of org.olat.ims.qti.editor.beecom.objects.Metadata in project OpenOLAT by OpenOLAT.
the class AssessmentParser method parse.
/**
* @see org.olat.ims.qti.editor.beecom.IParser#parse(org.dom4j.Element)
*/
public Object parse(Element element) {
// assert element.getName().equalsIgnoreCase("assessment");
Assessment assessment = new Assessment();
// attributes
Attribute attr = element.attribute("ident");
if (attr != null)
assessment.setIdent(attr.getValue());
attr = element.attribute("title");
if (attr != null)
assessment.setTitle(attr.getValue());
// elements
// DURATION
QTIObject duration = (QTIObject) parserManager.parse(element.element("duration"));
assessment.setDuration(duration);
// ASSESSMENTCONTROL
List assessmentcontrolsXML = element.elements("assessmentcontrol");
List assessmentcontrols = new ArrayList();
for (Iterator i = assessmentcontrolsXML.iterator(); i.hasNext(); ) {
assessmentcontrols.add(parserManager.parse((Element) i.next()));
assessment.setInheritControls(true);
}
if (assessmentcontrols.size() == 0) {
assessmentcontrols.add(new Control());
assessment.setInheritControls(false);
}
assessment.setAssessmentcontrols(assessmentcontrols);
// OUTCOMES PROCESSING
OutcomesProcessing outcomesProcessing = (OutcomesProcessing) parserManager.parse(element.element("outcomes_processing"));
if (outcomesProcessing != null)
assessment.setOutcomes_processing(outcomesProcessing);
// SELECTION ORDERING
SelectionOrdering selectionOrdering = (SelectionOrdering) parserManager.parse(element.element("selection_ordering"));
if (selectionOrdering != null) {
assessment.setSelection_ordering(selectionOrdering);
} else {
assessment.setSelection_ordering(new SelectionOrdering());
}
// SECTIONS
List sectionsXML = element.elements("section");
List sections = new ArrayList();
for (Iterator i = sectionsXML.iterator(); i.hasNext(); ) {
sections.add(parserManager.parse((Element) i.next()));
}
assessment.setSections(sections);
// ITEMS
List itemsXML = element.elements("item");
List items = new ArrayList();
for (Iterator i = itemsXML.iterator(); i.hasNext(); ) {
items.add(parserManager.parse((Element) i.next()));
}
assessment.setItems(items);
// OBJECTIVES
Element mattext = (Element) element.selectSingleNode("./objectives/material/mattext");
if (mattext != null)
assessment.setObjectives(mattext.getTextTrim());
// METADATA
Metadata metadata = (Metadata) parserManager.parse(element.element("qtimetadata"));
if (metadata != null)
assessment.setMetadata(metadata);
return assessment;
}
Aggregations