Class ItemHelper12Impl

  • All Implemented Interfaces:
    ItemHelperIfc

    public class ItemHelper12Impl
    extends ItemHelperBase
    implements ItemHelperIfc

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

    * @version $Id$ Many methods in Fill in Blank and Numerical Responses(FIN) are identical for now. This might change if we want to add random variable, parameterized calculation....
    • Field Detail

      • itemTypes

        protected String[] itemTypes
    • Constructor Detail

      • ItemHelper12Impl

        public ItemHelper12Impl()
    • Method Detail

      • addMaxScore

        public void addMaxScore​(Double score,
                                Item itemXml)
        Add maximum score to item XML.
        Specified by:
        addMaxScore in interface ItemHelperIfc
        Parameters:
        score -
        itemXml -
      • addMinScore

        public void addMinScore​(Double discount,
                                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:
        correctAnswerLabel - the answer that is correct
        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 -
        itemText -
        isInsert -
        responseNo -
        responseLabelIdent -
      • 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 -
      • setItemText

        public void setItemText​(String itemText,
                                String flowClass,
                                Item itemXml)
        Description copied from interface: ItemHelperIfc
        Set the (usually instructional text) for the item for the specified flow.
        Specified by:
        setItemText in interface ItemHelperIfc
      • setItemTexts

        public void setItemTexts​(List<org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc> itemTextList,
                                 Item itemXml)
        Set the (one or more) item texts. Valid for single and multiple texts.
        Specified by:
        setItemTexts in interface ItemHelperIfc
        Parameters:
        itemXml -
        itemText - text to be updated
      • 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​(List<org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc> 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​(List<org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc> itemTextList,
                                Item itemXml)
        Set the feedback texts for item.
        Specified by:
        setFeedback in interface ItemHelperIfc
        Parameters:
        itemTextList - the text(s) for item
        itemXml -
      • setAttachments

        public void setAttachments​(Set<? extends org.sakaiproject.tool.assessment.data.ifc.assessment.AttachmentIfc> attachmentSet,
                                   Item itemXml)
        Specified by:
        setAttachments in interface ItemHelperIfc