001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/qti/helper/item/ItemHelperIfc.java $
003: * $Id: ItemHelperIfc.java 9274 2006-05-10 22:50:48Z daisyf@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the"License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.assessment.qti.helper.item;
021:
022: import java.io.InputStream;
023: import java.util.ArrayList;
024:
025: import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc;
026: import org.sakaiproject.tool.assessment.qti.asi.Item;
027:
028: /**
029: * Interface for QTI-versioned item helper implementation.
030: * <p>Copyright: Copyright (c) 2005</p>
031: * <p>Organization: Sakai Project</p>
032: * @author Ed Smiley esmiley@stanford.edu
033: * @version $Id: ItemHelperIfc.java 9274 2006-05-10 22:50:48Z daisyf@stanford.edu $
034: */
035:
036: public interface ItemHelperIfc {
037: public static final long ITEM_AUDIO = TypeIfc.AUDIO_RECORDING
038: .longValue();
039: public static final long ITEM_ESSAY = TypeIfc.ESSAY_QUESTION
040: .longValue();
041: public static final long ITEM_FILE = TypeIfc.FILE_UPLOAD
042: .longValue();
043: public static final long ITEM_FIB = TypeIfc.FILL_IN_BLANK
044: .longValue();
045: public static final long ITEM_FIN = TypeIfc.FILL_IN_NUMERIC
046: .longValue();
047: public static final long ITEM_MCSC = TypeIfc.MULTIPLE_CHOICE
048: .longValue();
049: public static final long ITEM_SURVEY = TypeIfc.MULTIPLE_CHOICE_SURVEY
050: .longValue();
051: public static final long ITEM_MCMC = TypeIfc.MULTIPLE_CORRECT
052: .longValue();
053: public static final long ITEM_TF = TypeIfc.TRUE_FALSE.longValue();
054: public static final long ITEM_MATCHING = TypeIfc.MATCHING
055: .longValue();
056: public String[] itemTypes = { "Unknown Type", "Multiple Choice",
057: "Multiple Correct Answer", "Survey", "True or False",
058: "Short Answers/Essay", "File Upload", "Audio Recording",
059: "Fill In the Blank", "Numeric Response", "Matching", };
060:
061: /**
062: * Get Item Xml for a given item type as a Long .
063: * @param type item type as a Long
064: * @return
065: */
066:
067: public Item readTypeXMLItem(Long type);
068:
069: /**
070: * Get Item Xml for a given survey item scale name.
071: * @param scaleName
072: * @return
073: */
074: public Item readTypeSurveyItem(String scaleName);
075:
076: /**
077: * Read XML document from input stream
078: *
079: * @param inputStream XML docuemnt stream
080: *
081: * @return item XML
082: */
083: public Item readXMLDocument(InputStream inputStream);
084:
085: /**
086: * Get item type string which is used for the title of a given item type
087: * @param type
088: * @return
089: */
090:
091: public String getItemTypeString(TypeIfc type);
092:
093: // /**
094: // * Add/update a response entry/answer
095: // * @param itemXml
096: // * @param xpath
097: // * @param itemText
098: // * @param isInsert
099: // * @param responseNo
100: // * @param responseLabelIdent
101: // */
102: // public void addResponseEntry(
103: // Item itemXml, String xpath, String value,
104: // boolean isInsert, String responseNo, String responseLabel);
105: /**
106: * DOCUMENTATION PENDING
107: *
108: * @param itemXml item xml to update
109: * @param xpath the XPath
110: * @param value value to set
111: *
112: * @return the item xml
113: */
114: public Item updateItemXml(Item itemXml, String xpath, String value);
115:
116: /**
117: * Add minimum score to item XML.
118: * @param score
119: * @param itemXml
120: */
121: public void addMaxScore(Float score, Item itemXml);
122:
123: /**
124: * Add maximum score to item XML
125: * @param score
126: * @param itemXml
127: */
128: public void addMinScore(Float score, Item itemXml);
129:
130: /**
131: * Flags an answer as correct.
132: * @param correctAnswerLabel
133: */
134: public void addCorrectAnswer(String correctAnswerLabel, Item itemXml);
135:
136: /**
137: * Flags an answer as NOT correct.
138: * @param correctAnswerLabel
139: */
140: public void addIncorrectAnswer(String incorrectAnswerLabel,
141: Item itemXml);
142:
143: /**
144: * Get the metadata field entry XPath
145: * @return the XPath
146: */
147: public String getMetaXPath();
148:
149: /**
150: * Get the metadata field entry XPath for a given label
151: * @param fieldlabel
152: * @return the XPath
153: */
154: public String getMetaLabelXPath(String fieldlabel);
155:
156: /**
157: * Get the text for the item
158: * @param itemXml
159: * @return the text
160: */
161: public String getText(Item itemXml);
162:
163: /**
164: * Set the (one or more) item texts.
165: * Valid for single and multiple texts.
166: * @param itemXml
167: * @param itemText text to be updated
168: */
169: public void setItemTexts(ArrayList itemTextList, Item itemXml);
170:
171: /**
172: * Set the (usually instructional text) for trhe item.
173: * @param itemText
174: * @param itemXml
175: */
176: public void setItemText(String itemText, Item itemXml);
177:
178: /**
179: * @param itemXml
180: * @return type as string
181: */
182: public String getItemType(Item itemXml);
183:
184: /**
185: * Set the answer texts for item.
186: * @param itemTextList the text(s) for item
187: */
188: public void setAnswers(ArrayList itemTextList, Item itemXml);
189:
190: /**
191: * Set the feedback texts for item.
192: * @param itemTextList the text(s) for item
193: */
194: public void setFeedback(ArrayList itemTextList, Item itemXml);
195: }
|