001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/osid/questionpool/impl/QuestionPoolImpl.java $
003: * $Id: QuestionPoolImpl.java 9276 2006-05-10 23:04:20Z daisyf@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.osid.questionpool.impl;
021:
022: import java.io.Serializable;
023:
024: import org.osid.shared.Id;
025: import org.osid.shared.Type;
026: import org.sakaiproject.tool.assessment.business.questionpool.QuestionPool;
027: import org.sakaiproject.tool.assessment.business.questionpool.QuestionPoolException;
028:
029: /**
030: * This class implements common methods for accessing a question pool.
031: * A question pool is defined as a centralized repository where questions
032: * are stored. They allow one to use the same question on multiple
033: * tests without duplicating data, and provide an assessment-independent
034: * way to store questions.
035: *
036: * @author Ed Smiley <esmiley@stanford.edu>
037: */
038: public class QuestionPoolImpl implements QuestionPool {
039: private String displayName;
040: private String description;
041: private Id id;
042: private Type questionPoolType;
043: private Serializable data;
044: private Id parentId;
045: private QuestionPool parentPool;
046:
047: /**
048: * Creates a new QuestionPoolImpl object.
049: */
050: public QuestionPoolImpl() {
051: // This can hold data until we create an actual object for it.
052: }
053:
054: /**
055: * Constructor.
056: * Each question pool has a unique Id object and owns the Id of
057: * its parent. See getId(), getParentId()
058: *
059: * @param newId the id
060: * @param newParentId the id of its parent
061: */
062: public QuestionPoolImpl(Id newId, Id newParentId) {
063: id = newId;
064: parentId = newParentId;
065: }
066:
067: /**
068: *
069: * @param pdisplayName the display name for the question pool
070: * @throws QuestionPoolException
071: */
072: public void updateDisplayName(String pdisplayName)
073: throws QuestionPoolException {
074: setDisplayName(displayName);
075: }
076:
077: public void setDisplayName(String pdisplayName)
078: throws QuestionPoolException {
079: displayName = pdisplayName;
080: }
081:
082: /**
083: *
084: * @param pdescription the description for the question pool
085: * @throws QuestionPoolException
086: */
087: public void updateDescription(String pdescription)
088: throws QuestionPoolException {
089: description = pdescription;
090: }
091:
092: /**
093: *
094: * @param pdata the extra data member for the question pool
095: * @throws QuestionPoolException
096: */
097: public void updateData(Serializable pdata)
098: throws QuestionPoolException {
099: data = pdata;
100: }
101:
102: /**
103: *
104: * @return the display name for the question pool
105: * @throws QuestionPoolException
106: */
107: public String getDisplayName() throws QuestionPoolException {
108: return displayName;
109: }
110:
111: /**
112: *
113: * @return the description for the question pool
114: * @throws QuestionPoolException
115: */
116: public String getDescription() throws QuestionPoolException {
117: return description;
118: }
119:
120: /**
121: * DOCUMENTATION PENDING
122: *
123: * @return DOCUMENTATION PENDING
124: *
125: * @throws QuestionPoolException DOCUMENTATION PENDING
126: */
127: public Id getId() throws QuestionPoolException {
128: return id;
129: }
130:
131: /**
132: *
133: * @return the type of pool for the question pool
134: * @throws QuestionPoolException
135: */
136: public Type getQuestionPoolType() throws QuestionPoolException {
137: return questionPoolType;
138: }
139:
140: // daisyf added this method on 8/20/04 to allow QuestionPoolQueries to function, line 115
141: public void updateQuestionPoolType(Type questionPoolType)
142: throws QuestionPoolException {
143: this .questionPoolType = questionPoolType;
144: }
145:
146: /**
147: *
148: * @return the extra data for the question pool
149: * @throws QuestionPoolException
150: */
151: public Serializable getData() throws QuestionPoolException {
152: return data;
153: }
154:
155: /**
156: *
157: * @return the id object for the question pool
158: * @throws QuestionPoolException
159: */
160: public Id getParentId() throws QuestionPoolException {
161: return parentId;
162: }
163:
164: /**
165: *
166: * Sets the parent id object for the question pool
167: * @throws QuestionPoolException
168: */
169: public void setParentId(Id parentId) throws QuestionPoolException {
170: this .parentId = parentId;
171: }
172:
173: /**
174: *
175: * @return the parent pool for the question pool
176: * @throws QuestionPoolException
177: */
178: public QuestionPool getParentPool() throws QuestionPoolException {
179: return parentPool;
180: }
181:
182: }
|