Source Code Cross Referenced for AssessmentFacade.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/AssessmentFacade.java $
003:         * $Id: AssessmentFacade.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.HashSet;
026:        import java.util.Iterator;
027:        import java.util.List;
028:        import java.util.Set;
029:
030:        import org.osid.assessment.AssessmentException;
031:        import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentData;
032:        import org.sakaiproject.tool.assessment.data.dao.assessment.SectionData;
033:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
034:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAttachmentIfc;
035:        import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc;
036:
037:        /**
038:         * <p>Title: </p>
039:         * <p>Description: </p>
040:         * <p>Copyright: Copyright (c) 2004</p>
041:         * <p>Company: </p>
042:         * @author not attributable
043:         * @version 1.0
044:         */
045:
046:        public class AssessmentFacade extends AssessmentBaseFacade implements 
047:                java.io.Serializable, AssessmentIfc {
048:            private static final long serialVersionUID = 7526471155622776147L;
049:            private AssessmentIfc data;
050:            private Long assessmentTemplateId;
051:            private Long assessmentId;
052:            private Set sectionSet;
053:            private Set assessmentAttachmentSet;
054:
055:            public AssessmentFacade() {
056:                //super();
057:                this .data = new AssessmentData();
058:                try {
059:                    // assessment(org.osid.assessment.Assessment) is a protected properties
060:                    // in AssessmentBaseFacade
061:                    assessment.updateData(this .data);
062:                } catch (AssessmentException ex) {
063:                    throw new DataFacadeException(ex.getMessage());
064:                }
065:            }
066:
067:            /**
068:             * IMPORTANT: this constructor do not have "data", this constructor is
069:             * merely used for holding assessmentBaseId (which is the assessmentId), Title
070:             * & lastModifiedDate for displaying purpose.
071:             * This constructor does not persist data (which it has none) to DB
072:             * @param id
073:             * @param title
074:             * @param lastModifiedDate
075:             */
076:            public AssessmentFacade(Long id, String title, Date lastModifiedDate) {
077:                // in the case of template assessmentBaseId is the assessmentTemplateId
078:                super .setAssessmentBaseId(id);
079:                super .setTitle(title);
080:                super .setLastModifiedDate(lastModifiedDate);
081:            }
082:
083:            public AssessmentFacade(AssessmentIfc data, Boolean loadSection) {
084:                try {
085:                    // assessment(org.osid.assessment.Assessment) is a protected properties
086:                    // in AssessmentBaseFacade
087:                    //assessment.updateData(this.data);
088:                    super .setData(data);
089:                } catch (AssessmentException ex) {
090:                    throw new DataFacadeException(ex.getMessage());
091:                }
092:                // super class does not have assessmentTemplateId nor sectionSet and assessmentAttachmentSet,
093:                // so we need to set it here
094:                this .assessmentTemplateId = data.getAssessmentTemplateId();
095:                this .assessmentAttachmentSet = data
096:                        .getAssessmentAttachmentSet();
097:                // sectionSet is a set of SectionFacade
098:                this .sectionSet = new HashSet();
099:
100:                // check if we need to load section
101:                if (loadSection.equals(Boolean.TRUE)) {
102:                    Set dataSet = data.getSectionSet();
103:                    Iterator iter = dataSet.iterator();
104:                    while (iter.hasNext()) {
105:                        SectionData s = (SectionData) iter.next();
106:                        this .sectionSet.add(new SectionFacade(s));
107:                    }
108:                }
109:            }
110:
111:            public AssessmentFacade(AssessmentIfc data) {
112:                try {
113:                    // assessment(org.osid.assessment.Assessment) is a protected properties
114:                    // in AssessmentBaseFacade
115:                    //assessment.updateData(this.data);
116:                    super .setData(data);
117:                } catch (AssessmentException ex) {
118:                    throw new DataFacadeException(ex.getMessage());
119:                }
120:                // super class does not have assessmentTemplateId nor sectionSet and AssessmentAttachemntSet,
121:                // so we need to set it here
122:                this .assessmentTemplateId = data.getAssessmentTemplateId();
123:                this .assessmentAttachmentSet = data
124:                        .getAssessmentAttachmentSet();
125:                // sectionSet is a set of SectionFacade
126:                this .sectionSet = new HashSet();
127:                Set dataSet = data.getSectionSet();
128:                Iterator iter = dataSet.iterator();
129:                while (iter.hasNext()) {
130:                    SectionData s = (SectionData) iter.next();
131:                    this .sectionSet.add(new SectionFacade(s));
132:                }
133:            }
134:
135:            public Long getAssessmentId() {
136:                try {
137:                    this .data = (AssessmentIfc) assessment.getData();
138:                } catch (AssessmentException ex) {
139:                    throw new DataFacadeException(ex.getMessage());
140:                }
141:                return this .data.getAssessmentId();
142:            }
143:
144:            public Long getAssessmentTemplateId() {
145:                try {
146:                    this .data = (AssessmentIfc) assessment.getData();
147:                } catch (AssessmentException ex) {
148:                    ex.printStackTrace();
149:                    throw new DataFacadeException(ex.getMessage());
150:                }
151:                return this .data.getAssessmentTemplateId();
152:            }
153:
154:            public void setAssessmentTemplateId(Long assessmentTemplateId) {
155:                this .assessmentTemplateId = assessmentTemplateId;
156:                this .data.setAssessmentTemplateId(assessmentTemplateId);
157:            }
158:
159:            public Set getSectionSet() {
160:                try {
161:                    this .data = (AssessmentIfc) assessment.getData();
162:                } catch (AssessmentException ex) {
163:                    throw new DataFacadeException(ex.getMessage());
164:                }
165:                this .sectionSet = new HashSet();
166:                Set dataSet = this .data.getSectionSet();
167:                Iterator iter = dataSet.iterator();
168:                while (iter.hasNext()) {
169:                    SectionData s = (SectionData) iter.next();
170:                    this .sectionSet.add(new SectionFacade(s));
171:                }
172:                return this .sectionSet;
173:            }
174:
175:            // sectionSet must be a set of SectionFacade
176:            public void setSectionSet(Set sectionSet) {
177:                this .sectionSet = sectionSet;
178:                HashSet set = new HashSet();
179:                Iterator iter = sectionSet.iterator();
180:                while (iter.hasNext()) {
181:                    SectionFacade sf = (SectionFacade) iter.next();
182:                    set.add(sf.getData());
183:                }
184:                this .data.setSectionSet(set);
185:            }
186:
187:            public ArrayList getSectionArray() {
188:                ArrayList list = new ArrayList();
189:                if (this .sectionSet != null) {
190:                    Iterator iter = this .sectionSet.iterator();
191:                    while (iter.hasNext()) {
192:                        SectionFacade s = (SectionFacade) iter.next();
193:                        list.add(s);
194:                    }
195:                }
196:                return list;
197:            }
198:
199:            public ArrayList getSectionArraySorted() {
200:                ArrayList list = getSectionArray();
201:                Collections.sort(list);
202:                return list;
203:            }
204:
205:            public SectionDataIfc getSection(Long sequence) {
206:                ArrayList list = getSectionArraySorted();
207:                if (list == null)
208:                    return null;
209:                else
210:                    return (SectionDataIfc) list.get(sequence.intValue() - 1);
211:            }
212:
213:            public SectionDataIfc getDefaultSection() {
214:                ArrayList list = getSectionArraySorted();
215:                if (list == null)
216:                    return null;
217:                else
218:                    return (SectionDataIfc) list.get(0);
219:            }
220:
221:            public Set getAssessmentAttachmentSet() throws DataFacadeException {
222:                try {
223:                    this .data = (AssessmentIfc) assessment.getData();
224:                    this .assessmentAttachmentSet = data
225:                            .getAssessmentAttachmentSet();
226:                } catch (AssessmentException ex) {
227:                    throw new DataFacadeException(ex.getMessage());
228:                }
229:                return assessmentAttachmentSet;
230:            }
231:
232:            public void setAssessmentAttachmentSet(Set assessmentAttachmentSet) {
233:                this .assessmentAttachmentSet = assessmentAttachmentSet;
234:                this .data.setAssessmentAttachmentSet(assessmentAttachmentSet);
235:            }
236:
237:            public List getAssessmentAttachmentList() {
238:                ArrayList list = new ArrayList();
239:                if (assessmentAttachmentSet != null) {
240:                    Iterator iter = assessmentAttachmentSet.iterator();
241:                    while (iter.hasNext()) {
242:                        AssessmentAttachmentIfc a = (AssessmentAttachmentIfc) iter
243:                                .next();
244:                        list.add(a);
245:                    }
246:                }
247:                return list;
248:            }
249:
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.