001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/questionpool/QuestionPoolDataBean.java $
003: * $Id: QuestionPoolDataBean.java 12886 2006-07-25 21:43:16Z ktsao@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.ui.bean.questionpool;
021:
022: //import org.sakaiproject.tool.assessment.business.entity.questionpool.*;
023:
024: import java.io.Serializable;
025: import java.util.ArrayList;
026: import java.util.Date;
027: import java.util.HashMap;
028: import java.util.Iterator;
029: import java.util.Map;
030:
031: import org.apache.commons.logging.Log;
032: import org.apache.commons.logging.LogFactory;
033: import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade;
034:
035: /**
036: * This holds question pool information.
037: *
038: * Used to be org.navigoproject.ui.web.form.questionpool.QuestionPoolBean
039: *
040: * @author Rachel Gollub <rgollub@stanford.edu>
041: */
042: public class QuestionPoolDataBean implements Serializable {
043:
044: /** Use serialVersionUID for interoperability. */
045: private final static long serialVersionUID = 418920360211039758L;
046: private Long id;
047: private Long parentPoolId;
048: private String numberOfSubpools;
049: private String numberOfQuestions;
050: private boolean showSubpools;
051: private boolean showQuestions;
052: private boolean showParentPools;
053:
054: private String displayName;
055: private String owner;
056: private String organizationName;
057: private String description;
058: private String objectives;
059: private String keywords;
060: private Date lastModified;
061: private Date dateCreated;
062:
063: private static Log log = LogFactory
064: .getLog(QuestionPoolDataBean.class);
065:
066: private Map parentPools = new HashMap();
067: private ArrayList parentPoolsArray = new ArrayList();
068:
069: /**
070: * DOCUMENTATION PENDING
071: *
072: * @return DOCUMENTATION PENDING
073: */
074: public Date getLastModified() {
075: return lastModified;
076: }
077:
078: /**
079: * DOCUMENTATION PENDING
080: *
081: * @param newName DOCUMENTATION PENDING
082: */
083: public void setLastModified(Date param) {
084: lastModified = param;
085: }
086:
087: /**
088: * DOCUMENTATION PENDING
089: *
090: * @return DOCUMENTATION PENDING
091: */
092: public Date getDateCreated() {
093: return dateCreated;
094: }
095:
096: /**
097: * DOCUMENTATION PENDING
098: *
099: * @param newName DOCUMENTATION PENDING
100: */
101: public void setDateCreated(Date param) {
102: dateCreated = param;
103: }
104:
105: /**
106: * DOCUMENTATION PENDING
107: *
108: * @return DOCUMENTATION PENDING
109: */
110: public String getDisplayName() {
111: return displayName;
112: }
113:
114: /**
115: * DOCUMENTATION PENDING
116: *
117: * @param newName DOCUMENTATION PENDING
118: */
119: public void setDisplayName(String newName) {
120: displayName = newName;
121: }
122:
123: /**
124: * DOCUMENTATION PENDING
125: *
126: * @return DOCUMENTATION PENDING
127: */
128: public String getOwner() {
129: return owner;
130: }
131:
132: /**
133: * DOCUMENTATION PENDING
134: *
135: * @param newName DOCUMENTATION PENDING
136: */
137: public void setOwner(String param) {
138: owner = param;
139: }
140:
141: /**
142: * DOCUMENTATION PENDING
143: *
144: * @return DOCUMENTATION PENDING
145: */
146: public String getDescription() {
147: return description;
148: }
149:
150: /**
151: * DOCUMENTATION PENDING
152: *
153: * @param newDesc DOCUMENTATION PENDING
154: */
155: public void setDescription(String newDesc) {
156: description = newDesc;
157: }
158:
159: /**
160: * DOCUMENTATION PENDING
161: *
162: * @return DOCUMENTATION PENDING
163: */
164: public String getOrganizationName() {
165: return organizationName;
166: }
167:
168: /**
169: * DOCUMENTATION PENDING
170: *
171: * @param newDesc DOCUMENTATION PENDING
172: */
173: public void setOrganizationName(String param) {
174: organizationName = param;
175: }
176:
177: /**
178: * DOCUMENTATION PENDING
179: *
180: * @return DOCUMENTATION PENDING
181: */
182: public String getKeywords() {
183: return keywords;
184: }
185:
186: /**
187: * DOCUMENTATION PENDING
188: *
189: * @param newDesc DOCUMENTATION PENDING
190: */
191: public void setKeywords(String param) {
192: keywords = param;
193: }
194:
195: /**
196: * DOCUMENTATION PENDING
197: *
198: * @return DOCUMENTATION PENDING
199: */
200: public String getObjectives() {
201: return objectives;
202: }
203:
204: /**
205: * DOCUMENTATION PENDING
206: *
207: * @param newDesc DOCUMENTATION PENDING
208: */
209: public void setObjectives(String param) {
210: objectives = param;
211: }
212:
213: /**
214: * DOCUMENTATION PENDING
215: *
216: * @return DOCUMENTATION PENDING
217: */
218: public Long getParentPoolId() {
219: return parentPoolId;
220: }
221:
222: /**
223: * DOCUMENTATION PENDING
224: *
225: * @param newId DOCUMENTATION PENDING
226: */
227: public void setParentPoolId(Long newId) {
228: parentPoolId = newId;
229: }
230:
231: /**
232: * DOCUMENTATION PENDING
233: *
234: * @return DOCUMENTATION PENDING
235: */
236: public Long getId() {
237: return id;
238: }
239:
240: /**
241: * DOCUMENTATION PENDING
242: *
243: * @param newId DOCUMENTATION PENDING
244: */
245: public void setId(Long newId) {
246: id = newId;
247: }
248:
249: /**
250: * DOCUMENTATION PENDING
251: *
252: * @return DOCUMENTATION PENDING
253: */
254:
255: public String getNumberOfQuestions() {
256: return numberOfQuestions;
257: }
258:
259: /**
260: * DOCUMENTATION PENDING
261: *
262: * @param newNumber DOCUMENTATION PENDING
263: */
264: public void setNumberOfQuestions(String newNumber) {
265: numberOfQuestions = newNumber;
266: }
267:
268: /**
269: * DOCUMENTATION PENDING
270: *
271: * @return DOCUMENTATION PENDING
272: */
273: public String getNumberOfSubpools() {
274: return numberOfSubpools;
275: }
276:
277: /**
278: * DOCUMENTATION PENDING
279: *
280: * @param newNumber DOCUMENTATION PENDING
281: */
282: public void setNumberOfSubpools(String newNumber) {
283: numberOfSubpools = newNumber;
284: }
285:
286: /*
287: public boolean getShowQuestions()
288: {
289: if ( (new Integer(numberOfQuestions)).intValue() >0)
290: {
291: return true;
292: }
293: return false;
294:
295: }
296:
297: public boolean getShowSubpools()
298: {
299: if ( (new Integer(numberOfSubpools)).intValue() >0)
300: {
301: return true;
302: }
303: return false;
304:
305: }
306: */
307:
308: public boolean getShowParentPools() {
309: if (parentPools.isEmpty()) {
310: return false;
311: }
312: return true;
313:
314: }
315:
316: /**
317: * DOCUMENTATION PENDING
318: *
319: * @return DOCUMENTATION PENDING
320: */
321: public Map getParentPools() {
322: return parentPools;
323: }
324:
325: public void setParentPools(ArrayList newpools) {
326: parentPools = new HashMap();
327: Iterator iter = newpools.iterator();
328: while (iter.hasNext()) {
329: QuestionPoolFacade qpool = (QuestionPoolFacade) iter.next();
330: parentPools.put(qpool.getDisplayName(),
331: "jsf/questionpool/editPool.faces?qpid="
332: + qpool.getQuestionPoolId());
333: }
334:
335: }
336:
337: public ArrayList getParentPoolsArray() {
338: return parentPoolsArray;
339: }
340:
341: public void setParentPoolsArray(ArrayList newpools) {
342: parentPoolsArray = newpools;
343: }
344:
345: /**
346: * This checks to see if the question titles are unique. If they're
347: * all the same, or null, the titles aren't displayed.
348: */
349: /*
350: // not used
351: public boolean getShowTitles()
352: {
353: String title = null;
354:
355: if(properties.getQuestions() == null)
356: {
357: return true;
358: }
359:
360: Iterator iter = properties.getQuestions().iterator();
361: try
362: {
363: while(iter.hasNext())
364: {
365: Item item = (Item) iter.next();
366:
367: // If we've found at least two different titles, show titles
368: if(
369: (item.getDisplayName() != null) && (title != null) &&
370: ! item.getDisplayName().equals(title))
371: {
372: return true;
373: }
374:
375: if((title == null) && (item.getDisplayName() != null))
376: {
377: title = item.getDisplayName();
378: }
379: }
380: }
381: catch(Exception e)
382: {
383: throw new Error(e);
384: }
385:
386: return true;
387: }
388: */
389:
390: }
|