Source Code Cross Referenced for QTIService.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » services » qti » 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.services.qti 
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/services/qti/QTIService.java $
003:         * $Id: QTIService.java 9273 2006-05-10 22:34:28Z 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.services.qti;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:        import org.sakaiproject.tool.assessment.facade.AssessmentFacade;
025:        import org.sakaiproject.tool.assessment.facade.ItemFacade;
026:        import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade;
027:        import org.sakaiproject.tool.assessment.qti.constants.QTIVersion;
028:        import org.sakaiproject.tool.assessment.qti.helper.AuthoringHelper;
029:        import org.w3c.dom.Document;
030:
031:        /**
032:         * <p>This service provides translation between database and QTI representations.
033:         * This is used to import/export IMS QTI format XML, and for web services.
034:         *  </p>
035:         * <p>Copyright: Copyright (c) 2005 Sakai</p>
036:         * <p> </p>
037:         * @author Ed Smiley esmiley@stanford.edu
038:         * @version $Id: QTIService.java 9273 2006-05-10 22:34:28Z daisyf@stanford.edu $
039:         */
040:
041:        public class QTIService {
042:            private static Log log = LogFactory.getLog(QTIService.class);
043:
044:            public QTIService() {
045:            }
046:
047:            /**
048:             * Import an assessment XML document in QTI format, extract & persist the data.
049:             * @param document the assessment XML document in QTI format
050:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
051:             * @return a persisted assessment
052:             */
053:            public AssessmentFacade createImportedAssessment(Document document,
054:                    int qtiVersion) {
055:                testQtiVersion(qtiVersion);
056:
057:                try {
058:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
059:                    return helper.createImportedAssessment(document);
060:                } catch (Exception ex) {
061:                    throw new QTIServiceException(ex);
062:                }
063:            }
064:
065:            public AssessmentFacade createImportedAssessment(Document document,
066:                    int qtiVersion, String unzipLocation, String templateId) {
067:                testQtiVersion(qtiVersion);
068:
069:                try {
070:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
071:                    return helper.createImportedAssessment(document,
072:                            unzipLocation, templateId);
073:                } catch (Exception ex) {
074:                    throw new QTIServiceException(ex);
075:                }
076:            }
077:
078:            /**
079:             * Import an assessment XML document in QTI format, extract & persist the data.
080:             * @param document the assessment XML document in QTI format
081:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
082:             * @return a persisted assessment
083:             */
084:            public AssessmentFacade createImportedAssessment(Document document,
085:                    int qtiVersion, String unzipLocation) {
086:                testQtiVersion(qtiVersion);
087:
088:                try {
089:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
090:                    return helper.createImportedAssessment(document,
091:                            unzipLocation);
092:                } catch (Exception ex) {
093:                    throw new QTIServiceException(ex);
094:                }
095:            }
096:
097:            /**
098:             * Import an assessment XML document in QTI format, extract & persist the data.
099:             * import process assumes assessment structure, not objectbank or itembank
100:             * based on usage in other potential migration systems, Respondus, BlackBoard, etc.
101:             * QTI version 2.x will probably focus on content packaging for question pools  
102:             * @param document the assessment XML document in QTI format
103:             * @param qtiVersion QTIVersion.VERSION_1_2;
104:             * @return a persisted assessment
105:             */
106:            public QuestionPoolFacade createImportedQuestionPool(
107:                    Document document, int qtiVersion) {
108:                testQtiVersion(qtiVersion);
109:
110:                try {
111:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
112:                    return helper.createImportedQuestionPool(document);
113:                } catch (Exception ex) {
114:                    throw new QTIServiceException(ex);
115:                }
116:            }
117:
118:            /**
119:             * Import an item XML document in QTI format, extract & persist the data.
120:             * @param document the item XML document in QTI format
121:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
122:             * @return a persisted item
123:             */
124:            public ItemFacade createImportedItem(Document document,
125:                    int qtiVersion) {
126:                testQtiVersion(qtiVersion);
127:
128:                try {
129:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
130:                    return helper.createImportedItem(document);
131:                } catch (Exception ex) {
132:                    throw new QTIServiceException(ex);
133:                }
134:
135:            }
136:
137:            /**
138:             * Get an assessment in Document form.
139:             *
140:             * Note:  this service requires a Faces context.
141:             *
142:             * @param assessmentId the assessment's Id
143:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
144:             * @return the Document with the assessment data
145:             */
146:            public Document getExportedAssessment(String assessmentId,
147:                    int qtiVersion) {
148:                testQtiVersion(qtiVersion);
149:
150:                try {
151:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
152:                    return helper.getAssessment(assessmentId);
153:                } catch (Exception ex) {
154:                    throw new QTIServiceException(ex);
155:                }
156:            }
157:
158:            /**
159:             * Get an item in Document form.
160:             *
161:             * Note:  this service requires a Faces context.
162:             *
163:             * @param itemId the item's Id
164:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
165:             * @return the Document with the assessment data
166:             */
167:            public Document getExportedItem(String itemId, int qtiVersion) {
168:                testQtiVersion(qtiVersion);
169:
170:                try {
171:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
172:                    return helper.getItem(itemId);
173:                } catch (Exception ex) {
174:                    throw new QTIServiceException(ex);
175:                }
176:            }
177:
178:            /**
179:             * Get an item bank in Document form.
180:             *
181:             * Note:  this service requires a Faces context.
182:             *
183:             * @param itemIds an array of item ids
184:             * @param qtiVersion either QTIVersion.VERSION_1_2 or QTIVersion.VERSION_2_0;
185:             * @return the Document with the item bank
186:             */
187:            public Document getExportedItemBank(String itemIds[], int qtiVersion) {
188:                testQtiVersion(qtiVersion);
189:
190:                try {
191:                    AuthoringHelper helper = new AuthoringHelper(qtiVersion);
192:                    return helper.getItemBank(itemIds);
193:                } catch (Exception ex) {
194:                    throw new QTIServiceException(ex);
195:                }
196:            }
197:
198:            /**
199:             * utility method
200:             * @param qtiVersion
201:             */
202:            private void testQtiVersion(int qtiVersion) {
203:                if (!QTIVersion.isValid(qtiVersion)) {
204:                    throw new QTIServiceException(new IllegalArgumentException(
205:                            "NOT Legal Qti Version."));
206:                }
207:            }
208:
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.