Source Code Cross Referenced for PublishedAssessmentServiceImpl.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:        import java.util.Map;
024:
025:        import org.apache.commons.logging.Log;
026:        import org.apache.commons.logging.LogFactory;
027:
028:        import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
029:        import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc;
030:        import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemMetaDataIfc;
031:        import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemTextIfc;
032:        import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc;
033:        import org.sakaiproject.tool.assessment.facade.AssessmentFacade;
034:        import org.sakaiproject.tool.assessment.facade.ItemFacade;
035:        import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade;
036:        import org.sakaiproject.tool.assessment.services.ItemService;
037:        import org.sakaiproject.tool.assessment.services.assessment.AssessmentService;
038:        import org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService;
039:        import org.sakaiproject.tool.assessment.services.assessment.AssessmentServiceException;
040:        import org.sakaiproject.tool.assessment.shared.api.assessment.PublishedAssessmentServiceAPI;
041:
042:        // Note on takability:
043:        // * rachelgollub: So takeable is that you have *not* reached the number of
044:        // * submissions and you're either before the due date or (you're after the due
045:        // * date, you haven't submitted yet, and late handling is enabled).
046:        // * - quoted from IM on 1/31/05
047:        // * Marc said some of the assessment do not have any due date, e.g. survey
048:        // *
049:
050:        /**
051:         * PublishedAssessmentServiceImpl implements a shared interface to get/set
052:         * published assessment information.
053:         * @author Ed Smiley <esmiley@stanford.edu>
054:         */
055:        public class PublishedAssessmentServiceImpl implements 
056:                PublishedAssessmentServiceAPI {
057:            private static Log log = LogFactory
058:                    .getLog(PublishedAssessmentServiceImpl.class);
059:
060:            /**
061:             * Get list of all active published assessments with basic info populated.
062:             * @param agentId the agent takign the assessments
063:             * @param orderBy sort order field.
064:             * @return the list.
065:             */
066:            public List getBasicInfoOfAllPublishedAssessments(String agentId,
067:                    String orderBy, boolean ascending, String siteId) {
068:                try {
069:                    PublishedAssessmentService service = new PublishedAssessmentService();
070:                    return service.getBasicInfoOfAllPublishedAssessments(
071:                            agentId, orderBy, ascending, siteId);
072:                } catch (Exception ex) {
073:                    throw new AssessmentServiceException(ex);
074:                }
075:            }
076:
077:            /**
078:             * Get list of all active published assessments.
079:             * @param orderBy sort order field.
080:             * @return the list.
081:             */
082:            public List getAllActivePublishedAssessments(String orderBy) {
083:                try {
084:                    PublishedAssessmentService service = new PublishedAssessmentService();
085:                    return service.getAllActivePublishedAssessments(orderBy);
086:                } catch (Exception ex) {
087:                    throw new AssessmentServiceException(ex);
088:                }
089:            }
090:
091:            /**
092:             * Get list of all active published assessments.
093:             * @param pageSize number in a page
094:             * @param pageNumber number of the page
095:             * @param orderBy sort order field.
096:             * @return the list.
097:             */
098:            public List getAllActivePublishedAssessments(int pageSize,
099:                    int pageNumber, String orderBy) {
100:                try {
101:                    PublishedAssessmentService service = new PublishedAssessmentService();
102:                    return service.getAllActivePublishedAssessments(pageSize,
103:                            pageNumber, orderBy);
104:                } catch (Exception ex) {
105:                    throw new AssessmentServiceException(ex);
106:                }
107:            }
108:
109:            /**
110:             * Get list of all inactive published assessments.
111:             * @param orderBy sort order field.
112:             * @return the list.
113:             */
114:            public List getAllInActivePublishedAssessments(String orderBy) {
115:                try {
116:                    PublishedAssessmentService service = new PublishedAssessmentService();
117:                    return service.getAllInActivePublishedAssessments(orderBy);
118:                } catch (Exception ex) {
119:                    throw new AssessmentServiceException(ex);
120:                }
121:            }
122:
123:            /**
124:             * Get list of all inactive published assessments.
125:             * @param pageSize number in a page
126:             * @param pageNumber number of the page
127:             * @param orderBy sort order field.
128:             * @return the list.
129:             */
130:
131:            public List getAllInActivePublishedAssessments(int pageSize,
132:                    int pageNumber, String orderBy) {
133:                try {
134:                    PublishedAssessmentService service = new PublishedAssessmentService();
135:                    return service.getAllInActivePublishedAssessments(pageSize,
136:                            pageNumber, orderBy);
137:                } catch (Exception ex) {
138:                    throw new AssessmentServiceException(ex);
139:                }
140:            }
141:
142:            /**
143:             * Get list of all inactive published assessments.
144:             * @param orderBy sort order field.
145:             * @param status the status code
146:             * @return the list.
147:             */
148:
149:            public List getAllPublishedAssessments(String orderBy,
150:                    Integer status) {
151:                try {
152:                    PublishedAssessmentService service = new PublishedAssessmentService();
153:                    return service.getAllPublishedAssessments(orderBy, status);
154:                } catch (Exception ex) {
155:                    throw new AssessmentServiceException(ex);
156:                }
157:            }
158:
159:            /**
160:             * Get list of all inactive published assessments.
161:             * @param pageSize number in a page
162:             * @param pageNumber number of the page
163:             * @param orderBy sort order field.
164:             * @param status the status
165:             * @return the list.
166:             */
167:            public List getAllPublishedAssessments(int pageSize,
168:                    int pageNumber, String orderBy, Integer status) {
169:                try {
170:                    PublishedAssessmentService service = new PublishedAssessmentService();
171:                    return service.getAllPublishedAssessments(pageSize,
172:                            pageNumber, orderBy, status);
173:                } catch (Exception ex) {
174:                    throw new AssessmentServiceException(ex);
175:                }
176:            }
177:
178:            /**
179:             * Get published assessment.
180:             * @param assessmentId the published assessment id string
181:             * @return the published assessment.
182:             */
183:            public PublishedAssessmentIfc getPublishedAssessment(
184:                    String assessmentId) {
185:                try {
186:                    PublishedAssessmentService service = new PublishedAssessmentService();
187:                    return service.getPublishedAssessment(assessmentId);
188:                } catch (Exception ex) {
189:                    throw new AssessmentServiceException(ex);
190:                }
191:            }
192:
193:            /**
194:             * Get the published id form the assessment id.
195:             * @param assessmentId the assessment id string.
196:             * @return the published assessment id.
197:             */
198:            public Long getPublishedAssessmentId(String assessmentId) {
199:                try {
200:                    PublishedAssessmentService service = new PublishedAssessmentService();
201:                    return service.getPublishedAssessmentId(assessmentId);
202:                } catch (Exception ex) {
203:                    throw new AssessmentServiceException(ex);
204:                }
205:            }
206:
207:            /**
208:             * Publish an assessment.
209:             * @param assessment
210:             * @return
211:             */
212:            public PublishedAssessmentIfc publishAssessment(
213:                    AssessmentIfc assessment) {
214:                try {
215:                    PublishedAssessmentService service = new PublishedAssessmentService();
216:                    AssessmentService assessmentService = new AssessmentService();
217:                    AssessmentFacade facade = assessmentService
218:                            .getAssessment(assessment.getAssessmentId()
219:                                    .toString());
220:                    return service.publishAssessment(facade);
221:                } catch (Exception ex) {
222:                    throw new AssessmentServiceException(ex);
223:                }
224:            }
225:
226:            /**
227:             * Preview a published assessment.
228:             * @param assessment the assessment to preview.
229:             * @return the published assessment "view" into the assessment.
230:             */
231:            public PublishedAssessmentIfc publishPreviewAssessment(
232:                    AssessmentIfc assessment, String protocol) {
233:                try {
234:                    PublishedAssessmentService service = new PublishedAssessmentService();
235:                    AssessmentService assessmentService = new AssessmentService();
236:                    AssessmentFacade facade = assessmentService
237:                            .getAssessment(assessment.getAssessmentId()
238:                                    .toString());
239:                    return service.publishPreviewAssessment(facade);
240:                } catch (Exception ex) {
241:                    throw new AssessmentServiceException(ex);
242:                }
243:            }
244:
245:            /**
246:             * Save a published assessment.
247:             * @param assessment the published assessment.
248:             */
249:            public void saveAssessment(PublishedAssessmentIfc assessment) {
250:                try {
251:                    PublishedAssessmentService service = new PublishedAssessmentService();
252:                    PublishedAssessmentFacade facade = service
253:                            .getPublishedAssessment(assessment
254:                                    .getAssessmentId().toString());
255:                    service.saveAssessment(facade);
256:                } catch (Exception ex) {
257:                    throw new AssessmentServiceException(ex);
258:                }
259:            }
260:
261:            /**
262:             * Remove the published assessment.
263:             * @param assessmentId the published assessment id string.
264:             */
265:            public void removeAssessment(String assessmentId) {
266:                try {
267:                    PublishedAssessmentService service = new PublishedAssessmentService();
268:                    service.removeAssessment(assessmentId);
269:                } catch (Exception ex) {
270:                    throw new AssessmentServiceException(ex);
271:                }
272:            }
273:
274:            /**
275:             * Get list of all active published assessments with only basic info populated.
276:             * @param ascending true if ascending sort.
277:             * @param orderBy sort order field.
278:             * @return the list.
279:             */
280:            public List getBasicInfoOfAllActivePublishedAssessments(
281:                    String orderBy, boolean ascending) {
282:                try {
283:                    PublishedAssessmentService service = new PublishedAssessmentService();
284:                    return service.getBasicInfoOfAllActivePublishedAssessments(
285:                            orderBy, ascending);
286:                } catch (Exception ex) {
287:                    throw new AssessmentServiceException(ex);
288:                }
289:            }
290:
291:            /**
292:             * Get list of all inactive published assessments with only basic info populated.
293:             * @param ascending true if ascending sort.
294:             * @param orderBy sort order field.
295:             * @return the list.
296:             */
297:            public List getBasicInfoOfAllInActivePublishedAssessments(
298:                    String orderBy, boolean ascending) {
299:                try {
300:                    PublishedAssessmentService service = new PublishedAssessmentService();
301:                    return service
302:                            .getBasicInfoOfAllInActivePublishedAssessments(
303:                                    orderBy, ascending);
304:                } catch (Exception ex) {
305:                    throw new AssessmentServiceException(ex);
306:                }
307:            }
308:
309:            /**
310:             * Get setttings of published assessment.
311:             * @param assessmentId the published assessment id string
312:             * @return the published assessment
313:             */
314:            public PublishedAssessmentIfc getSettingsOfPublishedAssessment(
315:                    String assessmentId) {
316:                try {
317:                    PublishedAssessmentService service = new PublishedAssessmentService();
318:                    return service
319:                            .getSettingsOfPublishedAssessment(assessmentId);
320:                } catch (Exception ex) {
321:                    throw new AssessmentServiceException(ex);
322:                }
323:            }
324:
325:            /**
326:             * Load an item that has been published
327:             * @param itemId
328:             * @return
329:             */
330:            public ItemDataIfc loadPublishedItem(String itemId) {
331:                try {
332:                    PublishedAssessmentService service = new PublishedAssessmentService();
333:                    return service.loadPublishedItem(itemId);
334:                } catch (Exception ex) {
335:                    throw new AssessmentServiceException(ex);
336:                }
337:            }
338:
339:            /**
340:             * Load published assessment item text.
341:             * @param itemTextId the id string of the itemtext.
342:             * @return the item.
343:             */
344:            public ItemTextIfc loadPublishedItemText(String itemTextId) {
345:                try {
346:                    PublishedAssessmentService service = new PublishedAssessmentService();
347:                    return service.loadPublishedItemText(itemTextId);
348:                } catch (Exception ex) {
349:                    throw new AssessmentServiceException(ex);
350:                }
351:            }
352:
353:            /**
354:             * Get list of all last submitterd published assessments with only basic info populated.
355:             * @param agentId the agent taking the assessments.
356:             * @param ascending true if ascending sort.
357:             * @param orderBy sort order field.
358:             * @return the list.
359:             */
360:            public List getBasicInfoOfLastSubmittedAssessments(String agentId,
361:                    String orderBy, boolean ascending) {
362:                try {
363:                    PublishedAssessmentService service = new PublishedAssessmentService();
364:                    return service.getBasicInfoOfLastSubmittedAssessments(
365:                            agentId, orderBy, ascending);
366:                } catch (Exception ex) {
367:                    throw new AssessmentServiceException(ex);
368:                }
369:            }
370:
371:            /**
372:             * Get the number of total submissions per assignment.
373:             * @param agentId the agent making submissions
374:             * @return Map by(Long publishedAssessmentId->Integer totalSubmittedForGrade)
375:             */
376:
377:            public Map getTotalSubmissionPerAssessment(String agentId) {
378:                try {
379:                    PublishedAssessmentService service = new PublishedAssessmentService();
380:                    return service.getTotalSubmissionPerAssessment(agentId);
381:                } catch (Exception ex) {
382:                    throw new AssessmentServiceException(ex);
383:                }
384:            }
385:
386:            /**
387:             * Get the number of total submissions for one assignment.
388:             * @param agentId the agent making submissions
389:             * @param publishedAssessmentId the published assessment id string
390:             * @return the total
391:             */
392:            public Integer getTotalSubmission(String agentId,
393:                    String publishedAssessmentId) {
394:                try {
395:                    PublishedAssessmentService service = new PublishedAssessmentService();
396:                    return service.getTotalSubmission(agentId,
397:                            publishedAssessmentId);
398:                } catch (Exception ex) {
399:                    throw new AssessmentServiceException(ex);
400:                }
401:            }
402:
403:            /**
404:             * Get a published assessment using an alias
405:             * @param alias the alias
406:             * @return the published assessment
407:             */
408:            public PublishedAssessmentIfc getPublishedAssessmentIdByAlias(
409:                    String alias) {
410:                try {
411:                    PublishedAssessmentService service = new PublishedAssessmentService();
412:                    return service.getPublishedAssessmentIdByAlias(alias);
413:                } catch (Exception ex) {
414:                    throw new AssessmentServiceException(ex);
415:                }
416:            }
417:
418:            /**
419:             * @todo check persistence of this method!
420:             * @param meta
421:             */
422:            public void saveOrUpdateMetaData(ItemMetaDataIfc meta) {
423:                try {
424:                    // because our service implementation cannot cast to
425:                    // the PublishedAssessmentService.saveOrUpdateMetaData()
426:                    // we get the item, update the metadata, and persist
427:                    ItemService itemService = new ItemService();
428:                    ItemDataIfc itemIfc = meta.getItem();
429:                    itemIfc.getItemMetaDataSet().add(meta);
430:                    ItemFacade facade = itemService.getItem(itemIfc
431:                            .getItemIdString());
432:                    itemService.saveItem(facade);
433:                } catch (Exception ex) {
434:                    throw new AssessmentServiceException(ex);
435:                }
436:            }
437:
438:            /**
439:             * Get a map of the feedback
440:             * @return the map
441:             */
442:            public Map getFeedbackHash() {
443:                try {
444:                    PublishedAssessmentService service = new PublishedAssessmentService();
445:                    return service.getFeedbackHash();
446:                } catch (Exception ex) {
447:                    throw new AssessmentServiceException(ex);
448:                }
449:            }
450:
451:            /**
452:             * Get list of all active published assessmentsreleased to authenticated users.
453:             * @return the list.
454:             */
455:            public Map getAllAssessmentsReleasedToAuthenticatedUsers() {
456:                try {
457:                    PublishedAssessmentService service = new PublishedAssessmentService();
458:                    return service
459:                            .getAllAssessmentsReleasedToAuthenticatedUsers();
460:                } catch (Exception ex) {
461:                    throw new AssessmentServiceException(ex);
462:                }
463:            }
464:
465:            /**
466:             * Get the owner.
467:             * @param publishedAssessmentId
468:             * @return the owner string.
469:             */
470:            public String getPublishedAssessmentOwner(Long publishedAssessmentId) {
471:                try {
472:                    PublishedAssessmentService service = new PublishedAssessmentService();
473:                    return service
474:                            .getPublishedAssessmentOwner(publishedAssessmentId);
475:                } catch (Exception ex) {
476:                    throw new AssessmentServiceException(ex);
477:                }
478:            }
479:        }
w__ww__.___j_a_v_a___2__s___._co___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.