org.sakaiproject.tool.assessment.facade
Class ItemFacade

java.lang.Object
  extended by org.sakaiproject.tool.assessment.facade.ItemFacade
All Implemented Interfaces:
Serializable, Comparable, ItemDataIfc
Direct Known Subclasses:
PublishedItemFacade

public class ItemFacade
extends Object
implements Serializable, ItemDataIfc, Comparable

ItemFacade implements ItemDataIfc that encapsulates our out of bound (OOB) agreement.

See Also:
Serialized Form

Field Summary
protected  String createdBy
           
protected  Date createdDate
           
protected  ItemDataIfc data
           
protected  String description
           
protected  Float discount
           
protected  Integer duration
           
protected  String grade
           
protected  Boolean hasRationale
           
protected  String hint
           
protected  org.osid.shared.Id id
           
protected  String instruction
           
protected  org.osid.assessment.Item item
           
protected  String itemAttachmentMetaData
           
protected  Set itemAttachmentSet
           
protected  HashMap itemFeedbackMap
           
protected  Set itemFeedbackSet
           
protected  Long itemId
           
protected  String itemIdString
           
protected  HashMap itemMetaDataMap
           
protected  Set itemMetaDataSet
           
protected  Set itemTextSet
           
protected  org.osid.shared.Type itemType
           
protected  TypeFacade itemTypeFacade
           
protected  String lastModifiedBy
           
protected  Date lastModifiedDate
           
protected  Boolean partialCreditFlag
           
protected  Float score
           
protected  Integer sequence
           
protected  Integer status
           
protected  Integer triesAllowed
           
protected  Long typeId
           
 
Fields inherited from interface org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc
ACTIVE_STATUS, INACTIVE_STATUS
 
Constructor Summary
ItemFacade()
          ItemFacade is the class that is exposed to developer It contains some of the useful methods specified in org.osid.assessment.Item and it implements org.sakaiproject.tool.assessment.ifc.
ItemFacade(ItemDataIfc data)
          This is a very important constructor.
 
Method Summary
 void addItemAttachmentMetaData(String entry)
           
 void addItemFeedback(String feedbackTypeId, String text)
          Add feedback of a specified feedback type (e.g.
 void addItemMetaData(String label, String entry)
          Add a Meta Data to ItemFacade
 void addItemText(String text, Set answerSet)
          Add item text (question text) to ItemFacade (question).
 int compareTo(Object o)
           
 String getAnswerKey()
          This method return the answerKey for a matching question e.g.
 String getCorrectItemFeedback()
          Get Correct Feedback
 String getCreatedBy()
          Get createdBy for ItemFacade.
 Date getCreatedDate()
          Get the creation date of ItemFacade.
 ItemDataIfc getData()
          Get the data for this ItemFacade.
 String getDescription()
           
 Float getDiscount()
          Get Discount for ItemFacade
 Integer getDuration()
           
 String getGeneralItemFeedback()
          Get General Feedback
 String getGrade()
          Get Grade for ItemFacade
 Boolean getHasRationale()
          Check if item (question) require rationale in answer
 String getHint()
          Get Hint for ItemFacade
 String getInCorrectItemFeedback()
          Get Incorrect Feedback
 String getInstruction()
           
 Boolean getIsTrue()
          If this is a true-false question return true if it is true, else false.
 List getItemAttachmentList()
           
 String getItemAttachmentMetaData()
           
 Set getItemAttachmentSet()
           
 String getItemFeedback(String feedbackTypeId)
          Get feedback based on feedback type (e.g.
 HashMap getItemFeedbackMap(Set itemFeedbackSet)
          Get a HashMap (Long feedbackTypeId, ItemFeedback itemFeedback) of item feedback for ItemFacade
 Set getItemFeedbackSet()
          Set the item feedback set for ItemFacade using the "data"
 Long getItemId()
           
 String getItemIdString()
           
 String getItemMetaDataByLabel(String label)
          Get meta data by label
 HashMap getItemMetaDataMap(Set itemMetaDataSet)
          Get item metadata in HashMap (String Label, ItemMetaData itemMetaData) of ItemFacade
 Set getItemMetaDataSet()
           
 ArrayList getItemTextArray()
           
 ArrayList getItemTextArraySorted()
           
 Set getItemTextSet()
          Get item text set (question text set) from ItemFacade.data
 TypeFacade getItemTypeFacade()
           
 String getLastModifiedBy()
          Get the agentId of the person who last modified ItemFacade
 Date getLastModifiedDate()
          Get the date when ItemFacade where last modified By
 Boolean getPartialCreditFlag()
           
 Float getScore()
          Get Score for ItemFacade
 SectionDataIfc getSection()
           
 Integer getSequence()
           
 Integer getStatus()
          Get status of ItemFacade. 1 = active, 0 = inactive
 String getText()
          Utility method.
 String getTextHtmlStripped()
          Utility method.
 String getTextHtmlStrippedAll()
          Utility method.
 Integer getTriesAllowed()
           
 TypeIfc getType()
           
 Long getTypeId()
           
 void removeFeedbackByType(String feedbackTypeId)
          Remove Feedback by feedback typeId (e.g.
 void removeMetaDataByType(String label)
           
 void setCorrectItemFeedback(String text)
          Set Correct Feedback
 void setCreatedBy(String createdBy)
          Set createdBy for ItemFacade.
 void setCreatedDate(Date createdDate)
          Set the creation date of ItemFacade
 void setData(ItemDataIfc data)
          Set data for ItemFacade
 void setDescription(String description)
          Set description for ItemFacade
 void setDiscount(Float discount)
          Set Discount for ItemFacade
 void setDuration(Integer duration)
          Set duration for ItemFacade
 void setGeneralItemFeedback(String text)
          Set General Feedback
 void setGrade(String grade)
          Set Grade for ItemFacade
 void setHasRationale(Boolean hasRationale)
          Set preference if rationale should be collected in answer
 void setHint(String hint)
          Set Hint for ItemFacade
 void setInCorrectItemFeedback(String text)
          Set InCorrect Feedback
 void setInstruction(String instruction)
          Set instruction for ItemFacade e.g.
 void setItemAttachmentSet(Set itemAttachmentSet)
           
 void setItemFeedbackSet(Set itemFeedbackSet)
          Set the item feedback set for ItemFacade and ItemFacade.data
 void setItemId(Long itemId)
          Set itemId for ItemFacade
 void setItemIdString(String itemIdString)
          Set itemId for ItemFacade
 void setItemMetaDataSet(Set itemMetaDataSet)
          Set item metadata set in ItemFacade and ItemFacade.data
 void setItemTextSet(Set itemTextSet)
          Set item text (question text) in ItemFacade.data
 void setLastModifiedBy(String lastModifiedBy)
          set the agentId of the person who last modified itemFacade
 void setLastModifiedDate(Date lastModifiedDate)
          Set the last modified date
 void setPartialCreditFlag(Boolean partialCreditFlag)
           
 void setScore(Float score)
          Set Score for ItemFacade
 void setSection(SectionDataIfc section)
           
 void setSequence(Integer sequence)
           
 void setStatus(Integer status)
          Set status for ItemFacade. 1 = active, 0 = inactive
 void setTriesAllowed(Integer triesAllowed)
          Set duration for ItemFacade
 void setTypeId(Long typeId)
          Set TypeId for ItemType.
 void updateData(ItemDataIfc data)
          Call setDate() to update data in ItemFacade
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

item

protected org.osid.assessment.Item item

id

protected org.osid.shared.Id id

description

protected String description

data

protected ItemDataIfc data

itemType

protected org.osid.shared.Type itemType

itemId

protected Long itemId

itemIdString

protected String itemIdString

sequence

protected Integer sequence

duration

protected Integer duration

triesAllowed

protected Integer triesAllowed

instruction

protected String instruction

typeId

protected Long typeId

grade

protected String grade

score

protected Float score

discount

protected Float discount

hint

protected String hint

partialCreditFlag

protected Boolean partialCreditFlag

hasRationale

protected Boolean hasRationale

status

protected Integer status

createdBy

protected String createdBy

createdDate

protected Date createdDate

lastModifiedBy

protected String lastModifiedBy

lastModifiedDate

protected Date lastModifiedDate

itemTextSet

protected Set itemTextSet

itemMetaDataSet

protected Set itemMetaDataSet

itemFeedbackSet

protected Set itemFeedbackSet

itemMetaDataMap

protected HashMap itemMetaDataMap

itemFeedbackMap

protected HashMap itemFeedbackMap

itemTypeFacade

protected TypeFacade itemTypeFacade

itemAttachmentSet

protected Set itemAttachmentSet

itemAttachmentMetaData

protected String itemAttachmentMetaData
Constructor Detail

ItemFacade

public ItemFacade()
ItemFacade is the class that is exposed to developer It contains some of the useful methods specified in org.osid.assessment.Item and it implements org.sakaiproject.tool.assessment.ifc. When new methods is added to osid api, this code is still workable. If signature in any of the osid methods that we mirrored changes, we only need to modify those particular methods. - daisyf


ItemFacade

public ItemFacade(ItemDataIfc data)
This is a very important constructor. Please make sure that you have set all the properties (declared above as private) of ItemFacade using the "data" supplied. "data" is a org.osid.assessment.Item properties and I use it to store info about an item.

Parameters:
data -
Method Detail

getType

public TypeIfc getType()
Specified by:
getType in interface ItemDataIfc

getItemTypeFacade

public TypeFacade getItemTypeFacade()

getData

public ItemDataIfc getData()
Get the data for this ItemFacade.

Returns:
ItemDataIfc

updateData

public void updateData(ItemDataIfc data)
Call setDate() to update data in ItemFacade

Parameters:
data -

setData

public void setData(ItemDataIfc data)
Set data for ItemFacade

Parameters:
data -

getItemId

public Long getItemId()
               throws DataFacadeException
Specified by:
getItemId in interface ItemDataIfc
Throws:
DataFacadeException

setItemId

public void setItemId(Long itemId)
Set itemId for ItemFacade

Specified by:
setItemId in interface ItemDataIfc
Parameters:
itemId -

getItemIdString

public String getItemIdString()
                       throws DataFacadeException
Specified by:
getItemIdString in interface ItemDataIfc
Throws:
DataFacadeException

setItemIdString

public void setItemIdString(String itemIdString)
Set itemId for ItemFacade

Specified by:
setItemIdString in interface ItemDataIfc
Parameters:
itemId -

getSection

public SectionDataIfc getSection()
                          throws DataFacadeException
Specified by:
getSection in interface ItemDataIfc
Throws:
DataFacadeException

setSection

public void setSection(SectionDataIfc section)
Specified by:
setSection in interface ItemDataIfc

getSequence

public Integer getSequence()
                    throws DataFacadeException
Specified by:
getSequence in interface ItemDataIfc
Throws:
DataFacadeException

setSequence

public void setSequence(Integer sequence)
Specified by:
setSequence in interface ItemDataIfc

getDuration

public Integer getDuration()
                    throws DataFacadeException
Specified by:
getDuration in interface ItemDataIfc
Throws:
DataFacadeException

setDuration

public void setDuration(Integer duration)
Set duration for ItemFacade

Specified by:
setDuration in interface ItemDataIfc
Parameters:
duration -

getInstruction

public String getInstruction()
                      throws DataFacadeException
Specified by:
getInstruction in interface ItemDataIfc
Throws:
DataFacadeException

setInstruction

public void setInstruction(String instruction)
Set instruction for ItemFacade e.g. "Match the following sentences", "In the score between 1-5, specify your preference"

Specified by:
setInstruction in interface ItemDataIfc
Parameters:
instruction -

getDescription

public String getDescription()
                      throws DataFacadeException
Specified by:
getDescription in interface ItemDataIfc
Throws:
DataFacadeException

setDescription

public void setDescription(String description)
Set description for ItemFacade

Specified by:
setDescription in interface ItemDataIfc
Parameters:
description -

getTypeId

public Long getTypeId()
               throws DataFacadeException
Specified by:
getTypeId in interface ItemDataIfc
Throws:
DataFacadeException

setTypeId

public void setTypeId(Long typeId)
Set TypeId for ItemType. This property is used to indicate question type. e.g. 1 = Multiple Choice, 2 = Multiple Correct. Please check out ddl/02_TypeData.sql and table "type".

Specified by:
setTypeId in interface ItemDataIfc
Parameters:
typeId -

getGrade

public String getGrade()
                throws DataFacadeException
Get Grade for ItemFacade

Specified by:
getGrade in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setGrade

public void setGrade(String grade)
Set Grade for ItemFacade

Specified by:
setGrade in interface ItemDataIfc
Parameters:
grade -

getScore

public Float getScore()
               throws DataFacadeException
Get Score for ItemFacade

Specified by:
getScore in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setScore

public void setScore(Float score)
Set Score for ItemFacade

Specified by:
setScore in interface ItemDataIfc
Parameters:
score -

getDiscount

public Float getDiscount()
                  throws DataFacadeException
Get Discount for ItemFacade

Specified by:
getDiscount in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setDiscount

public void setDiscount(Float discount)
Set Discount for ItemFacade

Specified by:
setDiscount in interface ItemDataIfc
Parameters:
discount -

getHint

public String getHint()
               throws DataFacadeException
Get Hint for ItemFacade

Specified by:
getHint in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setHint

public void setHint(String hint)
Set Hint for ItemFacade

Specified by:
setHint in interface ItemDataIfc
Parameters:
hint -

getHasRationale

public Boolean getHasRationale()
                        throws DataFacadeException
Check if item (question) require rationale in answer

Specified by:
getHasRationale in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setHasRationale

public void setHasRationale(Boolean hasRationale)
Set preference if rationale should be collected in answer

Specified by:
setHasRationale in interface ItemDataIfc
Parameters:
hasRationale -

getStatus

public Integer getStatus()
                  throws DataFacadeException
Get status of ItemFacade. 1 = active, 0 = inactive

Specified by:
getStatus in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setStatus

public void setStatus(Integer status)
Set status for ItemFacade. 1 = active, 0 = inactive

Specified by:
setStatus in interface ItemDataIfc
Parameters:
status -

getCreatedBy

public String getCreatedBy()
                    throws DataFacadeException
Get createdBy for ItemFacade. This represents the agentId of the person who created the record

Specified by:
getCreatedBy in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setCreatedBy

public void setCreatedBy(String createdBy)
Set createdBy for ItemFacade. This represents the agentId of the person who created the record

Specified by:
setCreatedBy in interface ItemDataIfc
Parameters:
createdBy -

getCreatedDate

public Date getCreatedDate()
                    throws DataFacadeException
Get the creation date of ItemFacade.

Specified by:
getCreatedDate in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setCreatedDate

public void setCreatedDate(Date createdDate)
Set the creation date of ItemFacade

Specified by:
setCreatedDate in interface ItemDataIfc
Parameters:
createdDate -

getLastModifiedBy

public String getLastModifiedBy()
                         throws DataFacadeException
Get the agentId of the person who last modified ItemFacade

Specified by:
getLastModifiedBy in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setLastModifiedBy

public void setLastModifiedBy(String lastModifiedBy)
set the agentId of the person who last modified itemFacade

Specified by:
setLastModifiedBy in interface ItemDataIfc
Parameters:
lastModifiedBy -

getLastModifiedDate

public Date getLastModifiedDate()
                         throws DataFacadeException
Get the date when ItemFacade where last modified By

Specified by:
getLastModifiedDate in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setLastModifiedDate

public void setLastModifiedDate(Date lastModifiedDate)
Set the last modified date

Specified by:
setLastModifiedDate in interface ItemDataIfc
Parameters:
lastModifiedBy -

getItemTextSet

public Set getItemTextSet()
                   throws DataFacadeException
Get item text set (question text set) from ItemFacade.data

Specified by:
getItemTextSet in interface ItemDataIfc
Returns:
Throws:
DataFacadeException

setItemTextSet

public void setItemTextSet(Set itemTextSet)
Set item text (question text) in ItemFacade.data

Specified by:
setItemTextSet in interface ItemDataIfc
Parameters:
itemTextSet -

getItemMetaDataSet

public Set getItemMetaDataSet()
                       throws DataFacadeException
Specified by:
getItemMetaDataSet in interface ItemDataIfc
Throws:
DataFacadeException

setItemMetaDataSet

public void setItemMetaDataSet(Set itemMetaDataSet)
Set item metadata set in ItemFacade and ItemFacade.data

Specified by:
setItemMetaDataSet in interface ItemDataIfc
Parameters:
itemMetaDataSet -

getItemMetaDataMap

public HashMap getItemMetaDataMap(Set itemMetaDataSet)
Get item metadata in HashMap (String Label, ItemMetaData itemMetaData) of ItemFacade

Specified by:
getItemMetaDataMap in interface ItemDataIfc
Parameters:
itemMetaDataSet -
Returns:

getItemFeedbackSet

public Set getItemFeedbackSet()
Set the item feedback set for ItemFacade using the "data"

Specified by:
getItemFeedbackSet in interface ItemDataIfc
Returns:

setItemFeedbackSet

public void setItemFeedbackSet(Set itemFeedbackSet)
Set the item feedback set for ItemFacade and ItemFacade.data

Specified by:
setItemFeedbackSet in interface ItemDataIfc
Parameters:
itemFeedbackSet -

getItemFeedbackMap

public HashMap getItemFeedbackMap(Set itemFeedbackSet)
Get a HashMap (Long feedbackTypeId, ItemFeedback itemFeedback) of item feedback for ItemFacade

Specified by:
getItemFeedbackMap in interface ItemDataIfc
Parameters:
itemFeedbackSet -
Returns:

addItemText

public void addItemText(String text,
                        Set answerSet)
Add item text (question text) to ItemFacade (question). For multiple choice, multiple correct, survey, matching & fill in the blank, you can specify a set of acceptable answers. Usually, the purpose for this is to facilitate auto-grading.

Specified by:
addItemText in interface ItemDataIfc
Parameters:
text -
answerSet -

getItemMetaDataByLabel

public String getItemMetaDataByLabel(String label)
Get meta data by label

Specified by:
getItemMetaDataByLabel in interface ItemDataIfc
Parameters:
label -
Returns:

addItemMetaData

public void addItemMetaData(String label,
                            String entry)
Add a Meta Data to ItemFacade

Specified by:
addItemMetaData in interface ItemDataIfc
Parameters:
label -
entry -

getGeneralItemFeedback

public String getGeneralItemFeedback()
Get General Feedback

Specified by:
getGeneralItemFeedback in interface ItemDataIfc
Returns:

setGeneralItemFeedback

public void setGeneralItemFeedback(String text)
Set General Feedback

Specified by:
setGeneralItemFeedback in interface ItemDataIfc
Parameters:
text -

getCorrectItemFeedback

public String getCorrectItemFeedback()
Get Correct Feedback

Specified by:
getCorrectItemFeedback in interface ItemDataIfc
Returns:

setCorrectItemFeedback

public void setCorrectItemFeedback(String text)
Set Correct Feedback

Specified by:
setCorrectItemFeedback in interface ItemDataIfc
Parameters:
text -

getInCorrectItemFeedback

public String getInCorrectItemFeedback()
Get Incorrect Feedback

Specified by:
getInCorrectItemFeedback in interface ItemDataIfc
Returns:

setInCorrectItemFeedback

public void setInCorrectItemFeedback(String text)
Set InCorrect Feedback

Specified by:
setInCorrectItemFeedback in interface ItemDataIfc
Parameters:
text -

getItemFeedback

public String getItemFeedback(String feedbackTypeId)
Get feedback based on feedback type (e.g. CORRECT, INCORRECT)

Specified by:
getItemFeedback in interface ItemDataIfc
Parameters:
feedbackTypeId -
Returns:

addItemFeedback

public void addItemFeedback(String feedbackTypeId,
                            String text)
Add feedback of a specified feedback type (e.g. CORRECT, INCORRECT) to ItemFacade

Specified by:
addItemFeedback in interface ItemDataIfc
Parameters:
feedbackTypeId -
text -

removeFeedbackByType

public void removeFeedbackByType(String feedbackTypeId)
Remove Feedback by feedback typeId (e.g. CORRECT, INCORRECT)

Specified by:
removeFeedbackByType in interface ItemDataIfc
Parameters:
feedbackTypeId -

getIsTrue

public Boolean getIsTrue()
                  throws DataFacadeException
If this is a true-false question return true if it is true, else false. If it is not a true-false question return false.

Specified by:
getIsTrue in interface ItemDataIfc
Returns:
true if this is a true true-false question
Throws:
DataFacadeException

getText

public String getText()
               throws DataFacadeException
Utility method. In the case of an ordinary question, this will obtain the a set of text with one element and return it; in FIB or FIN return multiple elements separated by underscores.

Specified by:
getText in interface ItemDataIfc
Returns:
text of question
Throws:
DataFacadeException

getTextHtmlStripped

public String getTextHtmlStripped()
                           throws DataFacadeException
Utility method. Obeys the semantics and rules of the getText() but removes HTML tags.

Returns:
text of question, removes HTML tags.
Throws:
DataFacadeException
See Also:
getText()

getTextHtmlStrippedAll

public String getTextHtmlStrippedAll()
                              throws DataFacadeException
Utility method. Obeys the semantics and rules of the getText() but removes HTML tags. The differency of getTextHtmlStripped() is this API doesn't replace HTMLtags by white space.

Returns:
text of question, removes HTML tags.
Throws:
DataFacadeException
See Also:
getText()

getItemTextArray

public ArrayList getItemTextArray()
Specified by:
getItemTextArray in interface ItemDataIfc

getItemTextArraySorted

public ArrayList getItemTextArraySorted()
Specified by:
getItemTextArraySorted in interface ItemDataIfc

getTriesAllowed

public Integer getTriesAllowed()
                        throws DataFacadeException
Specified by:
getTriesAllowed in interface ItemDataIfc
Throws:
DataFacadeException

setTriesAllowed

public void setTriesAllowed(Integer triesAllowed)
Set duration for ItemFacade

Specified by:
setTriesAllowed in interface ItemDataIfc
Parameters:
duration -

removeMetaDataByType

public void removeMetaDataByType(String label)
Specified by:
removeMetaDataByType in interface ItemDataIfc

getAnswerKey

public String getAnswerKey()
This method return the answerKey for a matching question e.g. A:2, B:3, C:1, D:4 (where A, B & C is the answer label and 1,2 &3 are the itemText sequence

Specified by:
getAnswerKey in interface ItemDataIfc

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getItemAttachmentSet

public Set getItemAttachmentSet()
Specified by:
getItemAttachmentSet in interface ItemDataIfc

setItemAttachmentSet

public void setItemAttachmentSet(Set itemAttachmentSet)
Specified by:
setItemAttachmentSet in interface ItemDataIfc

getItemAttachmentList

public List getItemAttachmentList()
Specified by:
getItemAttachmentList in interface ItemDataIfc

addItemAttachmentMetaData

public void addItemAttachmentMetaData(String entry)

getItemAttachmentMetaData

public String getItemAttachmentMetaData()

setPartialCreditFlag

public void setPartialCreditFlag(Boolean partialCreditFlag)
Specified by:
setPartialCreditFlag in interface ItemDataIfc

getPartialCreditFlag

public Boolean getPartialCreditFlag()
Specified by:
getPartialCreditFlag in interface ItemDataIfc


Copyright © 2005-2012 Sakai Project. All Rights Reserved.