org.sakaiproject.tool.assessment.qti.helper.item
Class ItemHelper12Impl

java.lang.Object
  extended byorg.sakaiproject.tool.assessment.qti.helper.item.ItemHelperBase
      extended byorg.sakaiproject.tool.assessment.qti.helper.item.ItemHelper12Impl
All Implemented Interfaces:
ItemHelperIfc

public class ItemHelper12Impl
extends ItemHelperBase
implements ItemHelperIfc

Copyright: Copyright (c) 2004

Organization: Sakai Project

Version for QTI 1.2 item XML, significant differences between 1.2 and 2.0

Version:
$Id: ItemHelper12Impl.java 6558 2006-03-09 00:07:40Z lydial@stanford.edu $
Author:
Ed Smiley esmiley@stanford.edu

Originally ItemHelper.java

, Shastri, Rashmi

Field Summary
protected  String[] itemTypes
           
 
Fields inherited from class org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperBase
ITEM_AUDIO, ITEM_ESSAY, ITEM_FIB, ITEM_FILE, ITEM_MATCHING, ITEM_MCMC, ITEM_MCSC, ITEM_SURVEY, ITEM_TF
 
Fields inherited from interface org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperIfc
ITEM_AUDIO, ITEM_ESSAY, ITEM_FIB, ITEM_FILE, ITEM_MATCHING, ITEM_MCMC, ITEM_MCSC, ITEM_SURVEY, ITEM_TF
 
Constructor Summary
ItemHelper12Impl()
           
 
Method Summary
 void addCorrectAnswer(String correctAnswerLabel, Item itemXml)
          Flags an answer as correct.
 void addIncorrectAnswer(String incorrectAnswerLabel, Item itemXml)
          Flags an answer as INCORRECT.
 void addMaxScore(Float score, Item itemXml)
          Add maximum score to item XML.
 void addMinScore(Float score, Item itemXml)
          Add minimum score to item XML
 void addResponseEntry(Item itemXml, String xpath, String value, boolean isInsert, String responseNo, String responseLabel)
          Add/update a response label entry
 void flagAnswerCorrect(String answerLabel, Item itemXml, boolean correct)
          Flags an answer as correct/incorrect.
protected  AuthoringXml getAuthoringXml()
          We will have a versioned AuthoringXml in subclasses.
 String getItemType(Item itemXml)
          get item type string
 String getMetaLabelXPath(String fieldlabel)
          Get the metadata field entry XPath for a given label
 String getMetaXPath()
          Get the metadata field entry XPath
protected  int getQtiVersion()
          get the qti version
 String getText(Item itemXml)
          Get the text for the item
 void setAnswers(ArrayList itemTextList, Item itemXml)
          Set the answer texts for item.
 void setFeedback(ArrayList itemTextList, Item itemXml)
          Set the feedback texts for item.
 void setItemText(String itemText, Item itemXml)
          Set the item text.
 void setItemTexts(ArrayList itemTextList, Item itemXml)
          Set the (one or more) item texts.
 
Methods inherited from class org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperBase
getItemTypeString, makeItemNodeText, readTypeSurveyItem, readTypeXMLItem, readXMLDocument, updateItemXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperIfc
getItemTypeString, readTypeSurveyItem, readTypeXMLItem, readXMLDocument, updateItemXml
 

Field Detail

itemTypes

protected String[] itemTypes
Constructor Detail

ItemHelper12Impl

public ItemHelper12Impl()
Method Detail

getAuthoringXml

protected AuthoringXml getAuthoringXml()
Description copied from class: ItemHelperBase
We will have a versioned AuthoringXml in subclasses.

Specified by:
getAuthoringXml in class ItemHelperBase
Returns:

getQtiVersion

protected int getQtiVersion()
get the qti version

Specified by:
getQtiVersion in class ItemHelperBase
Returns:

addMaxScore

public void addMaxScore(Float score,
                        Item itemXml)
Add maximum score to item XML.

Specified by:
addMaxScore in interface ItemHelperIfc
Parameters:
score -
itemXml -

addMinScore

public void addMinScore(Float score,
                        Item itemXml)
Add minimum score to item XML

Specified by:
addMinScore in interface ItemHelperIfc
Parameters:
score -
itemXml -

addCorrectAnswer

public void addCorrectAnswer(String correctAnswerLabel,
                             Item itemXml)
Flags an answer as correct.

Specified by:
addCorrectAnswer in interface ItemHelperIfc
Parameters:
correctAnswerLabel - the answer that is correct
itemXml - the encapsulation of the item xml

addIncorrectAnswer

public void addIncorrectAnswer(String incorrectAnswerLabel,
                               Item itemXml)
Flags an answer as INCORRECT. Currently, only used for true false questions.

Specified by:
addIncorrectAnswer in interface ItemHelperIfc
Parameters:
incorrectAnswerLabel - the answer that is NOT correct
itemXml - the encapsulation of the item xml

flagAnswerCorrect

public void flagAnswerCorrect(String answerLabel,
                              Item itemXml,
                              boolean correct)
Flags an answer as correct/incorrect.

Parameters:
itemXml - the encapsulation of the item xml
correct - true, or false if not correct

addResponseEntry

public void addResponseEntry(Item itemXml,
                             String xpath,
                             String value,
                             boolean isInsert,
                             String responseNo,
                             String responseLabel)
Add/update a response label entry

Parameters:
itemXml -
xpath -
isInsert -
responseNo -

getMetaXPath

public String getMetaXPath()
Get the metadata field entry XPath

Specified by:
getMetaXPath in interface ItemHelperIfc
Returns:
the XPath

getMetaLabelXPath

public String getMetaLabelXPath(String fieldlabel)
Get the metadata field entry XPath for a given label

Specified by:
getMetaLabelXPath in interface ItemHelperIfc
Parameters:
fieldlabel -
Returns:
the XPath

getText

public String getText(Item itemXml)
Get the text for the item

Specified by:
getText in interface ItemHelperIfc
Parameters:
itemXml -
Returns:
the text

setItemText

public void setItemText(String itemText,
                        Item itemXml)
Set the item text. This is valid for all undelimited single item texts. Not valid for matching or fill in the blank, but OK for instructional text

Specified by:
setItemText in interface ItemHelperIfc
Parameters:
itemText - text to be updated
itemXml -

setItemTexts

public void setItemTexts(ArrayList itemTextList,
                         Item itemXml)
Set the (one or more) item texts. Valid for single and multiple texts.

Specified by:
setItemTexts in interface ItemHelperIfc
Parameters:
itemXml -

getItemType

public String getItemType(Item itemXml)
get item type string

Specified by:
getItemType in interface ItemHelperIfc
Parameters:
itemXml -
Returns:
type as string

setAnswers

public void setAnswers(ArrayList itemTextList,
                       Item itemXml)
Set the answer texts for item.

Specified by:
setAnswers in interface ItemHelperIfc
Parameters:
itemTextList - the text(s) for item

setFeedback

public void setFeedback(ArrayList itemTextList,
                        Item itemXml)
Set the feedback texts for item.

Specified by:
setFeedback in interface ItemHelperIfc
Parameters:
itemTextList - the text(s) for item
itemXml -