Source Code Cross Referenced for AssessmentServiceImpl.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » shared » impl » assessment » 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.shared.impl.assessment 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL$
003:         * $Id$
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.shared.impl.assessment;
021:
022:        import java.util.List;
023:
024:        import org.apache.commons.logging.Log;
025:        import org.apache.commons.logging.LogFactory;
026:
027:        import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentTemplateData;
028:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
029:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentTemplateIfc;
030:        import org.sakaiproject.tool.assessment.data.ifc.assessment.SectionDataIfc;
031:        import org.sakaiproject.tool.assessment.facade.AssessmentFacade;
032:        import org.sakaiproject.tool.assessment.facade.SectionFacade;
033:        import org.sakaiproject.tool.assessment.services.assessment.AssessmentService;
034:        import org.sakaiproject.tool.assessment.shared.api.assessment.AssessmentServiceAPI;
035:        import org.sakaiproject.tool.assessment.services.assessment.AssessmentServiceException;
036:
037:        /**
038:         * AssessmentServiceImpl implements a shared interface to get/set assessment
039:         * information.
040:         * @author Ed Smiley <esmiley@stanford.edu>
041:         */
042:        public class AssessmentServiceImpl implements  AssessmentServiceAPI {
043:            private static Log log = LogFactory
044:                    .getLog(AssessmentServiceImpl.class);
045:
046:            /**
047:             * Get assessment template from id string.
048:             * @param assessmentTemplateId
049:             * @return the assessment template
050:             */
051:            public AssessmentTemplateIfc getAssessmentTemplate(
052:                    String assessmentTemplateId) {
053:                try {
054:                    AssessmentService service = new AssessmentService();
055:                    return service.getAssessmentTemplate(assessmentTemplateId);
056:                } catch (Exception ex) {
057:                    throw new AssessmentServiceException(ex);
058:                }
059:            }
060:
061:            /**
062:             * Get assessment from id string.
063:             * @param assessmentId
064:             * @return the assessment
065:             */
066:            public AssessmentIfc getAssessment(String assessmentId) {
067:                try {
068:                    AssessmentService service = new AssessmentService();
069:                    return service.getAssessment(assessmentId);
070:                } catch (Exception ex) {
071:                    throw new AssessmentServiceException(ex);
072:                }
073:            }
074:
075:            /**
076:             * Get an assessment with only basic info populated..
077:             * @param assessmentId teh assessment id string.
078:             * @return an assessment with only basic info populated.
079:             */
080:            public AssessmentIfc getBasicInfoOfAnAssessment(String assessmentId) {
081:                try {
082:                    AssessmentService service = new AssessmentService();
083:                    return service.getBasicInfoOfAnAssessment(assessmentId);
084:                } catch (Exception ex) {
085:                    throw new AssessmentServiceException(ex);
086:                }
087:            }
088:
089:            /**
090:             * Get a list of assessment templates.
091:             * @return the list.
092:             */
093:            public List getAllAssessmentTemplates() {
094:                try {
095:                    AssessmentService service = new AssessmentService();
096:                    return service.getAllAssessmentTemplates();
097:                } catch (Exception ex) {
098:                    throw new AssessmentServiceException(ex);
099:                }
100:            }
101:
102:            /**
103:             * Get a list of all active assessment templates.
104:             * @return the list
105:             */
106:            public List getAllActiveAssessmentTemplates() {
107:                try {
108:                    AssessmentService service = new AssessmentService();
109:                    return service.getAllActiveAssessmentTemplates();
110:                } catch (Exception ex) {
111:                    throw new AssessmentServiceException(ex);
112:                }
113:            }
114:
115:            /**
116:             * Get a list of all the assessment template titles.
117:             * @return the list.
118:             */
119:            public List getTitleOfAllActiveAssessmentTemplates() {
120:                try {
121:                    AssessmentService service = new AssessmentService();
122:                    return service.getTitleOfAllActiveAssessmentTemplates();
123:                } catch (Exception ex) {
124:                    throw new AssessmentServiceException(ex);
125:                }
126:            }
127:
128:            /**
129:             * Get an ordered list of assessments.
130:             * @param orderBy sort order field.
131:             * @return the list.
132:             */
133:            public List getAllAssessments(String orderBy) {
134:                try {
135:                    AssessmentService service = new AssessmentService();
136:                    return service.getAllAssessments(orderBy);
137:                } catch (Exception ex) {
138:                    throw new AssessmentServiceException(ex);
139:                }
140:            }
141:
142:            /**
143:             * Get all active assessments.
144:             * @param orderBy sort order field.
145:             * @return the list.
146:             */
147:            public List getAllActiveAssessments(String orderBy) {
148:                try {
149:                    AssessmentService service = new AssessmentService();
150:                    return service.getAllActiveAssessments(orderBy);
151:                } catch (Exception ex) {
152:                    throw new AssessmentServiceException(ex);
153:                }
154:
155:            }
156:
157:            /**
158:             * Get list of all active assessment's settings.
159:             * @param orderBy sort order field.
160:             * @return the list.
161:             */
162:            public List getSettingsOfAllActiveAssessments(String orderBy) {
163:                try {
164:                    AssessmentService service = new AssessmentService();
165:                    return service.getSettingsOfAllActiveAssessments(orderBy);
166:                } catch (Exception ex) {
167:                    throw new AssessmentServiceException(ex);
168:                }
169:
170:            }
171:
172:            /**
173:             * Get list of all active assessments with only basic info populated.
174:             * @param orderBy
175:             * @param ascending ascending sort if true
176:             * @param orderBy sort order field.
177:             * @return the list.
178:             */
179:            public List getBasicInfoOfAllActiveAssessments(String orderBy,
180:                    boolean ascending) {
181:                try {
182:                    AssessmentService service = new AssessmentService();
183:                    return service.getBasicInfoOfAllActiveAssessments(orderBy,
184:                            ascending);
185:                } catch (Exception ex) {
186:                    throw new AssessmentServiceException(ex);
187:                }
188:            }
189:
190:            /**
191:             * Get list of all active assessments with only basic info populated.
192:             * @param orderBy
193:             * @param orderBy sort order field.
194:             * @return the list.
195:             */
196:            public List getBasicInfoOfAllActiveAssessments(String orderBy) {
197:                try {
198:                    AssessmentService service = new AssessmentService();
199:                    return service.getBasicInfoOfAllActiveAssessments(orderBy);
200:                } catch (Exception ex) {
201:                    throw new AssessmentServiceException(ex);
202:                }
203:            }
204:
205:            /**
206:             * Get list of all active assessments.
207:             * @param orderBy
208:             * @param pageSize number in a page
209:             * @param pageNumber number of the page
210:             * @param orderBy sort order field.
211:             * @return the list.
212:             */
213:            public List getAllAssessments(int pageSize, int pageNumber,
214:                    String orderBy) {
215:                try {
216:                    AssessmentService service = new AssessmentService();
217:                    return service.getAllAssessments(pageSize, pageNumber,
218:                            orderBy);
219:                } catch (Exception ex) {
220:                    throw new AssessmentServiceException(ex);
221:                }
222:            }
223:
224:            /**
225:             * Create an assessment.
226:             * @param title the title
227:             * @param description the description
228:             * @param typeId the type id
229:             * @param templateId the template's template id
230:             * @return the created assessment.
231:             */
232:            public AssessmentIfc createAssessment(String title,
233:                    String description, String typeId, String templateId) {
234:                try {
235:                    AssessmentService service = new AssessmentService();
236:                    return service.createAssessment(title, description, typeId,
237:                            templateId);
238:                } catch (Exception ex) {
239:                    throw new AssessmentServiceException(ex);
240:                }
241:            }
242:
243:            /**
244:             * Get number of questions.
245:             * @param assessmentId the assessment id string.
246:             * @return the number.
247:             */
248:            public int getQuestionSize(String assessmentId) {
249:                try {
250:                    AssessmentService service = new AssessmentService();
251:                    return service.getQuestionSize(assessmentId);
252:                } catch (Exception ex) {
253:                    throw new AssessmentServiceException(ex);
254:                }
255:            }
256:
257:            /**
258:             * Update an assessment coupled to the persistence layer
259:             * @param assessment the assessment interface of the POJO
260:             */
261:            public void update(AssessmentIfc assessment) {
262:                try {
263:                    AssessmentService service = new AssessmentService();
264:                    AssessmentFacade facade = service.getAssessment(assessment
265:                            .getAssessmentId().toString());
266:                    service.update(facade);
267:                } catch (Exception ex) {
268:                    throw new AssessmentServiceException(ex);
269:                }
270:            }
271:
272:            public void save(AssessmentTemplateIfc template) {
273:                try {
274:                    AssessmentService service = new AssessmentService();
275:                    AssessmentTemplateData data = (AssessmentTemplateData) service
276:                            .getAssessmentTemplate(
277:                                    template.getAssessmentTemplateId()
278:                                            .toString()).getData();
279:                    service.save(data);
280:                } catch (Exception ex) {
281:                    throw new AssessmentServiceException(ex);
282:                }
283:            }
284:
285:            /**
286:             * Save an assessment.
287:             * @param assessment the assessment.
288:             */
289:            public void saveAssessment(AssessmentIfc assessment) {
290:                try {
291:                    AssessmentService service = new AssessmentService();
292:                    AssessmentFacade facade = service.getAssessment(assessment
293:                            .getAssessmentId().toString());
294:                    service.saveAssessment(facade);
295:                } catch (Exception ex) {
296:                    throw new AssessmentServiceException(ex);
297:                }
298:            }
299:
300:            /**
301:             * Delete an assessment template from an assessment.
302:             * @param assessmentId the assessment id of the assessment.
303:             */
304:            public void deleteAssessmentTemplate(Long assessmentId) {
305:                try {
306:                    AssessmentService service = new AssessmentService();
307:                    service.deleteAssessmentTemplate(assessmentId);
308:                } catch (Exception ex) {
309:                    throw new AssessmentServiceException(ex);
310:                }
311:            }
312:
313:            /**
314:             * Remove the assessment.
315:             * @param assessmentId the assessment id string.
316:             */
317:            public void removeAssessment(String assessmentId) {
318:                try {
319:                    AssessmentService service = new AssessmentService();
320:                    service.removeAssessment(assessmentId);
321:                } catch (Exception ex) {
322:                    throw new AssessmentServiceException(ex);
323:                }
324:            }
325:
326:            /**
327:             * Add a section to an assessment.
328:             * @param assessmentId the assessment id string.
329:             * @return the section.
330:             */
331:            public SectionDataIfc addSection(String assessmentId) {
332:                try {
333:                    AssessmentService service = new AssessmentService();
334:                    return service.addSection(assessmentId);
335:                } catch (Exception ex) {
336:                    throw new AssessmentServiceException(ex);
337:                }
338:            }
339:
340:            /**
341:             * Remove a section.
342:             * @param sectionId its id.
343:             */
344:            public void removeSection(String sectionId) {
345:                try {
346:                    AssessmentService service = new AssessmentService();
347:                    service.removeSection(sectionId);
348:                } catch (Exception ex) {
349:                    throw new AssessmentServiceException(ex);
350:                }
351:            }
352:
353:            /**
354:             * Get a section.
355:             * @param sectionId the section id string.
356:             * @return the section.
357:             */
358:            public SectionDataIfc getSection(String sectionId) {
359:                try {
360:                    AssessmentService service = new AssessmentService();
361:                    return service.getSection(sectionId);
362:                } catch (Exception ex) {
363:                    throw new AssessmentServiceException(ex);
364:                }
365:            }
366:
367:            /**
368:             * Perform persistence saveOrUpdate on section.
369:             * @param section the section.
370:             */
371:            public void saveOrUpdateSection(SectionDataIfc section) {
372:                try {
373:                    AssessmentService service = new AssessmentService();
374:                    SectionFacade facade = service.getSection(section
375:                            .getSectionId().toString());
376:                    service.saveOrUpdateSection(facade);
377:                } catch (Exception ex) {
378:                    throw new AssessmentServiceException(ex);
379:                }
380:            }
381:
382:            /**
383:             * Move items between sections.
384:             * @param sourceSectionId source id.
385:             * @param destSectionId destination id.
386:             */
387:            public void moveAllItems(String sourceSectionId,
388:                    String destSectionId) {
389:                try {
390:                    AssessmentService service = new AssessmentService();
391:                    service.moveAllItems(sourceSectionId, destSectionId);
392:                } catch (Exception ex) {
393:                    throw new AssessmentServiceException(ex);
394:                }
395:            }
396:
397:            /**
398:             * Remove all items from a section.
399:             * @param sourceSectionId the section id string.
400:             */
401:            public void removeAllItems(String sourceSectionId) {
402:                try {
403:                    AssessmentService service = new AssessmentService();
404:                    service.removeAllItems(sourceSectionId);
405:                } catch (Exception ex) {
406:                    throw new AssessmentServiceException(ex);
407:                }
408:            }
409:
410:            /**
411:             * Get list of all active assessment templates with only basic info populated.
412:             * @param orderBy
413:             * @return the list.
414:             */
415:
416:            public List getBasicInfoOfAllActiveAssessmentTemplates(
417:                    String orderBy) {
418:                try {
419:                    AssessmentService service = new AssessmentService();
420:                    return service
421:                            .getBasicInfoOfAllActiveAssessmentTemplates(orderBy);
422:                } catch (Exception ex) {
423:                    throw new AssessmentServiceException(ex);
424:                }
425:            }
426:
427:            /**
428:             * Create an assessment without a default section.
429:             * Section must be created later.  (This facilitates batch uploads such as
430:             * QTI import where the section titles are all named in the incoming
431:             * document.)
432:             *
433:             * @param title
434:             * @param description
435:             * @param typeId
436:             * @param templateId
437:             * @return
438:             */
439:            public AssessmentIfc createAssessmentWithoutDefaultSection(
440:                    String title, String description, String typeId,
441:                    String templateId) {
442:                try {
443:                    AssessmentService service = new AssessmentService();
444:                    return service.createAssessmentWithoutDefaultSection(title,
445:                            description, typeId, templateId);
446:                } catch (Exception ex) {
447:                    throw new AssessmentServiceException(ex);
448:                }
449:            }
450:        }
w__ww___.j___av___a__2__s___.__com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.