Package org.olat.ims.qti.editor.beecom.objects

Examples of org.olat.ims.qti.editor.beecom.objects.Assessment


  /**
   * @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);
   
    //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;
  }
View Full Code Here


   */
  public QTIEditorPackage(String title, String type, Locale locale) {
    // create new qti document
    translator = new PackageTranslator("org.olat.ims.qti", locale);
    qtiDocument = new QTIDocument();
    Assessment assessment = QTIEditHelper.createAssessment(title, type);
    qtiDocument.setAssessment(assessment);
    Section section = QTIEditHelper.createSection(translator);
    List sectionList = new ArrayList();
    sectionList.add(section);
    assessment.setSections(sectionList);
    List itemList = new ArrayList();
    itemList.add(QTIEditHelper.createSCItem(translator));
    section.setItems(itemList);
    // initialize package
    packageSubDir = CodeHelper.getGlobalForeverUniqueID();
View Full Code Here

   * @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;
  }
View Full Code Here

      controls = item.getItemcontrols();
    } else if (Section.class.isAssignableFrom(object.getClass())) {
      Section section = (Section) object;
      controls = section.getSectioncontrols();
    } else if (Assessment.class.isAssignableFrom(object.getClass())) {
      Assessment assessment = (Assessment) object;
      controls = assessment.getAssessmentcontrols();
    }
    for (Iterator i = controls.iterator(); i.hasNext();) {
      Control tmp = (Control) i.next();
      if (tmp.getView() != null) {
        if (tmp.getView().equalsIgnoreCase("all")) {
View Full Code Here

      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;
  }
View Full Code Here

  /**
   * takes the assessment object tree and converts it to a QTIEditorTreeModel
   */
  private void init() {
    Assessment ass = qtiPackage.getQTIDocument().getAssessment();
    GenericQtiNode rootNode = new AssessmentNode(ass, qtiPackage);
    this.setRootNode(rootNode);
    //Sections with their Items
    List sections = ass.getSections();
    for (int i=0; i < sections.size(); i++) {
      //get section data
      Section elem = (Section)sections.get(i);
      GenericQtiNode sectionNode = new SectionNode(elem, qtiPackage);
      List items = elem.getItems();
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.editor.beecom.objects.Assessment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.