Source Code Cross Referenced for PublishedAssessmentFacade.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » facade » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.tool.assessment.facade 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/facade/PublishedAssessmentFacade.java $
003:         * $Id: PublishedAssessmentFacade.java 9273 2006-05-10 22:34:28Z 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.facade;
021:
022:        import java.util.ArrayList;
023:        import java.util.Collections;
024:        import java.util.Date;
025:        import java.util.HashMap;
026:        import java.util.Iterator;
027:        import java.util.List;
028:        import java.util.Set;
029:
030:        import org.apache.commons.logging.Log;
031:        import org.apache.commons.logging.LogFactory;
032:        import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData;
033:        import org.sakaiproject.tool.assessment.data.dao.assessment.PublishedMetaData;
034:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
035:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc;
036:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
037:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAttachmentIfc;
038:        import org.sakaiproject.tool.assessment.data.ifc.assessment.EvaluationModelIfc;
039:        import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc;
040:        import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc;
041:        import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc;
042:        import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc;
043:        import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService;
044:
045:        public class PublishedAssessmentFacade implements  java.io.Serializable,
046:                PublishedAssessmentIfc, Cloneable {
047:            private static final long serialVersionUID = 7526471155622776147L;
048:            private static Log log = LogFactory
049:                    .getLog(PublishedAssessmentFacade.class);
050:            public static final Integer ACTIVE_STATUS = new Integer(1);
051:            public static final Integer INACTIVE_STATUS = new Integer(0);
052:            public static final Integer ANY_STATUS = new Integer(2);
053:            private PublishedAssessmentIfc data;
054:            private AssessmentFacade assessment;
055:            private Long publishedAssessmentId;
056:            private Long assessmentId;
057:            private Boolean isTemplate = Boolean.FALSE;
058:            private Long parentId;
059:            private String title;
060:            private String description;
061:            private String comments;
062:            private Long typeId;
063:            private Integer instructorNotification;
064:            private Integer testeeNotification;
065:            private Integer multipartAllowed;
066:            private Integer status;
067:            private String createdBy;
068:            private Date createdDate;
069:            private String lastModifiedBy;
070:            private Date lastModifiedDate;
071:            private AssessmentAccessControlIfc publishedAccessControl;
072:            private EvaluationModelIfc publishedEvaluationModel;
073:            private AssessmentFeedbackIfc publishedFeedback;
074:            private Set publishedMetaDataSet;
075:            private HashMap publishedMetaDataMap = new HashMap();
076:            private Set publishedSectionSet;
077:            private Set publishedSecuredIPAddressSet;
078:            // the following properties is added for the "Convenient Constructor"
079:            private String releaseTo;
080:            private Date startDate;
081:            private Date dueDate;
082:            private Date retractDate;
083:            private int submissionSize;
084:            private Integer lateHandling;
085:            private Boolean unlimitedSubmissions;
086:            private Integer submissionsAllowed;
087:            private Integer feedbackDelivery;
088:            private Integer feedbackAuthoring;
089:            private Date feedbackDate;
090:            private String ownerSiteName;
091:            private Set publishedAssessmentAttachmentSet;
092:
093:            public PublishedAssessmentFacade() {
094:            }
095:
096:            // constructor that whole min. info, used for listing
097:            public PublishedAssessmentFacade(Long id, String title,
098:                    String releaseTo, Date startDate, Date dueDate) {
099:                this .publishedAssessmentId = id;
100:                this .title = title;
101:                this .releaseTo = releaseTo;
102:                this .startDate = startDate;
103:                this .dueDate = dueDate;
104:            }
105:
106:            // constructor that whole min. info, used for listing
107:            public PublishedAssessmentFacade(Long id, String title,
108:                    String releaseTo, Date startDate, Date dueDate,
109:                    Date retractDate, Date feedbackDate,
110:                    Integer feedbackDelivery, Integer feedbackAuthoring,
111:                    Integer lateHandling, Boolean unlimitedSubmissions,
112:                    Integer submissionsAllowed) {
113:                this .publishedAssessmentId = id;
114:                this .title = title;
115:                this .releaseTo = releaseTo;
116:                this .startDate = startDate;
117:                this .dueDate = dueDate;
118:                this .retractDate = retractDate;
119:                this .feedbackDelivery = feedbackDelivery; //=publishedFeedback.feedbackDelivery
120:                this .feedbackAuthoring = feedbackAuthoring; //=publishedFeedback.feedbackAuthoring
121:                this .feedbackDate = feedbackDate;
122:                this .lateHandling = lateHandling;
123:                if (unlimitedSubmissions != null)
124:                    this .unlimitedSubmissions = unlimitedSubmissions;
125:                else
126:                    this .unlimitedSubmissions = Boolean.TRUE;
127:                if (submissionsAllowed == null)
128:                    this .submissionsAllowed = new Integer(0);
129:                else
130:                    this .submissionsAllowed = submissionsAllowed;
131:            }
132:
133:            public PublishedAssessmentFacade(Long id, String title,
134:                    AssessmentAccessControlIfc publishedAccessControl) {
135:                this .publishedAssessmentId = id;
136:                this .title = title;
137:                this .publishedAccessControl = publishedAccessControl;
138:            }
139:
140:            public PublishedAssessmentFacade(PublishedAssessmentIfc data,
141:                    Boolean loadSection) {
142:                setProperties(data);
143:                if (loadSection.equals(Boolean.TRUE))
144:                    this .publishedSectionSet = data.getSectionSet();
145:            }
146:
147:            public PublishedAssessmentFacade(PublishedAssessmentIfc data) {
148:                setProperties(data);
149:                this .publishedSectionSet = data.getSectionSet();
150:            }
151:
152:            private void setProperties(PublishedAssessmentIfc data) {
153:                this .data = data;
154:                this .publishedAssessmentId = data.getPublishedAssessmentId();
155:                this .assessmentId = data.getAssessmentId();
156:                this .title = data.getTitle();
157:                this .description = data.getDescription();
158:                this .comments = data.getComments();
159:                this .publishedMetaDataSet = data.getAssessmentMetaDataSet();
160:                this .instructorNotification = data.getInstructorNotification();
161:                this .testeeNotification = data.getTesteeNotification();
162:                this .multipartAllowed = data.getMultipartAllowed();
163:                this .status = data.getStatus();
164:                this .createdBy = data.getCreatedBy();
165:                this .createdDate = data.getCreatedDate();
166:                this .lastModifiedBy = data.getLastModifiedBy();
167:                this .lastModifiedDate = data.getLastModifiedDate();
168:                this .publishedAccessControl = data.getAssessmentAccessControl();
169:                this .publishedFeedback = data.getAssessmentFeedback();
170:                this .publishedEvaluationModel = data.getEvaluationModel();
171:                this .publishedMetaDataMap = data
172:                        .getAssessmentMetaDataMap(this .publishedMetaDataSet);
173:                this .publishedSecuredIPAddressSet = data
174:                        .getSecuredIPAddressSet();
175:                this .publishedAssessmentAttachmentSet = data
176:                        .getAssessmentAttachmentSet();
177:            }
178:
179:            public Long getPublishedAssessmentId() {
180:                return publishedAssessmentId;
181:            }
182:
183:            public void setPublishedAssessmentId(Long publishedAssessmentId) {
184:                this .publishedAssessmentId = publishedAssessmentId;
185:                this .data.setAssessmentBaseId(publishedAssessmentId);
186:            }
187:
188:            // assessment returns is AssessmentFacade
189:            public AssessmentIfc getAssessment() {
190:                return assessment;
191:            }
192:
193:            // assessment here is AssessmentFacade not AssessmentData
194:            public void setAssessment(AssessmentIfc assessment) {
195:                this .assessment = (AssessmentFacade) assessment;
196:                AssessmentData d = (AssessmentData) this .assessment.getData();
197:                this .data.setAssessmentId(d.getAssessmentBaseId());
198:                //this.data.setAssessment(d);
199:            }
200:
201:            // override the following method from AssessmentData
202:            public Long getAssessmentId() {
203:                return assessmentId;
204:            }
205:
206:            public void setAssessmentId(Long assessmentId) {
207:                setAssessmentBaseId(assessmentId);
208:            }
209:
210:            public Long getAssessmentBaseId() {
211:                return assessmentId;
212:            }
213:
214:            public void setAssessmentBaseId(Long id) {
215:                this .assessmentId = id;
216:                this .data.setAssessmentBaseId(id);
217:            }
218:
219:            // don't have isTemplate
220:            public Boolean getIsTemplate() {
221:                return isTemplate;
222:            }
223:
224:            public void setIsTemplate(Boolean isTemplate) {
225:            }
226:
227:            // published assessment don't have parent
228:            public Long getParentId() {
229:                return null;
230:            }
231:
232:            public void setParentId(Long parentId) {
233:            }
234:
235:            // published assessment don't have a template
236:            public Long getAssessmentTemplateId() {
237:                return null;
238:            }
239:
240:            public void setAssessmentTemplateId(Long assessmentTemplateId) {
241:            }
242:
243:            public String getTitle() {
244:                return title;
245:            }
246:
247:            public void setTitle(String title) {
248:                this .title = title;
249:                this .data.setTitle(title);
250:            }
251:
252:            public String getDescription() {
253:                return description;
254:            }
255:
256:            public void setDescription(String description) {
257:                this .description = description;
258:                this .data.setDescription(description);
259:            }
260:
261:            public String getComments() {
262:                return comments;
263:            }
264:
265:            public void setComments(String comments) {
266:                this .comments = comments;
267:                this .data.setComments(comments);
268:            }
269:
270:            public Integer getInstructorNotification() {
271:                return instructorNotification;
272:            }
273:
274:            public void setInstructorNotification(Integer instructorNotification) {
275:                this .instructorNotification = instructorNotification;
276:                this .data.setInstructorNotification(instructorNotification);
277:            }
278:
279:            public Integer getTesteeNotification() {
280:                return testeeNotification;
281:            }
282:
283:            public void setTesteeNotification(Integer testeeNotification) {
284:                this .testeeNotification = testeeNotification;
285:                this .data.setTesteeNotification(testeeNotification);
286:            }
287:
288:            public Integer getMultipartAllowed() {
289:                return multipartAllowed;
290:            }
291:
292:            public void setMultipartAllowed(Integer multipartAllowed) {
293:                this .multipartAllowed = multipartAllowed;
294:                this .data.setMultipartAllowed(multipartAllowed);
295:            }
296:
297:            public Long getTypeId() {
298:                return typeId;
299:            }
300:
301:            public void setTypeId(Long typeId) {
302:                this .typeId = typeId;
303:                this .data.setTypeId(typeId);
304:            }
305:
306:            public Integer getStatus() {
307:                return status;
308:            }
309:
310:            public void setStatus(Integer status) {
311:                this .status = status;
312:                this .data.setStatus(status);
313:            }
314:
315:            public String getCreatedBy() {
316:                return createdBy;
317:            }
318:
319:            public void setCreatedBy(String createdBy) {
320:                this .createdBy = createdBy;
321:                this .data.setCreatedBy(createdBy);
322:            }
323:
324:            public Date getCreatedDate() {
325:                return createdDate;
326:            }
327:
328:            public void setCreatedDate(Date createdDate) {
329:                this .createdDate = createdDate;
330:                this .data.setCreatedDate(createdDate);
331:            }
332:
333:            public String getLastModifiedBy() {
334:                return lastModifiedBy;
335:            }
336:
337:            public void setLastModifiedBy(String lastModifiedBy) {
338:                this .lastModifiedBy = lastModifiedBy;
339:                this .data.setLastModifiedBy(lastModifiedBy);
340:            }
341:
342:            public Date getLastModifiedDate() {
343:                return lastModifiedDate;
344:            }
345:
346:            public void setLastModifiedDate(Date lastModifiedDate) {
347:                this .lastModifiedDate = lastModifiedDate;
348:                this .data.setLastModifiedDate(lastModifiedDate);
349:            }
350:
351:            public AssessmentAccessControlIfc getAssessmentAccessControl() {
352:                return publishedAccessControl;
353:            }
354:
355:            public void setAssessmentAccessControl(
356:                    AssessmentAccessControlIfc publishedAccessControl) {
357:                this .publishedAccessControl = publishedAccessControl;
358:                this .data.setAssessmentAccessControl(publishedAccessControl);
359:            }
360:
361:            public EvaluationModelIfc getEvaluationModel() {
362:                return publishedEvaluationModel;
363:            }
364:
365:            public void setEvaluationModel(
366:                    EvaluationModelIfc publishedEvaluationModel) {
367:                this .publishedEvaluationModel = publishedEvaluationModel;
368:                this .data.setEvaluationModel(publishedEvaluationModel);
369:            }
370:
371:            public AssessmentFeedbackIfc getAssessmentFeedback() {
372:                return publishedFeedback;
373:            }
374:
375:            public void setAssessmentFeedback(
376:                    AssessmentFeedbackIfc assessmentFeedback) {
377:                this .publishedFeedback = assessmentFeedback;
378:            }
379:
380:            public Set getAssessmentMetaDataSet() {
381:                return publishedMetaDataSet;
382:            }
383:
384:            public void setAssessmentMetaDataSet(Set publishedMetaDataSet) {
385:                this .publishedMetaDataSet = publishedMetaDataSet;
386:                this .data.setAssessmentMetaDataSet(publishedMetaDataSet);
387:            }
388:
389:            public HashMap getAssessmentMetaDataMap(Set publishedMetaDataSet) {
390:                HashMap publishedMetaDataMap = new HashMap();
391:                if (publishedMetaDataSet != null) {
392:                    for (Iterator i = publishedMetaDataSet.iterator(); i
393:                            .hasNext();) {
394:                        PublishedMetaData publishedMetaData = (PublishedMetaData) i
395:                                .next();
396:                        publishedMetaDataMap.put(publishedMetaData.getLabel(),
397:                                publishedMetaData.getEntry());
398:                    }
399:                }
400:                return publishedMetaDataMap;
401:            }
402:
403:            public HashMap getAssessmentMetaDataMap() {
404:                HashMap publishedMetaDataMap = new HashMap();
405:                if (this .publishedMetaDataSet != null) {
406:                    for (Iterator i = this .publishedMetaDataSet.iterator(); i
407:                            .hasNext();) {
408:                        PublishedMetaData publishedMetaData = (PublishedMetaData) i
409:                                .next();
410:                        publishedMetaDataMap.put(publishedMetaData.getLabel(),
411:                                publishedMetaData.getEntry());
412:                    }
413:                }
414:                return publishedMetaDataMap;
415:            }
416:
417:            public String getAssessmentMetaDataByLabel(String label) {
418:                return (String) publishedMetaDataMap.get(label);
419:            }
420:
421:            public void addAssessmentMetaData(String label, String entry) {
422:                if (this .publishedMetaDataMap.get(label) != null) {
423:                    // just update
424:                    Iterator iter = this .publishedMetaDataSet.iterator();
425:                    while (iter.hasNext()) {
426:                        PublishedMetaData metadata = (PublishedMetaData) iter
427:                                .next();
428:                        if (metadata.getLabel().equals(label))
429:                            metadata.setEntry(entry);
430:                    }
431:                } else { // add
432:                    PublishedMetaData metadata = null;
433:                    if (!("").equals(entry.trim())) {
434:                        metadata = new PublishedMetaData(this .data, label,
435:                                entry);
436:                        this .publishedMetaDataSet.add(metadata);
437:                    }
438:                    setAssessmentMetaDataSet(this .publishedMetaDataSet);
439:                }
440:            }
441:
442:            public void updateAssessmentMetaData(String label, String entry) {
443:                addAssessmentMetaData(label, entry);
444:            }
445:
446:            /** not tested this method -daisy 11/16/04
447:             public void removeAssessmentMetaDataByLabel(String label) {
448:             HashSet set = new HashSet();
449:             Iterator iter = this.publishedMetaDataSet.iterator();
450:             while (iter.hasNext()){
451:             PublishedMetaData metadata = (PublishedMetaData) iter.next();
452:             if (!metadata.getLabel().equals(label))
453:             set.add(metadata);
454:             }
455:             setAssessmentMetaDataSet(set);
456:             }
457:             */
458:            public Set getSectionSet() {
459:                return publishedSectionSet;
460:            }
461:
462:            public void setSectionSet(Set sectionSet) {
463:                this .publishedSectionSet = sectionSet;
464:                this .data.setSectionSet(sectionSet);
465:            }
466:
467:            public Set getSecuredIPAddressSet() {
468:                return publishedSecuredIPAddressSet;
469:            }
470:
471:            public void setSecuredIPAddressSet(Set publishedSecuredIPAddressSet) {
472:                this .publishedSecuredIPAddressSet = publishedSecuredIPAddressSet;
473:                this .data.setSecuredIPAddressSet(publishedSecuredIPAddressSet);
474:            }
475:
476:            public PublishedAssessmentIfc getData() {
477:                return data;
478:            }
479:
480:            public TypeIfc getType() {
481:                return null;
482:            }
483:
484:            public ArrayList getSectionArray() {
485:                ArrayList list = new ArrayList();
486:                Iterator iter = publishedSectionSet.iterator();
487:                while (iter.hasNext()) {
488:                    list.add(iter.next());
489:                }
490:                return list;
491:            }
492:
493:            public ArrayList getSectionArraySorted() {
494:                ArrayList list = getSectionArray();
495:                Collections.sort(list);
496:                return list;
497:            }
498:
499:            public String getReleaseTo() {
500:                return this .releaseTo;
501:            }
502:
503:            public Date getStartDate() {
504:                return this .startDate;
505:            }
506:
507:            public Date getDueDate() {
508:                return this .dueDate;
509:            }
510:
511:            public int getSubmissionSize() {
512:                return this .submissionSize;
513:            }
514:
515:            public void setSubmissionSize(int size) {
516:                this .submissionSize = size;
517:            }
518:
519:            public SectionDataIfc getSection(Long sequence) {
520:                ArrayList list = getSectionArraySorted();
521:                if (list == null)
522:                    return null;
523:                else
524:                    return (SectionDataIfc) list.get(sequence.intValue() - 1);
525:            }
526:
527:            public SectionDataIfc getDefaultSection() {
528:                ArrayList list = getSectionArraySorted();
529:                if (list == null)
530:                    return null;
531:                else
532:                    return (SectionDataIfc) list.get(0);
533:            }
534:
535:            public Integer getLateHandling() {
536:                return lateHandling;
537:            }
538:
539:            public Boolean getUnlimitedSubmissions() {
540:                return this .unlimitedSubmissions;
541:            }
542:
543:            public Integer getSubmissionsAllowed() {
544:                return submissionsAllowed;
545:            }
546:
547:            public Date getRetractDate() {
548:                return this .retractDate;
549:            }
550:
551:            public Integer getFeedbackDelivery() {
552:                return feedbackDelivery;
553:            }
554:
555:            public Integer getFeedbackAuthoring() {
556:                return feedbackAuthoring;
557:            }
558:
559:            public Date getFeedbackDate() {
560:                return this .feedbackDate;
561:            }
562:
563:            public void setOwnerSite(String ownerSiteName) {
564:                this .ownerSiteName = ownerSiteName;
565:            }
566:
567:            public String getOwnerSite() {
568:                PublishedAssessmentService service = new PublishedAssessmentService();
569:                String ownerSiteId = service
570:                        .getPublishedAssessmentOwner(this .publishedAssessmentId);
571:                log.debug("**** ownerSiteId=" + ownerSiteId);
572:                this .ownerSiteName = AgentFacade.getSiteName(ownerSiteId);
573:                return this .ownerSiteName;
574:            }
575:
576:            public String getOwnerSiteId() {
577:                PublishedAssessmentService service = new PublishedAssessmentService();
578:                return service
579:                        .getPublishedAssessmentOwner(this .publishedAssessmentId);
580:            }
581:
582:            public Float getTotalScore() {
583:                float total = 0;
584:                Iterator iter = this .publishedSectionSet.iterator();
585:                while (iter.hasNext()) {
586:                    SectionDataIfc s = (SectionDataIfc) iter.next();
587:                    ArrayList list = s.getItemArray();
588:                    Iterator iter2 = null;
589:                    if ((s
590:                            .getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE) != null)
591:                            && (s
592:                                    .getSectionMetaDataByLabel(SectionDataIfc.AUTHOR_TYPE)
593:                                    .equals(SectionDataIfc.RANDOM_DRAW_FROM_QUESTIONPOOL
594:                                            .toString()))) {
595:                        ArrayList randomsample = new ArrayList();
596:                        Integer numberToBeDrawn = null;
597:                        if (s
598:                                .getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN) != null) {
599:                            numberToBeDrawn = new Integer(
600:                                    s
601:                                            .getSectionMetaDataByLabel(SectionDataIfc.NUM_QUESTIONS_DRAWN));
602:                        }
603:
604:                        int samplesize = numberToBeDrawn.intValue();
605:                        for (int i = 0; i < samplesize; i++) {
606:                            randomsample.add(list.get(i));
607:                        }
608:                        iter2 = randomsample.iterator();
609:                    } else {
610:                        iter2 = list.iterator();
611:                    }
612:
613:                    while (iter2.hasNext()) {
614:                        ItemDataIfc item = (ItemDataIfc) iter2.next();
615:                        total = total + item.getScore().floatValue();
616:                    }
617:                }
618:                return new Float(total);
619:            }
620:
621:            public PublishedAssessmentFacade clonePublishedAssessment() {
622:                try {
623:                    return (PublishedAssessmentFacade) this .clone();
624:                } catch (CloneNotSupportedException e) {
625:                    log.warn(e.getMessage());
626:                    return null;
627:                }
628:            }
629:
630:            public Set getAssessmentAttachmentSet() throws DataFacadeException {
631:                return publishedAssessmentAttachmentSet;
632:            }
633:
634:            public void setAssessmentAttachmentSet(
635:                    Set publishedAssessmentAttachmentSet) {
636:                this .publishedAssessmentAttachmentSet = publishedAssessmentAttachmentSet;
637:                this .data
638:                        .setAssessmentAttachmentSet(publishedAssessmentAttachmentSet);
639:            }
640:
641:            public List getAssessmentAttachmentList() {
642:                ArrayList list = new ArrayList();
643:                if (publishedAssessmentAttachmentSet != null) {
644:                    Iterator iter = publishedAssessmentAttachmentSet.iterator();
645:                    while (iter.hasNext()) {
646:                        AssessmentAttachmentIfc a = (AssessmentAttachmentIfc) iter
647:                                .next();
648:                        list.add(a);
649:                    }
650:                }
651:                return list;
652:            }
653:
654:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.