001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/questionpool/QuestionPoolItemData.java $
003: * $Id: QuestionPoolItemData.java 11072 2006-06-22 02:45:41Z daisyf@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.data.dao.questionpool;
021:
022: import java.io.Serializable;
023:
024: import org.sakaiproject.tool.assessment.data.dao.assessment.ItemData;
025: import org.sakaiproject.tool.assessment.data.ifc.questionpool.QuestionPoolItemIfc;
026:
027: /**
028: *
029: * @author $author$
030: * @version $Id: QuestionPoolItemData.java 11072 2006-06-22 02:45:41Z daisyf@stanford.edu $
031: */
032: public class QuestionPoolItemData implements Serializable,
033: QuestionPoolItemIfc, Cloneable {
034: /** Use serialVersionUID for interoperability. */
035: private final static long serialVersionUID = 9180085666292824370L;
036:
037: private Long questionPoolId;
038: private String itemId;
039: private ItemData itemData; //<-- is the item
040:
041: //private QuestionPool questionPool;
042:
043: public QuestionPoolItemData() {
044: }
045:
046: public QuestionPoolItemData(Long questionPoolId, String itemId) {
047: this .questionPoolId = questionPoolId;
048: this .itemId = itemId;
049: }
050:
051: public QuestionPoolItemData(Long questionPoolId, String itemId,
052: ItemData itemData) {
053: this .questionPoolId = questionPoolId;
054: this .itemId = itemId;
055: this .itemData = itemData;
056: }
057:
058: public QuestionPoolItemData(ItemData itemData,
059: QuestionPoolData questionPoolData) {
060: this .itemData = itemData;
061: //this.questionPool = questionPool;
062: //setQuestionPoolId(questionPoolProperties.getId());
063: setItemId(itemData.getItemIdString());
064: setQuestionPoolId(questionPoolData.getQuestionPoolId());
065: }
066:
067: public Long getQuestionPoolId() {
068: return questionPoolId;
069: }
070:
071: public void setQuestionPoolId(Long questionPoolId) {
072: this .questionPoolId = questionPoolId;
073: }
074:
075: public String getItemId() {
076: return itemId;
077: }
078:
079: public void setItemId(String itemId) {
080: this .itemId = itemId;
081: }
082:
083: public boolean equals(Object questionPoolItem) {
084: boolean returnValue = false;
085: if (this == questionPoolItem)
086: returnValue = true;
087: if (questionPoolItem != null
088: && questionPoolItem.getClass() == this .getClass()) {
089: QuestionPoolItemData qpi = (QuestionPoolItemData) questionPoolItem;
090: if ((this .getItemId()).equals(qpi.getItemId())
091: && (this .getQuestionPoolId()).equals(qpi
092: .getQuestionPoolId()))
093: returnValue = true;
094: }
095: return returnValue;
096: }
097:
098: public int hashCode() {
099: String s = this .itemId + ":" + (this .questionPoolId).toString();
100: return (s.hashCode());
101: }
102:
103: public Object clone() {
104: return new QuestionPoolItemData(questionPoolId, itemId);
105: }
106:
107: }
|